/* 투데이탭 공통 스타일. 밝은 화면이 기본, 기기 설정이 어두우면 어두운 색을 쓴다. */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --ink: #141824;
  --muted: #586174;
  --line: #e1e5ee;
  --brand: #3a57f5;
  --brand-ink: #ffffff;
  --brand-soft: #e8ecff;
  --wait: #d8404d;
  --go: #17a35c;
  --early: #d98300;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 24, 36, 0.05), 0 8px 24px rgba(20, 24, 36, 0.06);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo',
    'Malgun Gothic', 'Noto Sans KR', 'Segoe UI', sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1117;
    --surface: #171b25;
    --surface-2: #1f2430;
    --ink: #eef1f7;
    --muted: #9aa5b8;
    --line: #272d3b;
    --brand: #7c93ff;
    --brand-ink: #0e1117;
    --brand-soft: #1d2440;
    --wait: #e2525e;
    --go: #25b86c;
    --early: #e69a1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand);
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 0;
}

p {
  margin: 0 0 1em;
}

.wrap {
  width: min(100% - 32px, 760px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 10px;
}

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

/* 머리말 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 5px var(--brand-soft);
}
.nav {
  display: flex;
  gap: 4px;
}
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 10px;
}
.nav a:hover,
.nav a[aria-current='page'] {
  color: var(--ink);
  background: var(--surface-2);
}

/* 본문 공통 */
main {
  padding-bottom: 56px;
}
.hero {
  padding: 40px 0 8px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 6vw, 2.5rem);
  font-weight: 800;
}
.lead {
  color: var(--muted);
  max-width: 34em;
  margin: 12px auto 0;
}
.section {
  margin-top: 44px;
}
.section > h2 {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.prose h2 {
  font-size: 1.25rem;
  margin: 34px 0 10px;
}
.prose h2:first-child {
  margin-top: 0;
}
.prose ul,
.prose ol {
  padding-left: 1.25em;
  margin: 0 0 1em;
}
.prose li {
  margin-bottom: 6px;
}
.fine {
  color: var(--muted);
  font-size: 0.9rem;
}

/* 단추 */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--brand);
  color: var(--brand-ink);
  font: inherit;
  font-weight: 700;
  padding: 13px 20px;
  min-height: 48px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover {
  filter: brightness(1.06);
}
.btn:active {
  transform: scale(0.98);
}
.btn.ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

/* 홈: 테스트 카드 */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
a.tile:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}
.tile-emoji {
  font-size: 1.9rem;
  line-height: 1;
}
.tile h3 {
  font-size: 1.1rem;
}
.tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.55;
}
.tile.soon {
  box-shadow: none;
  background: transparent;
  border-style: dashed;
}
.badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}
.tile.soon .badge {
  background: var(--surface-2);
  color: var(--muted);
}

/* 반응속도 테스트 */
.rounds {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 22px 0 14px;
  flex-wrap: wrap;
}
.rounds-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  margin-right: 4px;
}
.chip {
  appearance: none;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 700;
  min-width: 56px;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.chip[aria-checked='true'] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.pad {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: clamp(260px, 48vh, 400px);
  border-radius: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  font: inherit;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow);
}
.pad[data-state='wait'] {
  background: var(--wait);
}
.pad[data-state='go'] {
  background: var(--go);
}
.pad[data-state='early'] {
  background: var(--early);
}
.pad[data-state='shown'] {
  background: var(--ink);
  color: var(--bg);
}
.pad-icon {
  font-size: 2.6rem;
  line-height: 1;
}
.pad-title {
  font-size: clamp(1.7rem, 7vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.pad-sub {
  font-size: 1rem;
  opacity: 0.92;
}
@media (prefers-color-scheme: dark) {
  .pad[data-state='idle'] {
    color: #0e1117;
  }
}

.dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
  min-height: 12px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}
.dot.done {
  background: var(--go);
}
.pad-help {
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  margin: 12px 0 0;
}

/* 결과 */
.result {
  margin-top: 26px;
  text-align: center;
}
.result-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
}
.result-ms {
  font-size: clamp(3.2rem, 15vw, 5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 6px;
}
.result-ms small {
  font-size: 0.32em;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--muted);
  margin-left: 4px;
}
.grade {
  display: inline-block;
  font-weight: 800;
  padding: 5px 16px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
}
.result-desc {
  color: var(--muted);
  margin: 12px auto 0;
  max-width: 28em;
}
.scale {
  position: relative;
  height: 12px;
  border-radius: 999px;
  margin: 34px 4px 8px;
  background: linear-gradient(90deg, var(--go) 0%, #9bc53d 35%, #f2b134 60%, var(--wait) 100%);
}
.scale-pin {
  position: absolute;
  top: -9px;
  width: 4px;
  height: 30px;
  border-radius: 2px;
  background: var(--ink);
  transform: translateX(-50%);
  transition: left 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.scale-ends {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 4px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.stats li {
  background: var(--surface-2);
  border-radius: 14px;
  padding: 12px 6px;
}
.stats b {
  display: block;
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
}
.stats span {
  color: var(--muted);
  font-size: 0.82rem;
}
.tries {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.tries li {
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.tries li.best {
  border-color: var(--go);
  color: var(--go);
  font-weight: 700;
}
.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
.toast {
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.9rem;
  margin: 10px 0 0;
}
.mine {
  margin-top: 16px;
  text-align: left;
}
.mine h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}
.mine-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.mine-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface-2);
}
.mine-list time {
  color: var(--muted);
}
.linkish {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 0 0;
}

/* 표 */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
th,
td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
tr:last-child td {
  border-bottom: 0;
}
td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 700;
}

/* 자주 묻는 질문 */
.faq details {
  border-bottom: 1px solid var(--line);
}
.faq details:last-child {
  border-bottom: 0;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px 28px 14px 0;
  list-style: none;
  position: relative;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  position: absolute;
  right: 4px;
  top: 12px;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--muted);
}
.faq details[open] summary::after {
  content: '−';
}
.faq details p {
  color: var(--muted);
  margin: 0 0 16px;
}

/* 꼬리말 */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.88rem;
}
.foot-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-bottom: 12px;
}
.foot-nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 0;
}
.foot-nav a:hover {
  text-decoration: underline;
}
.foot-note,
.foot-copy {
  margin: 0 0 4px;
}

[hidden] {
  display: none !important;
}

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