:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #8a8a8a;
  --tile: 160px;          /* cube-app.js가 CubeCore.TILE 값으로 덮어쓴다 */
  --dim-opacity: 0.14;    /* 집중 보기에서 흐려지는 커버 */
}

html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
}

#stage { position: fixed; inset: 0; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
#stage.dragging { cursor: grabbing; }

.tile {
  position: absolute; left: 0; top: 0; width: var(--tile); height: var(--tile);
  transform-origin: 0 0; will-change: transform; cursor: pointer;
  background: #eee; box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  pointer-events: none; -webkit-user-drag: none; transition: opacity .35s ease;
}
.tile.selected { outline: 6px solid var(--ink); }
.tile.dim { background: transparent; box-shadow: none; }
.tile.dim img { opacity: var(--dim-opacity); }

/* 마인크래프트 이름표 느낌 */
.mc { font-family: "Galmuri11", ui-monospace, monospace; color: #fff; text-shadow: 2px 2px 0 #3f3f3f; white-space: nowrap; pointer-events: none; }
#tag { position: fixed; left: 0; top: 0; z-index: 900000; display: none; background: rgba(0, 0, 0, .55); padding: 4px 8px 5px; font-size: 12px; }

#hint {
  position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%); z-index: 950000;
  max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
  color: var(--muted); font-size: 12px; white-space: nowrap; pointer-events: none;
}
#hint.focus { color: var(--ink); }

/* 커버 사이 간격 조절 바. 안내 문구 바로 위에 둔다(둘 다 아래 전광판 위). */
#spacing {
  position: fixed; bottom: 68px; left: 50%; transform: translateX(-50%); z-index: 950000;
  display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; user-select: none;
}
#spacing input { width: 160px; margin: 0; accent-color: var(--ink); cursor: pointer; }
#spacing b { font-weight: 400; min-width: 3.2em; font-variant-numeric: tabular-nums; }

#empty { display: none; position: fixed; inset: 0; margin: 0; padding: 0 16px; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: 14px; }
body.is-empty #empty { display: flex; }
body.is-empty #stage, body.is-empty #hint, body.is-empty #spacing { display: none; }

/* ── 보기 토글: 두 보기에서 같은 자리(위쪽 가운데) ── */
#viewToggle {
  position: fixed; top: 46px; left: 50%; transform: translateX(-50%); z-index: 990000;
  display: flex; border: 1px solid #d4d4d4; background: var(--bg);
  transition: background-color .35s ease, border-color .35s ease;
}
#viewToggle button {
  font-family: "Galmuri11", ui-monospace, monospace; font-size: 12px; line-height: 1;
  padding: 6px 14px 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
#viewToggle button[aria-pressed="true"] { background: var(--ink); color: #ffffff; }
body.view-graph #viewToggle { background: #0a0a0a; border-color: #333333; }
body.view-graph #viewToggle button[aria-pressed="true"] { background: #ffffff; color: #0a0a0a; }
body.is-empty #viewToggle { display: none; }

