/* Artomy — 暗い部屋で片手で使う前提のダークUI。
   色の約束: 光の面=黄、暗い面=青(仕様書どおり)。付けていない場所はオレンジ/紫で対にする */
:root {
  --bg: #141416;
  --panel: #1c1c20;
  --panel-2: #24242a;
  --line: #2f2f36;
  --text: #ecebe6;
  --muted: #9a99a2;
  --light: #ffd23f;   /* 光の面・白 */
  --dark: #4c7dff;    /* 暗い面・ベタ */
  --not-beta: #ff9b3d;
  --not-white: #b77bff;
  --danger: #ff6b6b;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: system-ui, -apple-system, "Noto Sans JP", "Hiragino Sans", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overscroll-behavior: none; font-size: 15px; line-height: 1.65; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- ホーム ---------- */
#home { min-height: 100%; padding: 28px 18px calc(120px + var(--safe-b)); }
.home-head { padding: 24px 4px 20px; }
.wordmark { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.wordmark span { background: linear-gradient(90deg, var(--light), var(--dark)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history li button {
  width: 100%; display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center;
  padding: 10px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); text-align: left;
}
.history img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; background: #000; }
.history .h-title { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history .h-date { color: var(--muted); font-size: 12px; }

.empty { text-align: center; color: var(--muted); padding: 40px 12px; }
.empty p { margin: 12px 0; }
.empty .note { font-size: 12px; }
.empty-figure { display: inline-grid; grid-template-columns: repeat(4, 34px); height: 110px; border-radius: 14px; overflow: hidden; margin-bottom: 10px; }
.empty-figure span:nth-child(1) { background: #f4f2ea; }
.empty-figure span:nth-child(2) { background: #a9a8a2; }
.empty-figure span:nth-child(3) { background: #55555a; }
.empty-figure span:nth-child(4) { background: #0b0b0c; }

.dock { position: fixed; left: 0; right: 0; bottom: 0; padding: 14px 18px calc(18px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 35%); }
.pick {
  display: flex; align-items: center; justify-content: center; gap: 8px; height: 60px; border-radius: 30px;
  background: var(--text); color: #111; font-weight: 700; font-size: 17px; cursor: pointer;
}
.pick svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; }

/* ---------- 解剖画面 ---------- */
#view { position: fixed; inset: 0; display: flex; flex-direction: column; }
.stage { position: relative; flex: 0 0 52vh; overflow: hidden; background: #0c0c0d; touch-action: none; }
.zoom { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.zoom canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; image-rendering: auto; }
.pins { position: absolute; inset: 0; pointer-events: none; }
.pin {
  position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 800; pointer-events: auto;
  border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); transform-origin: center;
}
.pin.beta { background: var(--dark); color: #fff; }
.pin.nobeta { background: var(--not-beta); color: #1a1000; }
.pin.white { background: var(--light); color: #1a1500; }
.pin.nowhite { background: var(--not-white); color: #fff; }
.pin.flash { animation: flash 1s ease 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 10px rgba(255, 255, 255, .35); } }

.back {
  position: absolute; left: 10px; top: calc(10px + env(safe-area-inset-top, 0px)); width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: rgba(20, 20, 22, .7); display: grid; place-items: center; backdrop-filter: blur(6px);
}
.back svg { width: 22px; height: 22px; stroke: var(--text); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.legend { position: absolute; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; max-width: 80%; pointer-events: none; }
.legend span { font-size: 11px; padding: 2px 8px 2px 6px; border-radius: 10px; background: rgba(20, 20, 22, .78); display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.busy { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; background: rgba(12, 12, 13, .75); color: var(--muted); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--light); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.sheet { flex: 1 1 auto; overflow-y: auto; background: var(--panel); border-top: 1px solid var(--line); padding: 12px 14px 16px; -webkit-overflow-scrolling: touch; }
.tabs {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--tabs-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: var(--panel-2); border-top: 1px solid var(--line);
}
.tabs button { border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 600; position: relative; }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 30%; right: 30%; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: var(--light); }

/* ---------- 操作 ---------- */
.controls:empty { display: none; }
.controls { display: grid; gap: 10px; margin-bottom: 12px; }
.seg { display: flex; background: var(--bg); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 9px; color: var(--muted); font-size: 13px; font-weight: 600; }
.seg button.on { background: var(--panel-2); color: var(--text); }
.slider { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.slider input { flex: 1; accent-color: var(--light); }
.hist { width: 100%; height: 120px; display: block; border-radius: 10px; background: var(--bg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 18px; padding: 5px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { border-color: var(--light); }
.chip i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid #555; }

/* ---------- カード ---------- */
.cards { display: grid; gap: 12px; }
.card { background: var(--panel-2); border-radius: 16px; padding: 14px 14px 12px; border: 1px solid transparent; }
.card.flash { border-color: var(--light); }
.card h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.45; }
.card dl { margin: 0; display: grid; gap: 8px; }
.card dt { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.card dd { margin: 0; font-size: 14px; }
.card dt.how { color: var(--light); }
.pinrefs { display: flex; gap: 6px; margin-top: 10px; }
.pinref { width: 28px; height: 28px; border-radius: 50%; border: 0; font-weight: 800; font-size: 13px; }
.pinref.beta { background: var(--dark); color: #fff; }
.pinref.nobeta { background: var(--not-beta); color: #1a1000; }
.pinref.white { background: var(--light); color: #1a1500; }
.pinref.nowhite { background: var(--not-white); color: #fff; }

.big-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.big-points li { background: var(--panel-2); border-radius: 14px; padding: 12px 14px 12px 44px; position: relative; font-weight: 600; }
.big-points li::before { counter-increment: pt; content: counter(pt); position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--text); color: #111; font-size: 12px; display: grid; place-items: center; }
.big-points { counter-reset: pt; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); margin: 18px 2px 8px; letter-spacing: .05em; }
.recipe { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }
.meta { color: var(--muted); font-size: 12px; margin-top: 14px; }
.danger { margin-top: 18px; width: 100%; padding: 12px; border-radius: 12px; border: 1px solid #3a2626; background: none; color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); background: #eee; color: #111; padding: 10px 16px; border-radius: 20px; font-size: 13px; max-width: 90vw; z-index: 10; }
