/* 모임판. 색은 변수로만 쓰고 강조색은 --accent 하나다.
   대비(WCAG): 글자 15~17:1, 흐린 글자 6.7~7.8:1, 강조색 글자·단추 글자 5.9~8.9:1, 테두리 3:1 이상 */
:root {
  --bg: #ffffff;
  --surface: #f4f4f5;
  --fg: #1c1c1e;
  --muted: #55555c;
  --line: #dcdce0;
  --border: #8a8a93;
  --accent: #1f56c7;
  --on-accent: #ffffff;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141417;
    --surface: #1f1f24;
    --fg: #ececf0;
    --muted: #a8a8b2;
    --line: #34343a;
    --border: #74747e;
    --accent: #8cb4ff;
    --on-accent: #101317;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* .btn 의 display 가 hidden 속성을 덮지 않게 */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
  overflow-wrap: anywhere;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.skip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
  padding: 10px 16px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* ── 머리·바닥 ── */
.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 16px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--fg);
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  column-gap: 4px;
  margin: 0 -10px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--fg);
  text-decoration: none;
}

.brand:hover,
.site-nav a:hover {
  text-decoration: underline;
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 12px 0 28px;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--fg);
}

/* ── 본문 ── */
main.wrap {
  padding-top: 28px;
  padding-bottom: 56px;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(1.625rem, 1.2rem + 1.8vw, 2.25rem);
  line-height: 1.3;
}

h2 {
  line-height: 1.4;
}

.intro p,
.prose p {
  margin: 0 0 12px;
}

.contact {
  margin: 20px 0 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 44px;
  padding: 0.45em 1.1em;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface);
}

.btn-primary,
.btn-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  text-decoration: underline;
}

/* 켜짐을 색으로만 가리지 않게 밑줄도 긋는다(고대비 모드에서도 남는다) */
.btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

/* ── 첫 화면 카드 ── */
.cards {
  display: grid;
  gap: 16px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.card h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin: 0 0 14px;
  font-size: 1.375rem;
}

.count {
  color: var(--muted);
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

/* ── 목록 쪽 ── */
.group {
  margin-top: 40px;
}

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: 16px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--fg);
}

.group-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.group-play {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

.items {
  margin: 0;
  padding: 0 0 0 2.4em;
}

.items > li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.items > li::marker {
  color: var(--muted);
  font-weight: 700;
}

.items .q {
  margin: 0;
  font-weight: 600;
}

.answer {
  margin: 4px 0 0;
  color: var(--accent);
  font-weight: 700;
}

.why {
  margin: 2px 0 0;
  color: var(--muted);
}

/* 높이 = 글줄 28px + 위아래 10px = 48px */
details.a > summary {
  width: fit-content;
  padding: 10px 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}

/* ── 띄우기 화면: 기본은 어두운 바탕(TV), theme-light 면 밝게 ── */
body.play {
  --bg: #141417;
  --surface: #1f1f24;
  --fg: #ececf0;
  --muted: #a8a8b2;
  --line: #34343a;
  --border: #74747e;
  --accent: #8cb4ff;
  --on-accent: #101317;
  color-scheme: dark;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  /* 휴대폰 17px · TV(1080) 약 23px */
  font-size: clamp(1.0625rem, 0.7rem + 1.1vmin, 1.75rem);
  line-height: 1.4;
}

body.play.theme-light {
  --bg: #ffffff;
  --surface: #f4f4f5;
  --fg: #1c1c1e;
  --muted: #55555c;
  --line: #dcdce0;
  --border: #8a8a93;
  --accent: #1f56c7;
  --on-accent: #ffffff;
  color-scheme: light;
}

.play-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--line);
}

.play-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

.play-name {
  margin: 0;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.3;
}

.play-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.play-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.play-main {
  display: flex;
  flex: 1;
  flex-direction: column;
}

/* 빈 곳을 누르면 앞으로 간다 */
.stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
}

.slide,
.done,
.error {
  width: 100%;
  max-width: 1600px;
}

.done,
.error {
  cursor: auto;
}

.label {
  margin: 0 0 0.5em;
  color: var(--muted);
  font-size: clamp(1rem, 0.6rem + 2vmin, 2.25rem);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.play-q,
.play-a {
  margin: 0;
  font-weight: 800;
  line-height: 1.3;
}

/* 글자 수로 고른 크기. 320×568 에서는 32·22·18px(s 는 10vmin 이 최소값보다 크다)이고 줄이 바뀐다 */
.play-q[data-size="s"] {
  font-size: clamp(1.75rem, 10vmin, 9.5rem);
}

.play-q[data-size="m"] {
  font-size: clamp(1.375rem, 6.5vmin, 6.5rem);
}

.play-q[data-size="l"] {
  font-size: clamp(1.125rem, 4.6vmin, 4.625rem);
}

.play-a {
  margin-top: 0.45em;
  color: var(--accent);
}

.play-a[data-size="s"] {
  font-size: clamp(1.625rem, 8.5vmin, 8.5rem);
}

.play-a[data-size="m"] {
  font-size: clamp(1.25rem, 6vmin, 6rem);
}

.play-a[data-size="l"] {
  font-size: clamp(1.125rem, 4.4vmin, 4.375rem);
}

.play-why {
  max-width: 40em;
  margin: 0.9em auto 0;
  color: var(--muted);
  font-size: clamp(1.0625rem, 3.2vmin, 3rem);
  line-height: 1.5;
}

.done-title,
.error-text {
  margin: 0 0 0.6em;
  font-weight: 800;
  line-height: 1.25;
}

.done-title {
  font-size: clamp(1.75rem, 8vmin, 7rem);
}

.error-text {
  font-size: clamp(1.25rem, 4vmin, 3rem);
}

.done-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 0;
}

.play-controls {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
}

.play-controls .btn {
  min-width: 6.5em;
  font-size: clamp(1.125rem, 0.6rem + 2vmin, 2.25rem);
}

.play-controls [data-next] {
  flex: 0 1 18em;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .skip,
  .site-header,
  .site-footer,
  .actions,
  .group-play,
  .btn,
  .play-bar,
  .play-controls {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  /* 띄우기 화면의 어두운 바탕용 색이 흰 종이에 연하게 찍히지 않게 */
  body.play {
    --fg: #000;
    --muted: #333;
    --accent: #000;
    --line: #999;
  }
}
