:root {
  --bg: #f4f6f1;
  --bg-soft: #eef2eb;
  --card: #ffffff;
  --card-soft: #f8faf7;
  --line: #d9e0d8;
  --line-strong: #c7d2c8;
  --text: #23313b;
  --muted: #677581;
  --muted-2: #7f8d98;
  --accent: #2b78e4;
  --accent-soft: #eaf2ff;
  --green: #1f9d69;
  --green-soft: #e8f7f0;
  --red: #de5a4b;
  --red-soft: #fff0ed;
  --amber: #d8901f;
  --amber-soft: #fff5e6;
  --teal: #20c3b0;
  --shadow: 0 14px 40px rgba(38, 55, 69, 0.08);
  --shadow-soft: 0 6px 18px rgba(38, 55, 69, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: auto;
  font-family: "SUIT Variable", "Pretendard Variable", "Pretendard", "Noto Sans KR",
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 12%, rgba(43, 120, 228, 0.06), transparent 26%),
    radial-gradient(circle at 84% 8%, rgba(31, 157, 105, 0.05), transparent 24%),
    linear-gradient(180deg, #fafcf9 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.page-shell {
  width: min(1100px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: 12px 12px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 8px 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

.brand-wrap,
.bar-left,
.bar-right,
.button-row,
.chip-row,
.inline-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #42c7ba, #5891ff);
  position: relative;
  box-shadow: 0 10px 24px rgba(88, 145, 255, 0.16);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 9px;
  border: 2px solid rgba(255, 255, 255, 0.94);
}

.brand-mark::before {
  inset: 10px;
}

.brand-mark::after {
  inset: 15px 11px;
  border-left: 0;
  border-right: 0;
}

.brand-name {
  font-size: 26px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: -0.06em;
}

.brand-copy,
.section-tabs,
.section-pill,
.bar-right,
.screen-copy,
.game-topbar .title-block p {
  display: none !important;
}

.back-link,
.mini-chip,
.stat-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-weight: 700;
}

.back-link {
  color: var(--text);
  font-weight: 800;
}

.stat-chip span {
  color: var(--muted-2);
}

.stat-chip strong {
  color: var(--text);
}

.app-main {
  flex: 1;
  min-height: 0;
}

.dashboard {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.search-panel,
.dashboard-card,
.game-screen,
.overlay-card,
.metric-card,
.notice {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow);
}

.search-panel {
  padding: 16px;
}

.search-panel h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.08;
  letter-spacing: -0.06em;
}

.search-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 15px;
}

.search-shell {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.search-input {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  font-size: 17px;
  outline: none;
}

.search-input:focus {
  border-color: #9db6df;
  box-shadow: 0 0 0 4px rgba(43, 120, 228, 0.08);
}

.search-meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.section-block {
  display: grid;
  gap: 8px;
}

.section-title {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-card {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.card-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dashboard-card h3 {
  margin: 6px 0 0;
  font-size: 26px;
  line-height: 1.08;
  letter-spacing: -0.05em;
}

.dashboard-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 15px;
}

.card-foot {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.score-mini {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.score-mini strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 22px;
  letter-spacing: -0.04em;
}

.empty-state {
  padding: 22px;
  border-radius: 18px;
  border: 1px dashed var(--line-strong);
  background: var(--card-soft);
  color: var(--muted);
  line-height: 1.6;
}

.button {
  appearance: none;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 16px;
  transition: transform 0.14s ease, opacity 0.14s ease;
  font-size: 17px;
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.button:hover:not(:disabled),
.button:focus-visible:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.button.primary {
  color: #fff;
  background: linear-gradient(135deg, #4187ef, #2b78e4);
  box-shadow: 0 10px 24px rgba(43, 120, 228, 0.18);
}

.button.secondary {
  color: #fff;
  background: linear-gradient(135deg, #29a971, #1f9d69);
  box-shadow: 0 10px 24px rgba(31, 157, 105, 0.16);
}

.button.ghost,
.button.option {
  color: var(--text);
  border-color: var(--line);
  background: #fff;
}

.button.option[data-selected="true"] {
  border-color: #9db6df;
  background: var(--accent-soft);
}

.button.compact {
  min-height: 58px;
  padding-inline: 22px;
  min-width: min(240px, 100%);
  font-size: 20px;
}

.game-layout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: calc(100dvh - 84px);
}

.game-topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 0;
}

.title-block h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 34px);
  line-height: 1.02;
  letter-spacing: -0.06em;
}

.game-topbar .title-block {
  display: none;
}

.game-topbar .chip-row {
  gap: 8px;
}

.game-topbar .chip-row .stat-chip:nth-child(1),
.game-topbar .chip-row .stat-chip:nth-child(2),
.game-topbar .chip-row .stat-chip:nth-child(4) {
  display: none !important;
}

.game-screen {
  flex: 1;
  min-height: 0;
  padding: 10px;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
}

.screen-head {
  display: none;
}

.play-area {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card-soft);
}

.control-panel {
  display: grid;
  gap: 6px;
}

.button-row {
  flex-wrap: wrap;
}

.prompt {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: center;
}

.help-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
  display: none;
}