/* ── 위·아래 전광판: 두 보기 공통(2026-11-23 사용자 요청). 큐브에서는 흰 띠, 도식에서는 검은 띠 ── */
.marquee {
  position: fixed; left: 0; right: 0; height: 34px; z-index: 970000; overflow: hidden; white-space: nowrap;
  display: flex; align-items: center; pointer-events: none;
  font-family: "Galmuri11", ui-monospace, monospace; background: var(--bg); color: var(--ink);
  border: 0 solid #e4e4e4; transition: background-color .35s ease, color .35s ease, border-color .35s ease;
}
.marquee.top { top: 0; border-bottom-width: 1px; font-size: 18px; }
.marquee.bottom { bottom: 0; border-top-width: 1px; font-size: 13px; color: var(--muted); }
.marquee .track { display: inline-block; animation: marquee-flow 60s linear infinite; }
@keyframes marquee-flow { from { transform: translateX(0); } to { transform: translateX(-50%); } }
body.view-graph .marquee { background: #0a0a0a; color: #ffffff; border-color: #262626; text-shadow: 2px 2px 0 #3f3f3f; }
body.view-graph .marquee.bottom { color: #9a9a9a; text-shadow: none; }
body.is-empty .marquee { display: none; }

/* ── 도식 보기 (docs/2026-11-22-tag-graph-design.md) ──
   큐브 위를 덮는 검은 층. body.view-graph일 때 나타난다(전환은 views.js). 색·크기 수치는 graph-app.js의 GRAPH_STYLE에 있다. */
#graph {
  position: fixed; inset: 0; z-index: 960000; overflow: hidden;
  background: #0a0a0a; color: #ffffff;
  opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s linear .35s;
}
body.view-graph #graph { opacity: 1; visibility: visible; transition: opacity .35s ease; }
#graph .graph-canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: grab; }
#graph.dragging .graph-canvas { cursor: grabbing; }
/* 이름표는 깊이 순서(z-index)로 겹친다. 그 순서가 패널·안내 위로 올라오지 않게 이 층 안에 가둔다. */
#graph .graph-labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
/* 불투명도는 깊이에 따라 매 프레임 바뀌므로 transition을 두지 않는다(두면 이름표마다 매 프레임 전환이 새로 시작된다) */
#graph .graph-label { position: absolute; left: 0; top: 0; font-size: 12px; padding: 2px 5px 3px; transform-origin: 0 50%; }
#graph .graph-label.hover { background: rgba(0, 0, 0, .55); }

#graph .graph-hint {
  position: absolute; bottom: 44px; left: 50%; transform: translateX(-50%); margin: 0; z-index: 2;
  max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #8a8a8a; font-size: 12px; pointer-events: none;
}
#graph .graph-empty { display: none; position: absolute; inset: 0; margin: 0; padding: 0 16px; align-items: center; justify-content: center; text-align: center; color: #8a8a8a; font-size: 14px; }
#graph.graph-is-empty .graph-empty { display: flex; }
#graph.graph-is-empty .graph-canvas, #graph.graph-is-empty .graph-labels { display: none; }

#graph .graph-panel {
  position: absolute; left: 16px; top: 52px; bottom: 52px; width: min(300px, calc(100vw - 32px)); z-index: 3;
  display: none; overflow: auto; box-sizing: border-box; padding: 14px;
  background: rgba(16, 16, 16, .94); border: 1px solid #2a2a2a; font-size: 13px;
}
#graph .graph-panel.show { display: block; }
/* 좁은 화면에서는 패널이 위쪽 가운데 토글과 겹치지 않게 토글 아래에서 시작한다 */
@media (max-width: 700px) { #graph .graph-panel { top: 84px; } }
#graph .graph-panel h2 { margin: 0 0 2px; font-size: 18px; font-weight: 400; }
#graph .graph-panel .sub { margin: 0 0 12px; color: #8a8a8a; font-size: 12px; }
#graph .graph-panel h3 { margin: 16px 0 8px; font-size: 12px; font-weight: 600; color: #b0b0b0; }
#graph .swatch { display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: 0; }
#graph .graph-covers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#graph .graph-cover { display: block; padding: 0; border: 0; background: none; color: #9a9a9a; text-align: left; cursor: pointer; font: inherit; }
#graph .graph-cover img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: #222; outline: 0 solid #fff; }
#graph .graph-cover:hover img, #graph .graph-cover:focus-visible img { outline-width: 3px; }
#graph .graph-cover span { display: block; margin-top: 3px; font-size: 10px; line-height: 1.3; word-break: keep-all; }
#graph .graph-near { display: flex; flex-wrap: wrap; gap: 6px; }
#graph .graph-near button {
  font: inherit; font-size: 12px; color: #ffffff; background: transparent; cursor: pointer;
  border: 1px solid #333; padding: 3px 8px;
}
#graph .graph-near button:hover { border-color: #888; }
#graph .graph-cover-hero { display: block; width: 120px; aspect-ratio: 1; object-fit: cover; margin-bottom: 10px; background: #222; }
#graph .graph-back {
  display: block; margin-top: 18px; font: inherit; font-size: 12px; color: #ffffff; background: transparent;
  border: 1px solid #555; padding: 5px 10px; cursor: pointer;
}
#graph .graph-back:hover { border-color: #aaa; }
#graph .graph-near button i { font-style: normal; color: #8a8a8a; margin-left: 4px; }
