/* 타자 대탈출! 런앤타입 (Typing Escape) */
:root {
  --te-bg: #fff8eb;
  --te-surface: #ffffff;
  --te-ink: #1e293b;
  --te-muted: #526071;
  --te-border: #e5dfd3;
  --te-orange: #f97316;
  --te-orange-dark: #ea580c;
  --te-mint: #10b981;
  --te-sky: #0284c7;
  --te-coral: #ef4444;
  --te-gold: #eab308;
  --te-purple: #7c3aed;
  --te-radius: 20px;
  --te-shadow: 0 12px 32px rgba(30, 41, 59, 0.08);
}

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

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--te-bg);
  color: var(--te-ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.te-app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 16px 18px;
  gap: 12px;
}

/* Top Bar */
.te-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.te-topbar-left,
.te-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.te-prefs {
  display: flex;
  gap: 8px;
}

/* The help button and the shared play bar open the guide instead of its default entry. */
.te-guide .cg-guide-entry {
  display: none;
}

/* Shared play bar and result layout, in this game's own colours. */
#classroom-play-toolbar[data-game="typing_escape"] {
  background: var(--te-bg);
}

#classroom-play-toolbar[data-game="typing_escape"] h1 {
  color: var(--te-ink);
}

#classroom-play-toolbar[data-game="typing_escape"] :is(button, a) {
  border-color: #ead9bd;
  color: #9a3412;
}

#classroom-play-toolbar[data-game="typing_escape"] :is(button, a):hover {
  background: #ffedd5;
  color: #7c2d12;
}

.te-body #classroom-play-confirm [data-play-confirm] {
  background: #c2410c;
  border-color: #c2410c;
}

.te-body #classroom-play-confirm [data-play-cancel] {
  color: #9a3412;
}

.te-result-card[data-game-result-style] {
  border-color: #f0d9b5 !important;
  background: #fffdf8 !important;
}

.te-result-card[data-game-result-style] [data-result-part="title"] {
  color: var(--te-ink) !important;
}

.te-result-card[data-game-result-style] [data-result-part="primary"] {
  border-color: #c2410c !important;
  background: #c2410c !important;
}

.te-result-card[data-game-result-style] [data-result-part="secondary"] {
  border-color: #ead9bd !important;
  color: #9a3412 !important;
}

html[data-classroom-playing] .te-app {
  min-height: calc(100dvh - var(--classroom-play-height, 72px));
}

.te-brand-title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--te-ink);
}

