:root {
  color-scheme: light;
  --paper: #fffdf7;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #625f58;
  --line: #171717;
  --yellow: #ffd92f;
  --blue: #7da7ff;
  --coral: #ff765f;
  --mint: #66dda5;
  --lavender: #b9a8ff;
  --gray: #ece9df;
  --danger: #d8342a;
  --border: 3px solid var(--line);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-small: 3px 3px 0 var(--ink);
  --radius: 10px;
  --max-width: 1180px;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", Inter, system-ui, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: -100px;
  left: 10px;
  padding: 10px 14px;
  border: var(--border);
  background: var(--yellow);
  font-weight: 900;
  opacity: 0;
}

.skip-link:focus {
  top: 10px;
  opacity: 1;
}

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-content: center;
  text-align: center;
  font-weight: 800;
}

.boot-mark,
.brand-mark {
  display: inline-grid;
  place-items: center;
  border: var(--border);
  border-radius: 7px;
  background: var(--yellow);
  box-shadow: var(--shadow-small);
  font-family: Georgia, serif;
  font-weight: 900;
}

.boot-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  font-size: 42px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
}

.auth-hero {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 6vw, 88px);
  border-right: var(--border);
  background: var(--yellow);
}

.auth-brand,
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
  font-weight: 950;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.auth-brand .brand-mark,
.brand .brand-mark {
  width: 42px;
  height: 42px;
  background: var(--surface);
  font-size: 25px;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 0 0 18px;
  padding: 4px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.hero-copy h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(48px, 7.3vw, 112px);
  line-height: 0.93;
  letter-spacing: -0.075em;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 620px;
  margin: 28px 0 0;
  font-size: clamp(18px, 2vw, 27px);
  font-weight: 750;
  line-height: 1.45;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}

.hero-pills li {
  padding: 8px 12px;
  border: 2px solid var(--ink);
  background: var(--surface);
  font-weight: 850;
  box-shadow: 2px 2px 0 var(--ink);
}

.auth-footnote {
  margin-top: 48px;
  font-size: 13px;
  font-weight: 750;
}

.auth-panel-wrap {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(24px, 5vw, 72px);
  background: var(--paper);
}

.auth-panel {
  width: min(100%, 460px);
  padding: clamp(24px, 4vw, 42px);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel h2,
.page-title,
.section-title {
  margin: 0;
  font-weight: 950;
  letter-spacing: -0.045em;
}

.auth-panel h2 {
  font-size: 34px;
}

.panel-intro {
  margin: 10px 0 26px;
  color: var(--muted);
  line-height: 1.55;
}

.segmented button {
  min-height: 45px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--gray);
  font-weight: 900;
}

.segmented button[aria-pressed="true"] {
  background: var(--blue);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.field-label {
  font-size: 14px;
  font-weight: 900;
}

.field input,
.answer-input,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 11px 14px;
  border: var(--border);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--gray);
  font-size: 16px;
}

.field input:focus,
.answer-input:focus,
.field select:focus {
  box-shadow: 3px 3px 0 var(--blue);
}

.form-help {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.kakao-signup-panel {
  width: min(100%, 540px);
}

.signup-profile-field {
  min-width: 0;
  margin: 0;
  padding: 18px;
  border: var(--border);
  border-radius: 9px;
  background: var(--mint);
  box-shadow: 4px 4px 0 var(--ink);
}

.signup-profile-field legend {
  padding: 0 7px;
  font-size: 14px;
  font-weight: 950;
}

.signup-profile-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.signup-profile-preview {
  display: grid;
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  overflow: hidden;
  place-items: center;
  border: var(--border);
  border-radius: 50%;
  background: var(--surface);
  font-size: 36px;
  font-weight: 950;
}

.signup-profile-preview img,
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.signup-profile-copy {
  min-width: 0;
}

.signup-profile-copy strong {
  display: block;
  font-size: 16px;
}

.signup-profile-copy p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.signup-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.signup-profile-actions .button {
  min-height: 42px;
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
}

.signup-profile-actions .button[aria-pressed="true"] {
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border: 2px solid var(--danger);
  border-radius: 6px;
  background: #fff0ed;
  color: #941c14;
  font-size: 14px;
  font-weight: 800;
}

.button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 18px;
  border: var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
  font-weight: 950;
  text-align: center;
  text-decoration: none;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--ink);
}

.button:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: none;
}

.button:disabled {
  background: var(--gray);
  box-shadow: none;
  color: #77736b;
}

