/* "나의 분당 타수" 전용 스타일.
   게임 화면(style.css)의 어두운 좀비 톤과 달리, 측정 도구답게 밝고 정갈한 톤으로 간다.
   - 흰 카드 + 얇은 회색 선 + 파란 포인트 하나
   - 숫자는 tabular-nums로 고정폭이라 값이 바뀌어도 자리가 흔들리지 않는다 */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #e6e9ef;
  --line-soft: #f0f2f6;
  --text: #1b1f27;
  --muted: #737d8c;
  --accent: #3b6cf0;
  --accent-soft: #eef2fe;
  --ok: #1f9d63;
  --bad: #d64545;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR",
    "Malgun Gothic", sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 22px 20px 72px;
}

/* ---- 홈/기능 메뉴 (홈 화면 좌측 상단과 같은 구성) ---- */
.mini-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}
.mini-nav-item {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 4px 2px;
  transition: color 0.15s;
}
.mini-nav-item:hover { color: var(--accent); }
.mini-nav-item.current { color: var(--text); font-weight: 700; }
.mini-nav-sep { color: #c8cdd7; font-size: 0.9rem; }

/* ---- 머리말 ---- */
.page-head { margin-bottom: 24px; }
h1 {
  font-size: 1.72rem;
  letter-spacing: -0.4px;
  margin: 0 0 8px;
}
.lead {
  color: var(--muted);
  font-size: 0.94rem;
  margin: 0;
}

/* ---- 카드 공통 ---- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.panel h2 {
  font-size: 1.02rem;
  margin: 0 0 14px;
}
.hidden { display: none !important; }

/* ---- 설정 (언어 / 시간) ---- */
.setup { display: flex; flex-wrap: wrap; gap: 18px 34px; }
.setup-row { display: flex; align-items: center; gap: 12px; }
.setup-label {
  font-size: 0.86rem;
  color: var(--muted);
}
.seg {
  display: inline-flex;
  background: var(--line-soft);
  border-radius: 10px;
  padding: 3px;
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.selected {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(20, 26, 40, 0.1);
}

/* ---- 측정 카드 ---- */
.test { padding-bottom: 20px; }

.live-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  text-align: center;
  margin-bottom: 16px;
}
.live { display: flex; flex-direction: column; gap: 2px; }
.live-label {
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.3px;
}
.live-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}
.live-value b { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.live-value i {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
}
.live-main .live-value b { font-size: 2.1rem; color: var(--accent); }

.progress {
  height: 4px;
  background: var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 24px;
}
.progress-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.12s linear;
}

/* 문장 표시 — 글자마다 상태 색이 붙는다 */
/* 지금 칠 문장(1행)과 다음 문장(2행)을 같은 크기로 항상 2행에 나눠 보여준다.
   문장이 끝나면 2행에 있던 다음 문장이 그대로 1행으로 올라오며 이어지고,
   각 줄은 한 줄로 고정해(줄바꿈 없이) 문장이 바뀌어도 화면이 튀지 않는다. */
