/* O'CLOCK — 전체화면 LED 시계. 의도적인 단일 다크 테마(LED 시계는 검은 바탕이
   정체성이라 라이트 변형을 두지 않는다). 숫자는 폰트가 아니라 oclock.js가 그리는
   세븐세그먼트 SVG라서 CSP(self)와 폰트 로딩 문제에서 자유롭다.
   v3: 샴페인 골드 기본 액센트 + 유리질 크롬 + 이중 글로우로 고급화. */
:root {
  --ground: #050507;
  --panel: #0e0f16;
  --line: #23242f;
  --hairline: color-mix(in srgb, #2c2e3a 70%, transparent);
  --muted: #8d8f9c;
  --text: #ecedf2;
  --acc: #e9c77b;
  --serif: "Didot", "Bodoni MT", "Playfair Display", Georgia, "Times New Roman", serif;
  --display: "Arial Black", "Pretendard Variable", Pretendard, sans-serif;
  --body: "Pretendard Variable", Pretendard, "Noto Sans KR", Arial, sans-serif;
}
:root[data-accent="lime"] { --acc: #baff29; }
:root[data-accent="cyan"] { --acc: #35e0ff; }
:root[data-accent="coral"] { --acc: #ff7048; }
:root[data-accent="amber"] { --acc: #ffd83d; }
:root[data-accent="white"] { --acc: #eef1f6; }

* { box-sizing: border-box; }
/* display:flex 지정이 UA의 [hidden]{display:none}보다 세서 명시적으로 눌러둔다 */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  /* 액센트가 은은하게 배어나는 비네트 — 순수 검정보다 깊이가 생긴다 */
  background:
    radial-gradient(120% 85% at 50% -10%, color-mix(in srgb, var(--acc) 7%, transparent) 0%, transparent 55%),
    radial-gradient(100% 70% at 50% 115%, #0a0b12 0%, transparent 60%),
    var(--ground);
  color: var(--text);
  font-family: var(--body);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ── 상단 크롬 ─────────────────────────────────────── */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 16px clamp(16px, 3vw, 32px);
  background: color-mix(in srgb, var(--ground) 55%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
  transition: opacity 0.45s ease;
}
.bar-left { display: flex; align-items: baseline; gap: 16px; }
.home-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.12em;
  padding: 6px 4px;
  transition: color 0.2s ease;
}
.home-link:hover, .home-link:focus-visible { color: var(--acc); }
.wordmark {
  margin: 0;
  font: 500 20px/1 var(--serif);
  letter-spacing: 0.24em;
  color: var(--text);
  display: inline-flex;
  align-items: center;
}
/* 로고 옆 다이아몬드 — 사각 점보다 격이 있다 */
.wordmark::after {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-left: 10px;
  background: var(--acc);
  transform: rotate(45deg);
  box-shadow: 0 0 10px color-mix(in srgb, var(--acc) 70%, transparent);
}

.tabs { display: flex; gap: 2px; overflow-x: auto; max-width: 100%; padding: 3px; border: 1px solid var(--hairline); border-radius: 999px; background: color-mix(in srgb, var(--panel) 60%, transparent); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  font: 600 13.5px/1 var(--body);
  padding: 10px 16px;
  cursor: pointer;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--ground);
  background: var(--acc);
  font-weight: 800;
  box-shadow: 0 0 16px color-mix(in srgb, var(--acc) 35%, transparent);
}
.tab:focus-visible, .pill:focus-visible, .solid-btn:focus-visible, .ghost-btn:focus-visible, .swatch:focus-visible, .capture-close:focus-visible, .capture-shutter:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}

.bar-right { display: flex; align-items: center; gap: 18px; }
.swatches { display: flex; gap: 9px; }
.swatch {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--sw) 55%, #000);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--sw) 65%, #fff) 0%, var(--sw) 45%, color-mix(in srgb, var(--sw) 70%, #000) 100%);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.swatch:hover { transform: scale(1.15); }
.swatch.is-active {
  box-shadow: 0 0 0 2px var(--ground), 0 0 0 3.5px var(--sw), 0 0 12px color-mix(in srgb, var(--sw) 60%, transparent);
}
.ghost-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font: 600 13px/1 var(--body);
  letter-spacing: 0.05em;
  padding: 10px 16px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.ghost-btn:hover {
  border-color: color-mix(in srgb, var(--acc) 65%, transparent);
  color: var(--acc);
  box-shadow: 0 0 14px color-mix(in srgb, var(--acc) 18%, transparent);
}
.capture-launch { border-color: color-mix(in srgb, var(--acc) 55%, var(--line)); color: var(--acc); }
.capture-launch span { display: inline; }

/* ── 스테이지 ─────────────────────────────────────── */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vh, 30px);
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
  min-height: 0;
}

.date-line {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: clamp(14px, 2.2vmin, 22px);
  letter-spacing: 0.22em;
  cursor: pointer;
  transition: font-size 0.2s ease, color 0.2s ease;
}
/* 날짜 크기 4단계 — 클릭 또는 "날짜 크기" 알약으로 순환. 큰 단계에서는
   뮤트를 벗고 본문색/액센트로 올라와 방 건너편에서도 읽힌다. */
.date-line[data-size="md"] { font-size: clamp(18px, 3.4vmin, 36px); color: #b9bbc6; }
.date-line[data-size="lg"] { font-size: clamp(24px, 5vmin, 56px); color: var(--text); letter-spacing: 0.14em; }
.date-line[data-size="xl"] { font-size: clamp(30px, 7vmin, 80px); color: var(--acc); letter-spacing: 0.1em; font-weight: 650; }
/* 날짜 양옆의 가는 라인 — 명판 느낌 */
.date-line::before, .date-line::after {
  content: "";
  width: clamp(24px, 6vw, 72px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line));
}
.date-line::after { background: linear-gradient(90deg, var(--line), transparent); }

.display-wrap { position: relative; display: flex; align-items: flex-start; }
.meridiem {
  position: absolute;
  right: 100%;
  top: 4%;
  margin-right: clamp(8px, 1.5vw, 20px);
  color: var(--acc);
  font: 900 clamp(13px, 2.4vmin, 24px)/1 var(--display);
  letter-spacing: 0.1em;
  text-shadow: 0 0 12px color-mix(in srgb, var(--acc) 50%, transparent);
}

/* --units: oclock.js가 자릿수(콜론·점 포함 환산 폭)를 넣는다.
   숫자 높이 = 화면 폭/높이 중 먼저 닿는 쪽에 맞춘다. */
.led-row {
  --units: 4.8;
  --dh: min(44vh, calc(92vw / var(--units)));
  display: flex;
  align-items: flex-end;
  gap: calc(var(--dh) * 0.055);
  height: var(--dh);
  /* 이중 글로우: 좁고 진한 코어 + 넓고 옅은 할로 — 단일 그림자보다 네온이 깊다 */
  filter:
    drop-shadow(0 0 calc(var(--dh) * 0.035) color-mix(in srgb, var(--acc) 55%, transparent))
    drop-shadow(0 0 calc(var(--dh) * 0.18) color-mix(in srgb, var(--acc) 28%, transparent));
}
/* 세계시간 모드는 아래 도시 목록이 함께 보여야 하므로 숫자를 한 단계 줄인다 */
body[data-mode="world"] .led-row { --dh: min(26vh, calc(80vw / var(--units))); }
.led-row svg { height: 100%; width: auto; display: block; }
.led-row svg.small-unit { height: 64%; }
.led-row .seg { fill: var(--acc); opacity: 0.055; }
.led-row .seg.on { opacity: 1; }
.led-row .colon-dot { fill: var(--acc); opacity: 0.055; }
.led-row .colon-dot.on { opacity: 1; }
/* 콜론 깜빡임은 시계/세계시간/알람에서만 — 스톱워치의 소수점까지 깜빡이면 산만하다 */
body[data-mode="clock"] .led-row .colon-dot.on,
body[data-mode="world"] .led-row .colon-dot.on,
body[data-mode="alarm"] .led-row .colon-dot.on { animation: colon-blink 1s steps(1) infinite; }
@keyframes colon-blink { 50% { opacity: 0.15; } }

.context-line {
  margin: 0;
  min-height: 1.4em;
  color: var(--muted);
  font-size: clamp(13px, 2vmin, 18px);
  letter-spacing: 0.08em;
}
.context-line b { color: var(--acc); font-weight: 700; }

/* ── 컨트롤 ───────────────────────────────────────── */
.controls { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; transition: opacity 0.45s ease; }
.controls-stack { flex-direction: column; gap: 14px; }
.preset-row, .field-row { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }

.pill {
  appearance: none;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  border: 1px solid var(--line);
  color: var(--muted);
  font: 600 13px/1 var(--body);
  letter-spacing: 0.03em;
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.pill:hover { color: var(--text); border-color: var(--muted); }
.pill.is-on {
  color: var(--ground);
  background: var(--acc);
  border-color: var(--acc);
  font-weight: 700;
  box-shadow: 0 0 14px color-mix(in srgb, var(--acc) 30%, transparent);
}
.pill-admin { border-style: dashed; }

.solid-btn {
  appearance: none;
  border: 1px solid var(--acc);
  background: linear-gradient(180deg, color-mix(in srgb, var(--acc) 88%, #fff), var(--acc));
  border-radius: 999px;
  color: var(--ground);
  font: 800 14px/1 var(--body);
  letter-spacing: 0.03em;
  padding: 12px 24px;
  cursor: pointer;
  box-shadow: 0 0 18px color-mix(in srgb, var(--acc) 25%, transparent);
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}
.solid-btn:hover { filter: brightness(1.08); box-shadow: 0 0 26px color-mix(in srgb, var(--acc) 40%, transparent); }

.field { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; letter-spacing: 0.03em; }
.field input, .field select {
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: 700 16px/1.2 var(--body);
  padding: 10px 12px;
  width: 74px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.field input[type="time"], .field select { width: auto; }
.field select { font-size: 14px; text-align: left; cursor: pointer; }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--acc); outline-offset: 1px; border-color: var(--acc); }
/* 다크 바탕에서 네이티브 스피너/시계 아이콘이 안 보이는 브라우저 대비 */
.field input::-webkit-calendar-picker-indicator { filter: invert(0.8); }

/* ── 세계시간 목록 ─────────────────────────────────── */
.world-list {
  margin: 0;
  padding: 4px clamp(10px, 2vw, 22px);
  list-style: none;
  display: flex;
  flex-direction: column;
  width: min(560px, 92vw);
  max-height: 36vh;
  overflow-y: auto;
  border: 1px solid var(--hairline);
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.world-list::-webkit-scrollbar { width: 8px; }
.world-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.world-list::-webkit-scrollbar-track { background: transparent; }
.world-row {
  display: grid;
  grid-template-columns: 1fr 44px 76px 110px 24px;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--hairline);
}
.world-row:last-child { border-bottom: 0; }
.world-city {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 4px 2px;
  text-align: left;
  color: var(--text);
  font: 600 14.5px/1.2 var(--body);
  letter-spacing: 0.02em;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease;
}
.world-city:hover { color: var(--acc); }
.world-row.is-focus .world-city { color: var(--acc); font-weight: 800; }
.world-row.is-focus .world-city::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 8px;
  vertical-align: 2px;
  background: var(--acc);
  transform: rotate(45deg);
  box-shadow: 0 0 8px color-mix(in srgb, var(--acc) 70%, transparent);
}
.world-day { color: var(--muted); font-size: 12px; letter-spacing: 0.04em; text-align: center; }
.world-time { color: var(--text); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; letter-spacing: 0.04em; }
.world-row.is-focus .world-time { color: var(--acc); text-shadow: 0 0 10px color-mix(in srgb, var(--acc) 40%, transparent); }
.world-diff { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; text-align: right; letter-spacing: 0.02em; }
.world-remove {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--muted);
  font: 400 16px/1 var(--body);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.world-remove:hover { opacity: 1; color: #ff7048; }
.world-remove-spacer { cursor: default; }

.laps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 22vh;
  overflow-y: auto;
  min-width: min(320px, 80vw);
}
.laps li {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid var(--hairline);
  padding: 6px 4px;
}
.laps li b { color: var(--text); font-weight: 700; }
.laps li:first-child b { color: var(--acc); }

.hint { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; opacity: 0.6; transition: opacity 0.45s ease; }

/* ── 전체화면 · 대기 상태: 크롬을 걷어내고 숫자만 남긴다 ── */
body.is-idle .bar,
body.is-idle .controls,
body.is-idle .hint,
body.is-idle .context-line,
body.is-idle .itland-switcher { opacity: 0; pointer-events: none; }
body.is-idle { cursor: none; }
/* 스위처는 스타일 선택창(30)·알람 오버레이(40) 아래에 둔다.
   위젯이 나중에 주입하는 자체 스타일보다 세도록 선택자를 한 단계 높인다. */
body .itland-switcher { z-index: 25; }
body.is-fullscreen .led-row { --dh: min(58vh, calc(96vw / var(--units))); }

/* ── 시계 스타일(페이스) ─────────────────────────────
   각 페이스는 --fh(페이스 기준 높이)로 크기를 정한다. 메인·세계시간·전체화면·
   미리보기 카드가 각자 --fh만 바꾸면 같은 코드가 모든 크기에서 동작한다. */
.face-root {
  --fh: min(52vh, 88vw);
  display: flex;
  align-items: center;
  justify-content: center;
}
body[data-mode="world"] .face-root { --fh: min(26vh, 60vw); }
body.is-fullscreen .face-root { --fh: min(66vh, 92vw); }

/* 페이스 전환: 새 화면이 블러 속에서 확대되며 맺힌다 */
.display-wrap.face-enter { animation: face-enter 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes face-enter {
  from { opacity: 0; transform: scale(0.84); filter: blur(16px); }
}

/* 아날로그 */
.face-analog svg { width: var(--fh); height: var(--fh); display: block; }
.face-analog { filter: drop-shadow(0 0 calc(var(--fh) * 0.05) color-mix(in srgb, var(--acc) 22%, transparent)); }
.face-analog .dial-ring { stroke: var(--line); stroke-width: 1; }
.face-analog .tick { stroke: color-mix(in srgb, var(--text) 30%, transparent); stroke-width: 1; }
.face-analog .tick.major { stroke: color-mix(in srgb, var(--acc) 85%, transparent); stroke-width: 2; }
.face-analog .numeral { fill: var(--muted); font: 600 11px var(--body); }
.face-analog .hand-h rect { fill: var(--text); }
.face-analog .hand-m rect { fill: color-mix(in srgb, var(--text) 85%, var(--acc)); }
.face-analog .hand-s line { stroke: var(--acc); stroke-width: 1.6; stroke-linecap: round; }
.face-analog .cap { fill: var(--text); }
.face-analog .cap-dot { fill: var(--acc); }

/* 플립 */
.face-flip { --dsz: min(calc(var(--fh) * 0.62), 17vw); display: flex; align-items: center; gap: calc(var(--dsz) * 0.24); }
.flip-group { display: flex; gap: calc(var(--dsz) * 0.08); }
.flip-group.flip-sec { align-self: flex-end; }
.flip-group.flip-sec .flip-digit { --dsz2: calc(var(--dsz) * 0.52); }
.flip-digit {
  --dsz2: var(--dsz);
  position: relative;
  width: calc(var(--dsz2) * 0.74);
  height: var(--dsz2);
  perspective: calc(var(--dsz2) * 4);
  filter: drop-shadow(0 calc(var(--dsz2) * 0.06) calc(var(--dsz2) * 0.12) rgba(0, 0, 0, 0.55));
}
.flip-half, .flip-leaf { position: absolute; left: 0; width: 100%; height: 50%; overflow: hidden; }
.flip-top { top: 0; border-radius: calc(var(--dsz2) * 0.09) calc(var(--dsz2) * 0.09) 0 0; background: linear-gradient(#232532, #1a1c26); }
.flip-bottom { bottom: 0; border-radius: 0 0 calc(var(--dsz2) * 0.09) calc(var(--dsz2) * 0.09); background: linear-gradient(#171922, #121319); }
.flip-digit span {
  position: absolute; left: 0; width: 100%;
  height: var(--dsz2); line-height: var(--dsz2);
  text-align: center;
  font: 800 calc(var(--dsz2) * 0.72)/var(--dsz2) var(--display);
  color: color-mix(in srgb, var(--acc) 30%, var(--text));
  font-variant-numeric: tabular-nums;
}
.flip-top span, .flip-leaf-front span { top: 0; }
.flip-bottom span, .flip-leaf-back span { top: calc(var(--dsz2) * -0.5); }
/* 판 사이 접힘선 */
.flip-digit::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px;
  background: rgba(0, 0, 0, 0.55);
  z-index: 3;
}
.flip-leaf { top: 0; transform-origin: center bottom; transform-style: preserve-3d; z-index: 2; }
.flip-leaf.is-flipping { animation: leaf-flip 0.45s cubic-bezier(0.36, 0, 0.66, 1) forwards; }
@keyframes leaf-flip { from { transform: rotateX(0); } to { transform: rotateX(-180deg); } }
.flip-leaf-front, .flip-leaf-back {
  position: absolute; inset: 0; overflow: hidden;
  backface-visibility: hidden;
  border-radius: calc(var(--dsz2) * 0.09) calc(var(--dsz2) * 0.09) 0 0;
}
.flip-leaf-front { background: linear-gradient(#232532, #1a1c26); }
.flip-leaf-back { background: linear-gradient(#121319, #171922); transform: rotateX(180deg); border-radius: 0 0 calc(var(--dsz2) * 0.09) calc(var(--dsz2) * 0.09); }

/* 타이포 */
.face-typo {
  display: flex;
  align-items: baseline;
  gap: 0.05em;
  font: 200 min(calc(var(--fh) * 0.44), 14vw)/1 "Segoe UI Light", "Segoe UI", "Helvetica Neue", var(--body);
  letter-spacing: 0.01em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 clamp(8px, 3vmin, 40px) color-mix(in srgb, var(--acc) 18%, transparent);
}
.typo-colon { color: var(--acc); font-weight: 100; transform: translateY(-0.05em); animation: typo-pulse 1s ease-in-out infinite; }
.typo-sec { font-size: 0.36em; font-weight: 300; color: var(--acc); margin-left: 0.25em; }
.typo-mer { font-size: 0.2em; font-weight: 600; color: var(--muted); letter-spacing: 0.12em; margin-right: 0.4em; }
.typo-mer:empty, .typo-sec:empty { display: none; }
@keyframes typo-pulse { 50% { opacity: 0.25; } }

/* 오빗(링) */
.face-rings svg { width: var(--fh); height: var(--fh); display: block; }
.face-rings { filter: drop-shadow(0 0 calc(var(--fh) * 0.05) color-mix(in srgb, var(--acc) 25%, transparent)); }
.face-rings circle { fill: none; stroke-width: 7; }
.face-rings .ring-track { stroke: color-mix(in srgb, var(--acc) 10%, transparent); }
.face-rings .ring-s { stroke: var(--acc); stroke-linecap: round; }
.face-rings .ring-m { stroke: color-mix(in srgb, var(--acc) 65%, var(--text)); stroke-linecap: round; }
.face-rings .ring-h { stroke: color-mix(in srgb, var(--acc) 35%, var(--muted)); stroke-linecap: round; }
.face-rings .rings-time { fill: var(--text); font: 800 30px var(--body); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.face-rings .rings-sub { fill: var(--acc); font: 600 13px var(--body); letter-spacing: 0.14em; }

/* ── 스타일 선택창 ───────────────────────────────────── */
.face-picker {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  background: color-mix(in srgb, var(--ground) 76%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: picker-in 0.3s ease;
  overflow-y: auto;
}
@keyframes picker-in { from { opacity: 0; } }
/* 세로 여유가 있으면 가운데, 카드가 넘치면 위에서부터 자연 스크롤
   (justify-content:center + overflow는 위쪽이 잘려 스크롤로도 못 본다) */
.face-picker-title {
  margin: auto 0 0;
  font: 500 24px/1.2 var(--serif);
  letter-spacing: 0.2em;
  color: var(--text);
}
.face-picker-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; }
.face-picker > .pill { margin-bottom: auto; flex: none; }
.face-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  max-width: min(1150px, 96vw);
  margin-bottom: 20px;
}
.face-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 13px;
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 18px;
  cursor: pointer;
  animation: card-rise 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i) * 70ms);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
@keyframes card-rise { from { opacity: 0; transform: translateY(28px) scale(0.92); } }
.face-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: color-mix(in srgb, var(--acc) 60%, transparent);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5), 0 0 26px color-mix(in srgb, var(--acc) 16%, transparent);
}
.face-card.is-current {
  border-color: var(--acc);
  box-shadow: 0 0 0 1px var(--acc), 0 0 22px color-mix(in srgb, var(--acc) 25%, transparent);
}
.face-card.is-chosen { animation: card-chosen 0.25s ease; }
@keyframes card-chosen { 50% { transform: scale(1.1); } }
.face-card-view {
  --fh: 76px;
  width: 196px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}
.face-card-name { font: 600 13px/1 var(--body); color: var(--muted); letter-spacing: 0.1em; }
.face-card.is-current .face-card-name { color: var(--acc); }
/* 미리보기 속 LED는 화면 크기 공식 대신 고정 소형 크기를 쓴다 */
.face-picker .face-card-view .led-row {
  --dh: 22px;
  height: 22px;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--acc) 45%, transparent));
}
.face-picker .face-card-view .face-typo { font-size: 30px; text-shadow: 0 0 10px color-mix(in srgb, var(--acc) 20%, transparent); }
.face-picker .face-card-view .face-flip { --dsz: 38px; }

/* ── 시간 인증샷 ───────────────────────────────────── */
.capture-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(5 5 7 / .86);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.capture-shell {
  display: grid;
  gap: 14px;
  width: min(560px, 100%);
  max-height: calc(100dvh - 40px);
  padding: 18px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgb(0 0 0 / .58);
}
.capture-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.capture-head span { display: block; margin-bottom: 4px; color: var(--acc); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.capture-head h2 { margin: 0; font: 500 23px/1.2 var(--serif); letter-spacing: 0; }
.capture-close {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font: 300 26px/1 var(--body);
}
.capture-close:hover { border-color: var(--acc); color: var(--acc); }
.camera-frame {
  position: relative;
  justify-self: center;
  width: min(420px, calc(100vw - 76px), calc((100dvh - 250px) * .8));
  min-width: 240px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--acc) 35%, var(--line));
  border-radius: 6px;
  background: #08090d;
}
.camera-frame video, .camera-frame > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.camera-frame[data-facing="user"] video { transform: scaleX(-1); }
.camera-frame.is-captured .camera-stamp { display: none; }
.camera-stamp {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  gap: 3px;
  padding: 64px 20px 20px;
  background: linear-gradient(transparent, rgb(0 0 0 / .82));
  pointer-events: none;
}
.camera-stamp small { color: var(--acc); font-size: 10px; font-weight: 800; letter-spacing: 0; }
.camera-stamp strong { color: #fff; font: 900 clamp(32px, 8vw, 50px)/1 var(--display); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.camera-stamp span { color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 0; }
.camera-stamp i { color: rgb(255 255 255 / .62); font-size: 10px; font-style: normal; letter-spacing: 0; }
.camera-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 32px;
  color: var(--muted);
  background: #08090d;
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}
.capture-note { min-height: 1.5em; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.capture-actions { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 52px; }
.capture-shutter {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid var(--text);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.capture-shutter span { width: 42px; height: 42px; border-radius: 50%; background: var(--text); transition: transform .15s ease, background .15s ease; }
.capture-shutter:hover span { transform: scale(.92); background: var(--acc); }
.capture-shutter:disabled, .capture-actions button:disabled { cursor: wait; opacity: .38; }
.capture-actions .solid-btn, .capture-actions .pill { min-height: 42px; }

/* ── 알람/타이머 울림 오버레이 ───────────────────────── */
.ring-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: color-mix(in srgb, var(--ground) 82%, var(--acc));
  animation: ring-pulse 1s ease-in-out infinite;
}
.ring-overlay[hidden] { display: none; }
.ring-title { margin: 0; font: 900 clamp(34px, 8vmin, 80px)/1.1 var(--display); color: var(--text); letter-spacing: 0.04em; }
.ring-sub { margin: 0; color: var(--text); font-size: clamp(15px, 2.6vmin, 22px); opacity: 0.85; }
.ring-actions { display: flex; gap: 12px; margin-top: 10px; }
@keyframes ring-pulse { 50% { background: color-mix(in srgb, var(--ground) 62%, var(--acc)); } }

@media (prefers-reduced-motion: reduce) {
  .led-row .colon-dot.on { animation: none; }
  .ring-overlay { animation: none; }
  .display-wrap.face-enter, .face-card, .face-picker, .typo-colon, .flip-leaf.is-flipping { animation: none; }
}

@media (max-width: 640px) {
  .bar { padding: 10px 12px; }
  .wordmark { font-size: 15px; letter-spacing: 0.16em; }
  .bar-right { margin-left: auto; }
  .ghost-btn span { display: none; }
  .capture-launch { padding-inline: 12px; }
  .capture-launch span { display: inline; }
  .capture-overlay { place-items: stretch; padding: 0; background: var(--ground); }
  .capture-shell { width: 100%; max-height: 100dvh; min-height: 100dvh; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; box-shadow: none; }
  .camera-frame { width: min(100%, calc((100dvh - 230px) * .8)); min-width: 220px; }
  .capture-actions { flex-wrap: wrap; }
  .capture-actions .pill, .capture-actions .solid-btn { padding-inline: 16px; }
  .hint { display: none; }
  .world-row { grid-template-columns: 1fr 40px 64px 92px 22px; gap: 6px; }
  .world-time { font-size: 15px; }
  .world-diff { font-size: 11px; }
}