.button-primary {
  background: var(--yellow);
}

.button-dark {
  background: var(--ink);
  color: var(--surface);
}

.button-blue {
  background: var(--blue);
}

.button-kakao {
  background: #fee500;
  color: #191919;
}

.kakao-auth-button {
  min-height: 56px;
  font-size: 16px;
}

.kakao-symbol {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 950;
}

.kakao-auth-help {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.button-coral {
  background: var(--coral);
}

.button-block {
  width: 100%;
}

.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px 8px;
  margin: 14px 0 0;
  color: var(--muted);
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 750;
}

.auth-switch-button {
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 950;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.demo-note {
  margin-top: 20px;
  padding: 12px 14px;
  border: 2px dashed var(--ink);
  border-radius: 7px;
  background: #fff9cb;
  font-size: 13px;
  line-height: 1.45;
}

.onboarding-shell {
  min-height: 100vh;
  padding: 28px 20px 70px;
}

.onboarding-top {
  display: flex;
  width: min(100%, 920px);
  align-items: center;
  justify-content: space-between;
  margin: 0 auto 42px;
}

.step-indicator {
  padding: 7px 11px;
  border: 2px solid var(--ink);
  background: var(--surface);
  font-size: 13px;
  font-weight: 900;
}

.onboarding-card {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 52px);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 7px 7px 0 var(--ink);
}

.onboarding-card h1 {
  margin: 0 0 12px;
  font-size: clamp(32px, 6vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.055em;
}

.onboarding-card > p {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.grade-groups {
  display: grid;
  gap: 22px;
}

.grade-group h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.grade-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
}

.grade-grid.grade-grid-single {
  grid-template-columns: minmax(120px, 180px);
}

.grade-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.grade-option {
  min-height: 56px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--gray);
  font-weight: 900;
}

.grade-option[aria-pressed="true"] {
  background: var(--yellow);
  box-shadow: var(--shadow-small);
  transform: translate(-2px, -2px);
}

.placement-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}

.progress-track {
  display: block;
  width: 100%;
  height: 16px;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--gray);
  appearance: none;
}

.progress-track::-webkit-progress-bar {
  background: var(--gray);
}

.progress-track::-webkit-progress-value {
  background: var(--mint);
  transition: width 180ms ease;
}

.progress-track::-moz-progress-bar {
  background: var(--mint);
}

.problem-card {
  display: grid;
  min-height: 240px;
  place-items: center;
  margin: 24px 0;
  padding: 28px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--blue);
  box-shadow: var(--shadow);
  text-align: center;
}

.problem-expression {
  margin: 0;
  font-size: clamp(42px, 9vw, 76px);
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: -0.045em;
  word-break: keep-all;
}

.answer-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.answer-input {
  min-width: 0;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 40px;
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: var(--border);
  background: rgba(255, 253, 247, 0.97);
}

.header-inner {
  display: flex;
  width: min(calc(100% - 40px), var(--max-width));
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  margin: 0 auto;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 7px 11px;
  border: 2px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  border-color: var(--ink);
  background: var(--yellow);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tier-icon {
  --tier-color: var(--gray);
  display: inline-grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--tier-color);
  box-shadow: 2px 2px 0 var(--ink);
}