.te-btn-ghost,
.te-btn-pill,
.te-btn-icon,
.te-btn-primary,
.te-btn-secondary,
.te-btn-submit {
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.te-btn-ghost {
  background: var(--te-surface);
  color: var(--te-ink);
  border: 1.5px solid var(--te-border);
  border-radius: 12px;
  padding: 8px 13px;
  font-size: 0.92rem;
  font-weight: 700;
}

.te-btn-ghost:hover {
  background: #fef3c7;
  border-color: #f59e0b;
}

.te-btn-pill {
  background: var(--te-surface);
  color: var(--te-ink);
  border: 1.5px solid var(--te-border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.88rem;
  font-weight: 700;
}

.te-btn-pill:hover,
.te-btn-pill.is-active {
  background: #ffedd5;
  border-color: var(--te-orange);
  color: #9a3412;
}

.te-btn-share {
  background: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

.te-btn-primary {
  background: linear-gradient(135deg, #fb923c, #ea580c);
  color: #ffffff;
  border-radius: 16px;
  padding: 14px 28px;
  font-size: 1.08rem;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.28);
}

.te-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(234, 88, 12, 0.36);
}

.te-btn-primary:active {
  transform: translateY(1px);
}

.te-btn-secondary {
  background: #f1f5f9;
  color: var(--te-ink);
  border: 1.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 700;
}

.te-btn-icon {
  background: var(--te-surface);
  border: 1.5px solid var(--te-border);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 1.05rem;
}

/* Lobby */
.te-lobby {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.te-lobby-card {
  width: 100%;
  background: var(--te-surface);
  border: 2px solid var(--te-border);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--te-shadow);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.te-hero {
  display: grid;
  grid-template-columns: minmax(260px, 1.05fr) 1fr;
  gap: 22px;
  align-items: center;
}

.te-hero-media {
  border-radius: 20px;
  overflow: hidden;
  background: #fef3c7;
  aspect-ratio: 16 / 9;
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.14);
}

.te-hero-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.te-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.te-world-tag {
  align-self: flex-start;
  background: #ffedd5;
  color: #c2410c;
  font-weight: 800;
  font-size: 0.875rem;
  padding: 5px 12px;
  border-radius: 999px;
}

.te-hero-heading {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.te-hero-desc {
  margin: 0;
  color: var(--te-muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

.te-action-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.te-chip {
  font-size: 0.875rem;
  font-weight: 800;
  padding: 6px 11px;
  border-radius: 10px;
}

.te-chip-jump { background: #e0f2fe; color: #0369a1; }
.te-chip-slide { background: #d1fae5; color: #047857; }
.te-chip-smash { background: #fee2e2; color: #b91c1c; }
.te-chip-bonus { background: #fef9c3; color: #a16207; }

.te-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.te-section-head h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
}

.te-practice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--te-muted);
  cursor: pointer;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  padding: 6px 12px;
  border-radius: 999px;
}

.te-practice-toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--te-orange);
}

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

.te-course-card {
  text-align: left;
  background: #fcfaf5;
  border: 2px solid var(--te-border);
  border-radius: 18px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.te-course-card:hover {
  border-color: #fdba74;
  transform: translateY(-2px);
}

.te-course-card.is-selected {
  background: #fff7ed;
  border-color: var(--te-orange);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.te-course-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.te-course-badge {
  font-size: 0.875rem;
  font-weight: 800;
  background: #ffedd5;
  color: #c2410c;
  padding: 3px 9px;
  border-radius: 999px;
}

.te-course-best {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--te-muted);
}

.te-course-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--te-ink);
}

.te-course-sub {
  margin: 0;
  font-size: 0.88rem;
  color: var(--te-muted);
  line-height: 1.4;
}

.te-course-dist {
  margin-top: 4px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #0369a1;
}

.te-lobby-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.te-btn-start {
  min-width: 240px;
  font-size: 1.2rem;
  padding: 16px 36px;
}

.te-lobby-tip {
  margin: 0;
  font-size: 0.875rem;
  color: var(--te-muted);
}

/* Play Screen */
.te-play {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.te-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--te-surface);
  border: 2px solid var(--te-border);
  border-radius: 18px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.te-hud-hearts {
  font-size: 1.25rem;
  letter-spacing: 2px;
  font-weight: 800;
  min-width: 84px;
}

.te-hud-progress {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.te-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--te-muted);
}

.te-progress-labels strong {
  color: var(--te-ink);
}

.te-progress-track {
  position: relative;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: visible;
}

.te-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #f97316);
  transition: width 0.12s linear;
}

.te-progress-runner {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -56%);
  font-size: 1.15rem;
  transition: left 0.12s linear;
  pointer-events: none;
}

.te-progress-flag {
  position: absolute;
  right: -4px;
  top: 50%;
  transform: translateY(-56%);
  font-size: 1rem;
}

.te-hud-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.te-stat-pill {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 5px 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 68px;
}

.te-stat-label {
  font-size: 0.875rem;
  white-space: nowrap;
  font-weight: 700;
  color: var(--te-muted);
}