.progress-shell {
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #eff3ee;
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #65a6ff, #2b78e4);
  transition: width 0.09s linear;
}

.choice-grid,
.metric-grid,
.touch-grid {
  display: grid;
  gap: 8px;
}

.choice-grid.two,
.touch-grid.two,
.metric-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid.four {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.overlay-panel {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(245, 248, 243, 0.7);
  backdrop-filter: blur(8px);
}

.overlay-card {
  width: min(430px, 100%);
  padding: 20px;
}

.overlay-card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.overlay-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 15px;
}

.result-flash {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.result-flash.show {
  opacity: 1;
}

.result-flash.good {
  background: linear-gradient(180deg, rgba(31, 157, 105, 0.12), transparent 46%);
}

.result-flash.bad {
  background: linear-gradient(180deg, rgba(222, 90, 75, 0.14), transparent 46%);
}

.result-mark {
  font-size: clamp(72px, 12vw, 130px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.result-flash.good .result-mark {
  color: var(--green);
}

.result-flash.bad .result-mark {
  color: var(--red);
}

.result-reason {
  max-width: min(90%, 520px);
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.metric-card,
.notice {
  padding: 12px 14px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  letter-spacing: -0.06em;
}

.notice {
  color: var(--muted);
  line-height: 1.55;
  display: none;
}

.lives {
  display: inline-flex;
  gap: 6px;
}

.life {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d8dfd8;
}

.life.on {
  background: #f2aa32;
  box-shadow: 0 0 0 4px rgba(242, 170, 50, 0.16);
}

.hidden {
  display: none !important;
}

.digit-slot,
.digit-button,
.answer-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}

.digit-button.used {
  opacity: 0.3;
}

body.game-page .bar-left {
  width: 100%;
  justify-content: space-between;
}

body.game-page .brand-wrap {
  margin-left: auto;
  justify-content: flex-end;
}

body.game-page .game-topbar .chip-row {
  width: 100%;
  justify-content: flex-end;
}

@media (max-width: 920px) {
  .page-shell {
    padding: 10px 10px 16px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .game-topbar {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 8px 8px 14px;
  }

  .brand-name {
    font-size: 24px;
  }

  .search-panel h1,
  .title-block h1 {
    font-size: 26px;
  }

  .dashboard-card h3 {
    font-size: 22px;
  }

  .game-layout {
    min-height: calc(100dvh - 78px);
  }

  .game-screen {
    padding: 8px;
  }

  .choice-grid.five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .button {
    min-height: 46px;
    font-size: 15px;
  }

  .button.compact {
    min-height: 56px;
    min-width: 100%;
    font-size: 18px;
  }

  .overlay-card {
    padding: 18px;
  }
}