.tier-icon svg {
  width: 78%;
  height: 78%;
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.tier-icon-large {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.tier-bronze { --tier-color: #d89a67; }
.tier-silver { --tier-color: #e4e7ed; }
.tier-gold { --tier-color: #ffd92f; }
.tier-platinum { --tier-color: #bdeee2; }
.tier-diamond { --tier-color: #9bb9ff; }
.tier-master { --tier-color: #c4b4ff; }

.user-copy {
  display: grid;
  line-height: 1.15;
}

.user-copy strong {
  font-size: 13px;
}

.user-copy span {
  color: var(--muted);
  font-size: 11px;
}

.main-content {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
  padding: 46px 0 80px;
}

.main-content:focus {
  outline: none;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 30px;
}

.page-title {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1;
}

.page-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.demo-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--lavender);
  font-size: 11px;
  font-weight: 950;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 22px;
}

.hero-game-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 24px;
  padding: clamp(24px, 5vw, 46px);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--yellow);
  box-shadow: 7px 7px 0 var(--ink);
}

.hero-game-card.practice {
  background: var(--blue);
}

.hero-game-card h2 {
  margin: 6px 0 12px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.hero-game-card p {
  max-width: 520px;
  margin: 0;
  font-weight: 700;
  line-height: 1.5;
}

.hero-game-card .button {
  margin-top: 22px;
}

.attempt-bubble {
  display: grid;
  width: 116px;
  height: 116px;
  place-content: center;
  border: var(--border);
  border-radius: 50%;
  background: var(--surface);
  text-align: center;
  box-shadow: var(--shadow-small);
}

.attempt-bubble strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.attempt-bubble.practice-limit strong {
  font-size: 24px;
}

.attempt-bubble span {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 900;
}

.tier-picker {
  margin-top: 22px;
  padding: 20px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.tier-picker-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.tier-picker-head h2,
.tier-picker-head p {
  margin: 3px 0 0;
}

.tier-picker-head p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tier-picker-options {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.tier-choice {
  display: grid;
  min-width: 0;
  min-height: 112px;
  place-items: center;
  gap: 5px;
  padding: 10px 5px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--gray);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.tier-choice:hover,
.tier-choice.selected {
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.tier-choice:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.tier-choice strong {
  overflow: hidden;
  max-width: 100%;
  font-size: 11px;
  text-overflow: ellipsis;
}

.tier-choice span:last-child {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.stat-card,
.content-card,
.rank-card,
.medal-card,
.profile-card {
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.stat-card {
  min-height: 136px;
  padding: 17px;
}

.stat-card:nth-child(2) {
  background: #eef3ff;
}

.stat-card:nth-child(3) {
  background: #edfff6;
}

.stat-card:nth-child(4) {
  background: #fff0ed;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stat-value {
  display: block;
  margin-top: 15px;
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: -0.045em;
}

.stat-note {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 18px;
}

.content-card {
  padding: 22px;
}

.content-card h2,
.content-card h3 {
  margin: 0 0 10px;
  letter-spacing: -0.03em;
}

.tier-card {
  background: var(--blue);
}

.challenge-promo-card {
  background: var(--mint);
}

.challenge-promo-card p {
  color: #29332e;
  font-weight: 700;
  line-height: 1.55;
}

.challenge-rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 30px;
}

.challenge-rules span {
  padding: 14px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  text-align: center;
  font-size: 13px;
  font-weight: 750;
}

.challenge-section + .challenge-section {
  margin-top: 38px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

.challenge-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-small);
  text-decoration: none;
}

.challenge-card:hover {
  background: #fffbe5;
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow);
}

.challenge-card-top,
.challenge-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.challenge-card-title {
  display: flex;
  align-items: center;
  gap: 13px;
}

.challenge-card-title div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.challenge-card-title strong {
  overflow: hidden;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.challenge-card-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.challenge-scoreboard {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
  margin-bottom: 24px;
  padding: 22px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--yellow);
  box-shadow: var(--shadow);
}

.challenge-score-summary {
  display: grid;
  align-content: center;
  gap: 5px;
}

.challenge-score-summary strong {
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1;
  letter-spacing: -0.06em;
}

.challenge-detail-actions {
  display: flex;
  align-content: center;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.challenge-rank-card {
  overflow: hidden;
}

.challenge-rank-card .section-heading {
  margin: 0;
  padding: 18px 20px;
  border-bottom: 2px solid var(--ink);
}

.public-share-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--yellow);
}

.public-shell {
  width: min(100%, 620px);
  padding: clamp(24px, 5vw, 46px);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 9px 9px 0 var(--ink);
}

.public-shell-wide {
  width: min(100%, 1040px);
}

.challenge-invite-card,
.score-share-card {
  text-align: center;
}

.challenge-invite-card .brand,
.score-share-card .brand {
  margin-bottom: 44px;
}

.invite-mark {
  display: grid;
  width: 96px;
  height: 96px;
  place-items: center;
  margin: 0 auto 24px;
  border: var(--border);
  border-radius: 50%;
  background: var(--coral);
  box-shadow: var(--shadow);
  font-size: 35px;
  font-weight: 950;
  transform: rotate(-6deg);
}

.challenge-invite-card h1,
.score-share-card h1,
.guest-result-panel h1 {
  margin: 4px 0 16px;
  font-size: clamp(38px, 7vw, 62px);
  line-height: 1.02;
  letter-spacing: -0.065em;
}

.challenge-invite-card > p:not(.eyebrow, .form-help),
.guest-result-panel > p:not(.eyebrow) {
  color: var(--muted);
  font-weight: 750;
  line-height: 1.6;
}

.invite-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 25px 0;
}

.invite-meta span {
  padding: 10px 6px;
  border: 2px solid var(--ink);
  background: var(--surface);
  font-size: 12px;
  font-weight: 850;
}

.guest-handle-form {
  display: grid;
  gap: 12px;
  margin-top: 24px;
  text-align: left;
}

.guest-handle-form .button {
  margin-top: 2px;
}

.guest-challenge-room > .brand {
  margin-bottom: 36px;
}

.guest-room-title span {
  overflow-wrap: anywhere;
}

.guest-account-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 24px;
  padding: 20px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--gray);
}

.guest-account-option h2,
.guest-account-option p {
  margin: 4px 0 0;
}

.guest-account-option p,
.guest-limit-note {
  color: var(--muted);
  font-weight: 750;
}

.guest-account-option .button {
  flex: 0 0 auto;
}

.shared-score {
  display: block;
  margin: 20px 0 6px;
  font-size: clamp(80px, 18vw, 140px);
  line-height: 0.85;
  letter-spacing: -0.08em;
}

.score-share-card .result-grid {
  grid-template-columns: repeat(2, 1fr);
}

.guest-claim-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  text-align: left;
}

.guest-result-panel {
  padding: 26px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--blue);
}

.guest-result-panel .brand {
  margin-bottom: 60px;
}

.tier-name {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 12px 0;
  font-size: 32px;
  font-weight: 950;
}

.movement-pill {
  display: inline-flex;
  padding: 7px 10px;
  border: 2px solid var(--ink);
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
}

.recent-medal-card {
  background: var(--lavender);
}

.empty-inline {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.loading-card,
.error-state,
.empty-state {
  display: grid;
  min-height: 300px;
  place-content: center;
  gap: 16px;
  padding: 32px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-bars {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.loading-bars span {
  width: 13px;
  height: 36px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  animation: bars 700ms ease-in-out infinite alternate;
}

.loading-bars span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-bars span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes bars {
  to { transform: scaleY(0.45); }
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  width: min(100%, 360px);
}

.ranking-header-actions {
  display: grid;
  grid-template-columns: minmax(190px, 230px) minmax(220px, 300px);
  align-items: end;
  gap: 12px;
}

.ranking-tier-filter {
  display: grid;
  gap: 7px;
}

.ranking-tier-filter select {
  width: 100%;
  min-height: 45px;
  padding: 8px 38px 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--gray);
  font-size: 15px;
  font-weight: 900;
}

.ranking-tier-filter select:focus {
  box-shadow: 3px 3px 0 var(--blue);
}

.ranking-scope-note {
  margin: -14px 0 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ranking-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
}

.rank-card {
  overflow: hidden;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
}

.rank-table th,
.rank-table td {
  padding: 15px 17px;
  border-bottom: 2px solid var(--ink);
  text-align: left;
}

.rank-table th {
  background: var(--gray);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.03em;
}

.rank-table tr:last-child td {
  border-bottom: 0;
}

.rank-table tr.is-me td {
  background: #fff6a9;
  font-weight: 900;
}

.rank-number {
  width: 70px;
  font-size: 19px;
  font-weight: 950;
}

.rank-score {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.fixture-tag {
  margin-left: 6px;
  padding: 2px 5px;
  border: 1px solid var(--ink);
  background: var(--gray);
  font-size: 9px;
  font-weight: 900;
}

.guest-tag {
  display: inline-flex;
  margin-left: 6px;
  padding: 2px 5px;
  border: 1px solid var(--ink);
  background: var(--blue);
  font-size: 9px;
  font-weight: 900;
  vertical-align: middle;
}

.movement-card {
  position: sticky;
  top: 100px;
  align-self: start;
  padding: 24px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--mint);
  box-shadow: var(--shadow);
}

.movement-card h2 {
  margin: 0 0 14px;
}

.movement-card .rank-hero {
  margin: 16px 0 8px;
  font-size: 54px;
  font-weight: 950;
  line-height: 1;
}

.movement-card p {
  line-height: 1.5;
}

.viewing-tier-card {
  background: var(--blue);
}

.viewing-tier-name {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 10px;
  font-size: 28px;
}

.medal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.medal-card {
  position: relative;
  min-height: 250px;
  padding: 22px;
}

.medal-card.earned {
  background: var(--yellow);
}

.medal-card.locked {
  color: #69665f;
  box-shadow: none;
}

.medal-icon {
  display: inline-grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 18px 18px 24px 24px;
  background: var(--medal-color, var(--yellow));
  box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-3deg);
}

.medal-icon svg {
  width: 72%;
  height: 72%;
  fill: none;
  stroke: var(--ink);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.medal-icon text {
  fill: var(--ink);
  stroke: none;
  text-anchor: middle;
  font-family: ui-sans-serif, sans-serif;
  font-size: 9px;
  font-weight: 950;
}

.medal-card:nth-child(even) .medal-icon {
  border-radius: 50%;
  transform: rotate(3deg);
}

.medal-card.locked .medal-icon {
  filter: grayscale(1);
  opacity: 0.52;
  box-shadow: none;
}

.medal-theme-daily_king,
.medal-theme-reached_gold { --medal-color: #ffd92f; }
.medal-theme-speed_king,
.medal-theme-streak_champion { --medal-color: #ff9d87; }
.medal-theme-accuracy_king,
.medal-theme-reached_diamond { --medal-color: #91b5ff; }
.medal-theme-perfect,
.medal-theme-consistent { --medal-color: #9de8ce; }
.medal-theme-weekly_champion,
.medal-theme-reached_master { --medal-color: #c0adff; }
.medal-theme-cumulative_champion,
.medal-theme-participation_100 { --medal-color: #ffb7d3; }
.medal-theme-growth,
.medal-theme-participation_30 { --medal-color: #bce783; }
.medal-theme-participation_365,
.medal-theme-reached_platinum { --medal-color: #8fe3e7; }

.medal-card h2 {
  margin: 22px 0 9px;
  font-size: 23px;
}

.medal-card p {
  margin: 0;
  line-height: 1.5;
}

.medal-status {
  position: absolute;
  right: 15px;
  top: 15px;
  padding: 4px 7px;
  border: 2px solid var(--ink);
  background: var(--surface);
  font-size: 10px;
  font-weight: 950;
}

.profile-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 20px;
}

.profile-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-card {
  padding: 26px;
}

.profile-identity {
  background: var(--blue);
}

.profile-danger-zone {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-color: var(--danger);
  background: #fff0ed;
}

.profile-danger-zone h2 {
  margin: 4px 0 6px;
  font-size: 24px;
}

.profile-danger-zone p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.button-danger {
  background: var(--danger);
  color: #fff;
}

.delete-account-dialog {
  width: min(calc(100% - 32px), 560px);
}

.delete-account-copy {
  margin: 22px 0;
  padding: 14px;
  border: 2px solid var(--danger);
  border-radius: 8px;
  background: #fff0ed;
  font-weight: 750;
  line-height: 1.55;
}

.delete-account-actions {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 10px;
}

.profile-avatar {
  display: grid;
  width: 88px;
  height: 88px;
  place-content: center;
  border: var(--border);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-small);
  font-size: 34px;
  font-weight: 950;
  overflow: hidden;
}

.profile-card h2 {
  margin: 22px 0 4px;
  font-size: 30px;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 24px;
}

.profile-stat {
  padding: 12px;
  border: 2px solid var(--ink);
  background: var(--surface);
}

.profile-stat strong,
.profile-stat span {
  display: block;
}

.profile-stat strong {
  font-size: 22px;
}

.profile-stat span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.title-list {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.title-option {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border: 2px solid var(--ink);
  background: var(--surface);
  text-align: left;
  font-weight: 850;
}

.title-option[aria-pressed="true"] {
  background: var(--yellow);
  box-shadow: var(--shadow-small);
}

.game-page {
  min-height: 100vh;
  padding: 18px;
  background: var(--yellow);
}

.game-frame {
  display: grid;
  width: min(100%, 920px);
  min-height: calc(100vh - 36px);
  margin: 0 auto;
  grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 4vw, 40px);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 8px 8px 0 var(--ink);
}

.game-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.game-timer {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 8px 13px;
  border: var(--border);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  box-shadow: var(--shadow-small);
}

.game-timer strong {
  font-size: 26px;
}

.game-timer.danger {
  background: var(--coral);
}

.game-content {
  display: grid;
  place-content: center;
  padding: 30px 0;
}

.game-problem {
  margin: 0 0 38px;
  font-size: clamp(48px, 10vw, 88px);
  font-weight: 950;
  line-height: 1.1;
  letter-spacing: -0.055em;
  text-align: center;
}

.game-answer-form {
  display: grid;
  width: min(100%, 540px);
  grid-template-columns: 1fr 120px;
  gap: 12px;
  margin: 0 auto;
}

.game-progress-copy {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.result-wrap {
  width: min(100%, 880px);
  margin: 0 auto;
}

.result-hero {
  position: relative;
  padding: clamp(28px, 6vw, 60px);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--yellow);
  box-shadow: 8px 8px 0 var(--ink);
  text-align: center;
}

.result-score-help,
.score-guide-close {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  padding: 0;
  border: var(--border);
  background: var(--surface);
  color: var(--ink);
  font-weight: 950;
  line-height: 1;
  box-shadow: var(--shadow-small);
}

.result-score-help {
  position: absolute;
  top: 18px;
  right: 18px;
  border-radius: 50%;
  font-size: 24px;
}

.result-score-help:hover,
.score-guide-close:hover {
  background: var(--blue);
  transform: translate(-1px, -1px);
}

.score-guide-dialog {
  width: min(calc(100% - 32px), 620px);
  max-height: min(calc(100vh - 32px), 760px);
  padding: 0;
  overflow: auto;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 8px 8px 0 var(--ink);
}

.score-guide-dialog::backdrop {
  background: rgba(23, 23, 23, 0.58);
}

.score-guide-panel {
  padding: 28px;
}

.score-guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.score-guide-head .eyebrow {
  margin-bottom: 10px;
}

.score-guide-head h2 {
  margin: 0;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 1.08;
  word-break: keep-all;
}

.score-guide-close {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 8px;
  font-size: 28px;
}

.score-guide-formula {
  display: grid;
  gap: 7px;
  margin: 24px 0 18px;
  padding: 16px;
  border: var(--border);
  border-radius: 8px;
  background: var(--yellow);
  text-align: left;
}

.score-guide-formula span {
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.05em;
}

.score-guide-formula strong {
  font-size: 17px;
  line-height: 1.45;
  word-break: keep-all;
}

.score-rule-list {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 2px solid var(--ink);
}

.score-rule-list > div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 13px 2px;
  border-bottom: 2px solid var(--ink);
}

.score-rule-list dt {
  font-weight: 950;
}

.score-rule-list dd {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.45;
}

.score-guide-note {
  margin: 18px 0 10px;
  padding: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--mint);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.5;
}

.score-guide-example {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-score {
  display: block;
  margin: 12px 0 6px;
  font-size: clamp(72px, 15vw, 132px);
  font-weight: 950;
  line-height: 0.9;
  letter-spacing: -0.075em;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 26px 0;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.league-track {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 24px;
}

.league-tier {
  display: grid;
  min-width: 0;
  min-height: 128px;
  place-items: center;
  gap: 5px;
  padding: 16px 8px;
  border: 2px solid var(--ink);
  background: var(--gray);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.league-tier span:last-child {
  color: var(--muted);
  font-size: 10px;
}

.league-tier:hover {
  background: var(--blue);
  box-shadow: var(--shadow-small);
  transform: translateY(-2px);
}

.league-tier.current {
  background: var(--yellow);
  box-shadow: var(--shadow-small);
  transform: translateY(-4px);
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 17px;
  border: var(--border);
  border-radius: 7px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: 5px 5px 0 var(--coral);
  font-weight: 800;
}

@media (max-width: 900px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: auto;
    padding: 36px 24px 42px;
    border-right: 0;
    border-bottom: var(--border);
  }

  .hero-copy {
    margin-top: 70px;
  }

  .auth-footnote {
    display: none;
  }

  .auth-panel-wrap {
    min-height: auto;
    padding: 36px 20px 70px;
  }

  .kakao-signup-page .auth-hero {
    padding-bottom: 32px;
  }

  .kakao-signup-page .hero-copy {
    margin-top: 42px;
  }

  .signup-profile-row {
    align-items: flex-start;
  }

  .signup-profile-preview {
    flex-basis: 84px;
    width: 84px;
    height: 84px;
  }

  .desktop-nav,
  .user-chip .user-copy {
    display: none;
  }

  .home-grid,
  .ranking-layout,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .movement-card {
    position: static;
  }

  .medal-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mobile-nav {
    position: fixed;
    z-index: 30;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    overflow: hidden;
    border: var(--border);
    border-radius: 9px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .mobile-nav .nav-link {
    min-height: 58px;
    justify-content: center;
    border: 0;
    border-right: 2px solid var(--ink);
    border-radius: 0;
    padding-inline: 5px;
    font-size: 11px;
  }

  .mobile-nav .nav-link:last-child {
    border-right: 0;
  }

  .app-shell {
    padding-bottom: 86px;
  }
}

@media (max-width: 620px) {
  .auth-brand {
    font-size: 18px;
  }

  .hero-copy h1 {
    font-size: 51px;
  }

  .hero-copy > p:not(.eyebrow) {
    font-size: 17px;
  }

  .onboarding-shell {
    padding: 18px 12px 48px;
  }

  .onboarding-top {
    margin-bottom: 24px;
  }

  .onboarding-card {
    padding: 22px 16px 28px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .grade-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .placement-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .problem-card {
    min-height: 190px;
    padding: 18px;
  }

  .answer-form,
  .game-answer-form {
    grid-template-columns: 1fr;
  }

  .header-inner,
  .main-content {
    width: min(calc(100% - 24px), var(--max-width));
  }

  .header-inner {
    min-height: 66px;
  }

  .brand {
    font-size: 18px;
  }

  .brand .brand-mark {
    width: 36px;
    height: 36px;
  }

  .main-content {
    padding: 30px 0 70px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 22px;
  }

  .ranking-header-actions {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .ranking-header-actions .segmented {
    width: 100%;
  }

  .ranking-scope-note {
    margin-top: -8px;
  }

  .profile-danger-zone {
    align-items: stretch;
    flex-direction: column;
  }

  .delete-account-actions {
    grid-template-columns: 1fr;
  }

  .hero-game-card {
    grid-template-columns: 1fr;
    padding: 24px 20px;
  }

  .attempt-bubble {
    width: auto;
    height: auto;
    grid-auto-flow: column;
    gap: 8px;
    justify-content: start;
    padding: 11px 14px;
    border-radius: 7px;
  }

  .attempt-bubble strong {
    font-size: 22px;
  }

  .tier-picker {
    padding: 16px 12px;
  }

  .tier-picker-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .tier-picker-options {
    grid-template-columns: repeat(3, 1fr);
  }

  .tier-choice {
    min-height: 102px;
  }

  .stat-grid,
  .result-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-card {
    min-height: 120px;
  }

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

  .medal-card {
    min-height: 210px;
  }

  .rank-table th,
  .rank-table td {
    padding: 13px 10px;
  }

  .rank-table .optional-column {
    display: none;
  }

  .profile-stats {
    grid-template-columns: 1fr;
  }

  .game-page {
    padding: 0;
  }

  .game-frame {
    min-height: 100vh;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .game-problem {
    font-size: clamp(45px, 13vw, 70px);
  }

  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .result-score-help {
    top: 12px;
    right: 12px;
  }

  .score-guide-panel {
    padding: 20px 16px;
  }

  .score-rule-list > div {
    grid-template-columns: 78px 1fr;
    gap: 8px;
    padding-block: 11px;
  }

  .score-guide-head {
    gap: 10px;
  }

  .score-guide-head h2 {
    font-size: 26px;
  }

  .score-guide-formula {
    margin: 18px 0 14px;
    padding: 14px;
  }

  .score-guide-formula strong {
    font-size: 15px;
  }

  .score-guide-note {
    margin-top: 14px;
    padding: 12px;
    font-size: 13px;
  }

  .score-guide-example {
    margin-bottom: 14px;
  }

  .challenge-rules,
  .challenge-list,
  .challenge-scoreboard,
  .guest-claim-layout {
    grid-template-columns: 1fr;
  }

  .guest-account-option {
    align-items: stretch;
    flex-direction: column;
  }

  .guest-account-option .button {
    width: 100%;
  }

  .challenge-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .public-share-page {
    align-items: start;
    padding: 12px;
  }

  .public-shell {
    padding: 24px 18px 30px;
    box-shadow: 5px 5px 0 var(--ink);
  }

  .challenge-invite-card h1,
  .score-share-card h1,
  .guest-result-panel h1 {
    font-size: 36px;
    line-height: 1.12;
    letter-spacing: -0.045em;
    overflow-wrap: anywhere;
  }

  .invite-meta {
    grid-template-columns: 1fr;
  }

  .league-track {
    grid-template-columns: repeat(3, 1fr);
  }

  .toast {
    right: 12px;
    bottom: 84px;
    left: 12px;
    max-width: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
