:root {
  --bg: #f2f4f6;
  --surface: #ffffff;
  --ink: #191f28;
  --ink-2: #4e5968;
  --weak: #8b95a1;
  --line: #e5e8eb;
  --accent: #3182f6;
  --accent-ink: #ffffff;
  --accent-soft: #e8f3ff;
  --new: #00a661;
  --new-soft: #e5f8ee;
  --cur-ink: #1b64da;
  --bar-h: 72px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --surface: #1b1e23;
    --ink: #f2f4f6;
    --ink-2: #c3cad3;
    --weak: #8b95a1;
    --line: #2c3036;
    --accent: #4593fc;
    --accent-soft: #16304f;
    --new: #3ccf8e;
    --new-soft: #103a28;
    --cur-ink: #90c2ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", system-ui, sans-serif;
  word-break: keep-all;
  padding-bottom: calc(var(--bar-h) + env(safe-area-inset-bottom) + 24px);
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.top { padding: 32px 0 8px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-weight: 700; font-size: 14px; }
h1 { margin: 0 0 10px; font-size: clamp(24px, 6vw, 34px); line-height: 1.25; letter-spacing: -0.02em; }
.lead { margin: 0 0 20px; color: var(--ink-2); max-width: 640px; }

.seg {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--line); border-radius: 14px; padding: 4px; max-width: 420px;
}
.seg button {
  border: 0; border-radius: 10px; padding: 10px 8px; font: inherit; font-weight: 700; font-size: 15px;
  background: transparent; color: var(--ink-2); cursor: pointer; min-height: 44px;
}
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.08); }
.cnt { display: inline-block; min-width: 22px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--accent-soft); color: var(--cur-ink); font-size: 12px; line-height: 20px; }

.tools { display: flex; align-items: center; gap: 14px; margin: 14px 0 0; min-height: 28px; }
.sort { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.sort input { width: 18px; height: 18px; accent-color: var(--accent); }
.summary { font-size: 14px; color: var(--weak); }

h2 { font-size: 18px; margin: 28px 0 12px; letter-spacing: -0.01em; }

.grid-bg { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid-snd { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
@media (max-width: 400px) { .grid-bg { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; } }

.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 8px; cursor: pointer; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
.card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.phone {
  position: relative; aspect-ratio: 9 / 19.5; border-radius: 13px; overflow: hidden;
  background: #1b1e23 center / cover no-repeat;
}
.phone .shade { position: absolute; inset: 0; background: linear-gradient(rgb(0 0 0 / .18), rgb(0 0 0 / 0) 45%, rgb(0 0 0 / .22)); }
.phone .clock { position: absolute; top: 14%; width: 100%; text-align: center; color: #fff; font-size: clamp(26px, 9vw, 40px); font-weight: 700; letter-spacing: -0.03em; }
.phone .pill { position: absolute; left: 12%; right: 12%; bottom: 7%; padding: 7px 0; border-radius: 999px; background: #fff; color: #191f28; text-align: center; font-size: 11px; font-weight: 700; }
.zoom {
  position: absolute; top: 14px; right: 14px; z-index: 2; border: 0; border-radius: 10px;
  background: rgb(0 0 0 / .5); color: #fff; font: inherit; font-size: 12px; font-weight: 700; padding: 6px 9px; cursor: pointer; min-height: 32px;
}
.check {
  position: absolute; top: 14px; left: 14px; z-index: 2; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid rgb(255 255 255 / .9); background: rgb(0 0 0 / .25); display: grid; place-items: center;
  color: transparent; font-weight: 800; font-size: 15px;
}
.card[aria-checked="true"] .check { background: var(--accent); border-color: var(--accent); color: #fff; }

.meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 8px 4px 2px; }
.meta b { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { flex: none; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 6px; }
.tag.cur { background: var(--accent-soft); color: var(--cur-ink); }
.tag.new { background: var(--new-soft); color: var(--new); }
.tag.old { background: var(--line); color: var(--ink-2); }

.votes { padding: 4px 4px 2px; }
.votes .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.votes .track { height: 6px; border-radius: 3px; background: var(--line); margin-top: 4px; overflow: hidden; }
.votes .fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* 알람음 카드 */
.snd { display: grid; grid-template-columns: 52px 1fr 28px; align-items: center; gap: 12px; padding: 12px; }
.play {
  width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent-soft); color: var(--cur-ink);
  display: grid; place-items: center; cursor: pointer;
}
.play svg { width: 22px; height: 22px; }
.play[aria-pressed="true"] { background: var(--accent); color: #fff; }
.snd .info { min-width: 0; }
.snd .info b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snd .sub { display: flex; gap: 6px; align-items: center; margin-top: 3px; font-size: 12px; color: var(--weak); }
.snd .progress { height: 3px; border-radius: 2px; background: var(--line); margin-top: 8px; overflow: hidden; }
.snd .progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.snd .check { position: static; border-color: var(--line); background: transparent; }
.snd .votes { grid-column: 1 / -1; padding: 0; }

.foot { margin: 40px 0 0; font-size: 13px; color: var(--weak); }

/* 하단 투표 바 — Safari 26 은 화면 아래 고정 요소의 배경색으로 주소창 영역을 칠한다. 불투명한 색을 준다. */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bar-in { max-width: 1120px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; min-height: var(--bar-h); }
.bar-text { flex: 1; font-size: 14px; color: var(--ink-2); line-height: 1.35; }
.primary {
  border: 0; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700;
  padding: 0 22px; min-height: 48px; cursor: pointer; white-space: nowrap;
}
.primary:disabled { opacity: .4; cursor: default; }

/* 크게 보기 */
dialog#viewer { padding: 0; border: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; }
dialog#viewer::backdrop { background: rgb(0 0 0 / .85); }
#viewer-img { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: min(92dvh, 900px); aspect-ratio: 9 / 19.5; max-width: 94vw; object-fit: cover; border-radius: 28px; }
.viewer-ui { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: min(92dvh, 900px); aspect-ratio: 9 / 19.5; max-width: 94vw; pointer-events: none; }
.viewer-clock { position: absolute; top: 13%; width: 100%; text-align: center; color: #fff; font-size: clamp(48px, 10dvh, 84px); font-weight: 700; letter-spacing: -0.03em; }
.viewer-pick, .viewer-close { pointer-events: auto; position: absolute; border: 0; font: inherit; font-weight: 700; cursor: pointer; min-height: 48px; border-radius: 999px; }
.viewer-pick { left: 10%; right: 10%; bottom: 7%; background: #fff; color: #191f28; }
.viewer-pick[aria-pressed="true"] { background: var(--accent); color: #fff; }
.viewer-close { top: 3%; right: 4%; padding: 0 16px; background: rgb(0 0 0 / .5); color: #fff; }

@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