.te-stat-pill strong {
  font-size: 1.02rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.te-stat-combo.is-fever {
  background: linear-gradient(135deg, #fef08a, #fbcfe8, #bae6fd);
  border-color: #f59e0b;
}

.te-fever-bar {
  width: 48px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 2px;
}

.te-fever-bar > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f97316, #ec4899, #8b5cf6);
  transition: width 0.15s ease;
}

.te-hud-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.te-hud-controls .te-prefs {
  gap: 6px;
}

.te-hud-controls .te-btn-pill {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  font-size: 1.05rem;
}

/* In play the two settings are icon buttons; their names stay for screen readers. */
.te-hud-controls .te-pref-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.te-hud-controls .te-btn-pill[aria-pressed="false"] {
  opacity: 1;
  background: #e2e8f0;
  border-style: dashed;
  border-color: #64748b;
}

/* Canvas Stage */
.te-stage-wrap {
  position: relative;
  width: 100%;
  height: clamp(270px, 43dvh, 420px);
  border-radius: 22px;
  overflow: hidden;
  border: 2px solid var(--te-border);
  box-shadow: var(--te-shadow);
  background: #7dd3fc;
}

.te-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.te-fever-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(90deg, #f97316, #ec4899, #8b5cf6, #06b6d4);
  color: #ffffff;
  font-weight: 900;
  font-size: 0.98rem;
  padding: 7px 18px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
  pointer-events: none;
  white-space: nowrap;
}

.te-pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.te-pause-card {
  background: var(--te-surface);
  border-radius: 22px;
  padding: 24px 28px;
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.te-pause-card h2 {
  margin: 0 0 6px;
}

.te-pause-card p {
  margin: 0 0 18px;
  color: var(--te-muted);
}

.te-pause-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Typing Dock */
.te-dock {
  background: var(--te-surface);
  border: 2px solid var(--te-border);
  border-radius: 22px;
  padding: 14px 18px;
  box-shadow: var(--te-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.te-target-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.te-action-badge {
  font-size: 0.9rem;
  font-weight: 900;
  padding: 6px 13px;
  border-radius: 999px;
  background: #f1f5f9;
  color: var(--te-ink);
  min-width: 92px;
  text-align: center;
}

.te-action-badge.type-jump { background: #e0f2fe; color: #0369a1; }
.te-action-badge.type-slide { background: #d1fae5; color: #047857; }
.te-action-badge.type-smash { background: #fee2e2; color: #b91c1c; }
.te-action-badge.type-bonus { background: #fef08a; color: #854d0e; }

.te-target-word {
  flex: 1;
  text-align: center;
  font-size: 1.85rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  min-height: 2.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-wrap: wrap;
}

.te-target-idle {
  word-break: keep-all;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--te-muted);
}

.te-char-matched {
  color: #059669;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.te-char-composing {
  color: #d97706;
  background: #fef3c7;
  border-radius: 6px;
  padding: 0 2px;
}

.te-char-rest {
  color: #1e293b;
}

.te-next-preview {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--te-muted);
  min-width: 92px;
  text-align: right;
}

.te-next-preview:empty {
  display: none;
}

.te-input-row {
  display: flex;
  gap: 10px;
}

.te-input {
  flex: 1;
  min-width: 0;
  border: 2.5px solid #cbd5e1;
  border-radius: 16px;
  padding: 13px 18px;
  font-size: 1.35rem;
  font-weight: 800;
  font-family: inherit;
  color: var(--te-ink);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.te-input::placeholder {
  color: #526071;
  opacity: 1;
}

.te-input:focus {
  background: #ffffff;
  border-color: var(--te-orange);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.16);
}

.te-input.is-shake {
  border-color: var(--te-coral);
  animation: te-shake 0.25s ease;
}

.te-input.is-success {
  border-color: var(--te-mint);
  background: #ecfdf5;
}

@keyframes te-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.te-btn-submit {
  background: var(--te-ink);
  color: #ffffff;
  border-radius: 16px;
  padding: 0 22px;
  font-size: 1rem;
  font-weight: 800;
}

.te-btn-submit:hover {
  background: #0f172a;
}

/* Keyboard Hint */
.te-kbd-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px dashed #e2e8f0;
}

.te-kbd-guide-text {
  font-size: 0.88rem;
  font-weight: 700;
  color: #475569;
}

.te-kbd-guide-text strong {
  color: #c2410c;
  background: #ffedd5;
  padding: 1px 7px;
  border-radius: 6px;
  margin: 0 2px;
}

.te-mini-kbd {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.te-kbd-row {
  display: flex;
  gap: 4px;
}

.te-key {
  min-width: 30px;
  height: 28px;
  padding: 0 5px;
  border-radius: 7px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.875rem;
  font-weight: 800;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.te-key.is-highlight {
  background: #fed7aa;
  border-color: #ea580c;
  color: #7c2d12;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(249, 115, 22, 0.32);
}

.te-key.is-space {
  min-width: 110px;
}

/* Result Screen */
.te-result {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.te-result-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.te-result-card > [data-result-part="actions"] {
  margin-top: 0 !important;
}

.te-result-card [data-result-part="detail"] {
  text-wrap: balance;
}

#result-title:focus {
  outline: none;
}

.te-result-badge {
  display: inline-block;
  background: #fef3c7;
  color: #b45309;
  font-weight: 900;
  font-size: 0.92rem;
  padding: 6px 14px;
  border-radius: 999px;
}

.te-result-medal-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.te-rank-circle {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde047, #f97316);
  color: #ffffff;
  font-size: 2.8rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 24px rgba(249, 115, 22, 0.3);
}

.te-rank-circle.is-word {
  font-size: 1.6rem;
}

.te-result-mascot-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.te-result-mascot {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #fed7aa;
  background: #ffffff;
}

.te-new-best {
  font-size: 0.875rem;
  font-weight: 800;
  background: #ecfdf5;
  color: #047857;
  padding: 3px 10px;
  border-radius: 999px;
}

.te-result-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.te-result-stat {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px;
}

.te-result-stat dt {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--te-muted);
}

.te-result-stat dd {
  margin: 4px 0 0;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--te-ink);
}

/* Modals */
.te-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.te-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--te-surface);
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
}

.te-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.te-modal-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

.te-modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
}

.te-qr-desc {
  margin: 0 0 12px;
  color: var(--te-muted);
  font-size: 0.92rem;
}

.te-qr-course-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.te-qr-box {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: #f8fafc;
  border-radius: 16px;
  margin-bottom: 14px;
}

.te-qr-url-row {
  display: flex;
  gap: 8px;
}

.te-qr-url {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.875rem;
  color: var(--te-ink);
  background: #f8fafc;
}

.te-copy-feedback {
  margin: 8px 0 0;
  min-height: 1.2em;
  font-size: 0.875rem;
  font-weight: 700;
  color: #059669;
  text-align: center;
}

/* Responsive */
@media (min-width: 821px) {
  /* Keep the typing box and the whole keyboard hint below the run on tablets. */
  .te-stage-wrap {
    height: clamp(270px, calc(100dvh - 500px), 420px);
  }
}

@media (max-width: 820px) {
  .te-hero {
    grid-template-columns: 1fr;
  }
  .te-hud {
    padding: 8px 10px;
    gap: 8px;
  }
  .te-stage-wrap {
    height: clamp(220px, 36dvh, 320px);
  }
  .te-target-word {
    font-size: 1.45rem;
  }
  .te-input {
    font-size: 1.15rem;
    padding: 11px 14px;
  }
  .te-mini-kbd {
    display: none;
  }
}

@media (max-width: 600px) {
  .te-hud-hearts {
    flex: 1;
  }

  .te-hud-controls {
    order: 1;
  }

  .te-hud-progress {
    order: 2;
    flex-basis: 100%;
  }

  .te-hud-stats {
    order: 3;
    flex: 1 1 100%;
  }

  .te-stat-pill {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    justify-content: center;
    gap: 5px;
    padding: 4px 6px;
  }

  .te-stat-combo {
    position: relative;
  }

  .te-fever-bar {
    position: absolute;
    right: 8px;
    bottom: 1px;
    left: 8px;
    width: auto;
    margin: 0;
  }

  .te-rank-circle, .te-result-mascot {
    width: 68px;
    height: 68px;
  }

  .te-rank-circle {
    font-size: 2rem;
  }

  .te-rank-circle.is-word {
    font-size: 1.25rem;
  }

  .te-result-card {
    gap: 10px;
  }

  .te-result-stats {
    gap: 8px;
  }

  .te-result-stat {
    padding: 8px;
  }

  .te-result-stat dd {
    margin-top: 0;
    font-size: 1.15rem;
  }

  .te-app {
    padding-inline: 12px;
    gap: 8px;
  }

  .te-topbar, .te-topbar-right, .te-prefs {
    gap: 6px;
  }

  .te-topbar .te-btn-pill {
    gap: 4px;
    padding-inline: 11px;
  }

  .te-lobby-card {
    padding: 12px;
    gap: 10px;
  }

  .te-hero {
    gap: 8px;
  }

  .te-hero-heading {
    word-break: keep-all;
  }

  .te-world-tag, .te-hero-desc, .te-action-legend, .te-course-sub, .te-lobby-tip {
    display: none;
  }

  .te-section-head {
    margin-bottom: 6px;
    gap: 4px;
  }

  .te-section-head h3 {
    font-size: 1rem;
  }

  .te-practice-toggle {
    padding: 4px 6px;
    gap: 4px;
    font-size: 0.875rem;
  }

  .te-course-grid {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .te-course-card {
    display: grid;
    grid-template-columns: 1fr auto;
    min-height: 42px;
    padding: 5px 9px;
    gap: 2px 6px;
    border-radius: 12px;
  }

  .te-course-top {
    grid-column: 1 / -1;
  }

  .te-course-badge {
    padding: 1px 6px;
  }

  .te-course-title {
    font-size: 0.95rem;
  }

  .te-course-dist {
    margin: 0;
  }

  .te-btn-start {
    width: 100%;
    min-width: 0;
    padding: 12px 16px;
    font-size: 1.05rem;
  }
}

@media (max-width: 350px) {
  .te-app {
    padding-block: 8px;
    gap: 6px;
  }

  .te-stage-wrap {
    height: clamp(220px, 34dvh, 320px);
  }

  .te-hud {
    padding-block: 6px;
  }

  .te-hud-stats {
    gap: 4px;
  }

  .te-stat-pill {
    flex: 1 1 auto;
    gap: 3px;
    padding-inline: 4px;
  }

  .te-stat-pill strong {
    font-size: 0.95rem;
    white-space: nowrap;
  }

  .te-dock {
    padding: 8px 12px;
    gap: 6px;
  }

  .te-pause-card {
    padding: 14px 18px;
  }

  .te-rank-circle, .te-result-mascot {
    width: 52px;
    height: 52px;
  }

  .te-rank-circle.is-word {
    font-size: 1rem;
  }

  .te-result-card {
    gap: 6px;
  }

  .te-result-card [data-result-part="detail"] {
    margin-bottom: 4px !important;
  }

  .te-result-stat {
    padding: 4px;
  }

  .te-pause-card p {
    margin-bottom: 12px;
  }

  .te-lobby-card {
    padding-block: 9px;
    gap: 8px;
  }

  .te-hero-media {
    width: 100%;
    max-width: 220px;
    margin-inline: auto;
  }

  #hint-state-label {
    display: none;
  }
}

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