.sentence-flow {
  font-size: 1.7rem;
  line-height: 1.7;
  letter-spacing: 0.2px;
  margin: 0 0 18px;
}
.sentence,
.sentence-next {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sentence .ch { transition: color 0.08s; }
.sentence .ch.pending { color: #b9c0cc; }
.sentence .ch.ok { color: var(--ok); }
.sentence .ch.bad {
  color: var(--bad);
  text-decoration: underline;
  text-decoration-color: rgba(214, 69, 69, 0.45);
  text-underline-offset: 4px;
}
.sentence .ch.current {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
}
/* 공백은 색이 안 보이므로 현재 위치일 때만 옅은 밑줄로 표시한다 */
.sentence .ch.space.current { background: var(--accent-soft); }

.sentence-next {
  color: #b9c0cc;
}

.type-input {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  font-size: 1.05rem;
  color: var(--text);
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.type-input::placeholder { color: #b9c0cc; }
.type-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 108, 240, 0.12);
  background: var(--surface);
}
.type-input:disabled { background: var(--line-soft); color: var(--muted); }

.hint {
  margin: 10px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
  min-height: 1.5em;
}
.hint.warn { color: #b06a12; }

/* ---- 결과 ---- */
.result { text-align: center; }
.result-badge {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1f6f4a;
  background: #e7f6ee;
  border-radius: 99px;
}
.result-caption {
  margin: 0;
  font-size: 0.84rem;
  color: var(--muted);
}
.result-main {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 2px 0 20px;
  font-variant-numeric: tabular-nums;
}
.result-main b { font-size: 3.2rem; font-weight: 700; letter-spacing: -1px; }
.result-main i { font-style: normal; font-size: 0.95rem; color: var(--muted); }

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 0 0 22px;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.result-grid div { display: flex; flex-direction: column; gap: 2px; }
.result-grid dt { font-size: 0.78rem; color: var(--muted); }
.result-grid dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.result-actions { display: flex; justify-content: center; gap: 10px; }
.btn {
  display: inline-block;
  padding: 11px 22px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2f5ada; }
.btn-ghost {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted);
}
.btn-ghost:hover { border-color: #cfd5e0; color: var(--text); }

/* ---- 기록 ---- */
.records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.records-head h2 { margin: 0; }
.text-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  padding: 4px;
}
.text-btn:hover { color: var(--bad); }

/* ---- 로그인 / 계정 저장 ---- */
.account {
  padding: 14px 16px;
  margin-bottom: 18px;
  /* 회색(Neutral) 구글 버튼이 묻히지 않도록 이 줄만 흰 바탕으로 둔다 */
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.account-guest,
.account-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.account-msg {
  flex: 1;
  min-width: 200px;
  font-size: 0.85rem;
  color: var(--muted);
}
/* 구글 브랜딩 가이드라인의 Neutral 테마 그대로:
   배경 #F2F2F2, 글자 #1F1F1F, 테두리 없음, 높이 40px, 모서리 20px(알약형),
   Roboto Medium 14px, 4색 G 로고 18px. 색·비율을 임의로 바꾸지 않는다.
   (흰 배경 Light 테마는 #747775 테두리가 필수라, 테두리를 빼려면 이 테마를 써야 한다) */
.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 20px;
  border: 0;
  background: #f2f2f2;
  color: #1f1f1f;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Noto Sans KR", sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.25px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.google-btn:hover {
  background: #e8e8e8;
}
.google-logo {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.google-logo svg { width: 100%; height: 100%; display: block; }
.account-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line-soft);
}
.account-name { font-size: 0.9rem; font-weight: 600; }
.account-badge { flex: 1; font-size: 0.8rem; color: var(--ok); }
.account-error {
  margin: 10px 0 0;
  font-size: 0.82rem;
  color: var(--bad);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  background: #fafbfc;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.stat-label { font-size: 0.78rem; color: var(--muted); }
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-value b { font-size: 1.35rem; font-weight: 700; }
.stat-value i { font-style: normal; font-size: 0.78rem; color: var(--muted); }

/* 최근 기록 막대. 값이 클수록 높다 */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 92px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
}
.chart-bar {
  flex: 1;
  min-width: 8px;
  max-width: 44px; /* 기록이 한두 개일 때 막대가 지나치게 넓어지지 않도록 */
  background: #dbe3f8;
  border-radius: 4px 4px 0 0;
  transition: background 0.15s;
}
.chart-bar.best { background: var(--accent); }
.chart-caption {
  margin: 8px 0 20px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: right;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.record-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
}
.record-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-soft);
}
.record-table td:first-child { color: var(--muted); }
.record-table .speed-cell { font-weight: 600; }

.records-empty,
.records-note {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.records-empty { text-align: center; padding: 10px 0; }

/* ---- 안내 ---- */
.guide-list { margin: 0; padding-left: 20px; }
.guide-list li { margin-bottom: 8px; font-size: 0.92rem; color: #4b5462; }
.guide-list strong { color: var(--text); }

/* ---- 하단 ---- */
.site-footer {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
.site-footer a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 16px;
  line-height: 2.2;
}
.site-footer a:hover { color: var(--accent); }
.site-footer .copyright { margin-top: 10px; color: #98a0ae; }

@media (max-width: 560px) {
  .wrap { padding: 18px 16px 56px; }
  .panel { padding: 18px 16px; }
  h1 { font-size: 1.45rem; }
  .sentence-flow { font-size: 1.32rem; }
  .live-main .live-value b { font-size: 1.8rem; }
  .result-main b { font-size: 2.6rem; }
  .result-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .stat-row { grid-template-columns: 1fr; }
  .setup { gap: 14px 20px; }
}

.guide-more { margin: 14px 0 0; font-size: 0.88rem; }
.guide-more a { color: var(--accent); text-decoration: none; }
.guide-more a:hover { text-decoration: underline; }
