@font-face {
  font-family: "Press Start 2P";
  src: url("../assets/fonts/PressStart2P-Regular.woff") format("woff");
  font-display: swap;
}

@font-face {
  font-family: "Fusion Pixel";
  src: url("../assets/fonts/FusionPixelZHans.woff2") format("woff2");
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #666666;
  --line: #d4d4d4;
  --soft: #f3f3f3;
  --fill: #111111;
  --shadow: 3px 3px 0 rgba(17, 17, 17, 0.16);
  --shadow-strong: 4px 4px 0 var(--ink);
  --pixel-font: "Press Start 2P", ui-monospace, monospace;
  --display-font: "Fusion Pixel", "Press Start 2P", sans-serif;
  --body-font: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  touch-action: manipulation;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
[role="option"]:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.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;
}

.app-shell {
  width: min(100% - 48px, 960px);
  margin: 0 auto;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

/* ---------- 顶栏 ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: max(12px, env(safe-area-inset-top, 0px)) 0 8px;
}

.brand-button,
.icon-button,
.back-button,
.text-button,
.speak-button {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  text-align: left;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-family: var(--display-font);
  font-size: 17px;
  font-weight: 400;
  -webkit-font-smoothing: none;
}

.brand-copy small {
  color: var(--muted);
  font: 7px/1.4 var(--pixel-font);
  letter-spacing: 0.08em;
  -webkit-font-smoothing: none;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 2px 2px 0 var(--ink);
}

.icon-button:hover {
  background: var(--soft);
}

.icon-button:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.icon-button img,
.back-button img,
.text-button img,
.speak-button img,
.btn img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}

/* ---------- 视图切换 ---------- */

.view {
  min-height: calc(100vh - 64px);
  padding: 24px 0 calc(88px + env(safe-area-inset-bottom, 0px));
  animation: view-in 160ms ease-out;
}

.view[hidden] {
  display: none !important;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-home {
  display: grid;
  align-items: center;
  min-height: calc(100vh - 92px);
  padding-top: 4px;
}

/* ---------- 传统火柴人 ---------- */

.hangman-scene {
  display: grid;
  justify-items: center;
}

.hangman-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.home-hangman {
  width: min(52vw, 220px);
  margin-bottom: 10px;
}

.life-hangman {
  width: min(100%, 240px);
  margin: 0 auto 8px;
}

.hangman-figure .part {
  opacity: 0;
}

.hangman-scene[data-stage="1"] .part:nth-child(-n+1),
.hangman-scene[data-stage="2"] .part:nth-child(-n+2),
.hangman-scene[data-stage="3"] .part:nth-child(-n+3),
.hangman-scene[data-stage="4"] .part:nth-child(-n+4),
.hangman-scene[data-stage="5"] .part:nth-child(-n+5),
.hangman-scene[data-stage="6"] .part {
  opacity: 1;
}

/* ---------- 首页 ---------- */

.home-hero {
  display: grid;
  justify-items: center;
  width: min(100%, 600px);
  margin: 0 auto;
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--ink);
  font: 9px/1.6 var(--pixel-font);
  letter-spacing: 0.1em;
  -webkit-font-smoothing: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--display-font);
  font-weight: 400;
  -webkit-font-smoothing: none;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 6.4vw, 56px);
  line-height: 1.15;
  letter-spacing: 0.04em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(26px, 4.4vw, 36px);
  line-height: 1.25;
}

h3 {
  font-size: 17px;
  font-weight: 650;
}

.hero-subtitle,
.page-heading > p:last-child {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.home-actions {
  display: grid;
  width: min(100%, 400px);
  gap: 14px;
  margin-top: 34px;
  margin-left: auto;
  margin-right: auto;
}

.play-loop {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 42px;
  color: var(--muted);
  font-size: 13px;
}

.play-loop i {
  width: 6px;
  height: 6px;
  background: var(--ink);
  transform: rotate(45deg);
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 22px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background-color 120ms linear;
}

.btn-large {
  min-height: 54px;
  font-size: 17px;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}

.btn-secondary {
  background: var(--panel);
  color: var(--ink);
}

.btn-hint {
  flex: 1;
  min-width: 140px;
  min-height: 44px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
}

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

.btn-hint:hover:not(:disabled) {
  box-shadow: 4px 4px 0 var(--ink);
}

.btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.btn-hint:active:not(:disabled) {
  box-shadow: 0 0 0 var(--ink);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  color: var(--muted);
}

.back-button {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px;
  color: var(--muted);
  font-size: 14px;
}

.back-button:hover,
.text-button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 5px;
}

/* ---------- 词库选择 ---------- */

.page-heading {
  position: relative;
  width: min(100%, 640px);
  margin: 0 auto 44px;
  padding-top: 44px;
  text-align: center;
}

.word-list-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  width: min(100%, 840px);
  margin: 0 auto;
}

.word-list-card.is-custom {
  grid-column: 1 / -1;
  min-height: 124px;
}

.word-list-card {
  position: relative;
  min-height: 152px;
  padding: 20px 18px 18px 26px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left;
  transition: transform 100ms ease-out, box-shadow 100ms ease-out, background-color 120ms linear;
}

.word-list-card::before {
  position: absolute;
  inset: 14px auto 14px 0;
  width: 6px;
  border-radius: 0 3px 3px 0;
  background: var(--ink);
  content: "";
}

.word-list-card.accent-blue,
.word-list-card.accent-green,
.word-list-card.accent-orange,
.word-list-card.accent-purple,
.word-list-card.accent-teal,
.word-list-card.accent-coral,
.word-list-card.accent-navy,
.word-list-card.accent-mint,
.word-list-card.accent-ink { --card-accent: var(--ink); }

.word-list-card:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(17, 17, 17, 0.2);
}

.word-list-card.is-selected {
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  color: #fff;
}

.word-list-card.is-selected .card-en,
.word-list-card.is-selected .card-count,
.word-list-card.is-selected p {
  color: #cfcfcf;
}

.word-list-card.is-selected .card-symbol {
  background: #fff;
  color: var(--ink);
}

.word-list-card.is-selected::before {
  background: #fff;
}

.word-list-card .card-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  font: 12px/1 var(--pixel-font);
  -webkit-font-smoothing: none;
}

.word-list-card h3 {
  margin-bottom: 4px;
  font-size: 18px;
  font-weight: 650;
}

.word-list-card .card-en {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font: 8px/1.5 var(--pixel-font);
  letter-spacing: 0.06em;
  -webkit-font-smoothing: none;
}

.word-list-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.word-list-card .card-count {
  position: absolute;
  top: 18px;
  right: 16px;
  color: var(--muted);
  font-size: 13px;
}

.sticky-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, 560px);
  margin: 40px auto 0;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sticky-action p {
  margin: 0;
  font-size: 15px;
}

/* ---------- 自定义词库 ---------- */

.panel {
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.custom-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(240px, 0.75fr);
  gap: 24px;
  width: min(100%, 840px);
  margin: 0 auto;
}

.custom-editor,
.custom-tip {
  padding: 22px;
}

.custom-editor label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: var(--body-font);
  font-size: 15px;
  line-height: 1.7;
}

textarea::placeholder {
  color: #999;
}

.input-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.form-message {
  min-height: 26px;
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 14px;
}

.custom-tip {
  align-self: start;
  background: var(--soft);
}

.custom-tip h3 {
  margin-bottom: 8px;
}

.custom-tip p {
  font-size: 14px;
  line-height: 1.7;
}

.muted {
  color: var(--muted);
}

.centered-action {
  display: flex;
  width: min(100%, 360px);
  margin: 36px auto 0;
}

/* ---------- 游戏页 ---------- */

.view-game {
  padding-top: 4px;
}

.game-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 26px;
}

.game-toolbar .back-button {
  position: static;
  justify-self: start;
}

.progress-chip {
  padding: 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--panel);
  font: 10px/1 var(--pixel-font);
  -webkit-font-smoothing: none;
}

.lives-label {
  justify-self: end;
  color: var(--muted);
  font-size: 14px;
}

.lives-label strong {
  color: var(--ink);
  font-weight: 700;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(400px, 1.28fr);
  align-items: start;
  gap: 56px;
  width: min(100%, 900px);
  margin: 0 auto;
}

.game-main,
.game-controls {
  min-width: 0;
}

.game-main {
  text-align: center;
}

.category-badge {
  display: inline-block;
  margin-bottom: 18px;
  padding: 7px 12px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font: 8px/1.4 var(--pixel-font);
  letter-spacing: 0.06em;
  -webkit-font-smoothing: none;
}

.word-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(6px, 1vw, 10px);
  min-height: 56px;
  margin-bottom: 12px;
}

.word-slot {
  display: grid;
  width: clamp(34px, 3.8vw, 46px);
  height: clamp(46px, 5.2vw, 58px);
  place-items: center;
  border-bottom: 3px solid var(--ink);
  color: var(--ink);
  font: 600 clamp(19px, 2.2vw, 26px)/1 var(--body-font);
  text-transform: uppercase;
}

.word-slot.is-revealed {
  animation: letter-reveal 160ms ease-out;
}

@keyframes letter-reveal {
  from { transform: translateY(-6px); color: var(--muted); }
  to { transform: translateY(0); color: var(--ink); }
}

.game-feedback {
  min-height: 24px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
}

.game-feedback.is-correct { color: var(--ink); }
.game-feedback.is-wrong { color: var(--muted); }
.game-feedback.is-repeat { color: var(--muted); }

.wrong-letters {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

#wrong-words {
  margin-top: 4px;
}

.word-guess {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.word-guess input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.word-guess input::placeholder {
  color: #999;
  text-transform: none;
  letter-spacing: 0;
}

.word-guess input:disabled,
.word-guess .btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.word-guess .btn {
  flex: 0 0 auto;
  min-width: 88px;
}

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

.letter-key {
  aspect-ratio: 1 / 1;
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  font: 600 clamp(13px, 1.4vw, 15px)/1 var(--body-font);
  transition: transform 70ms ease-out, box-shadow 70ms ease-out, background-color 100ms linear;
}

.letter-key:hover:not(:disabled) {
  background: var(--soft);
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 var(--ink);
}

.letter-key:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.letter-key:disabled {
  cursor: default;
}

.letter-key.is-correct {
  background: var(--ink);
  border-color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  color: #fff;
}

.letter-key.is-wrong {
  background: var(--soft);
  border-color: #b0b0b0;
  box-shadow: 2px 2px 0 #b0b0b0;
  color: #888;
  text-decoration: line-through 2px;
}

.hint-row {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.meaning-hint {
  margin-top: 14px;
  padding: 12px 14px;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: var(--soft);
  text-align: center;
}

.meaning-hint span {
  margin-right: 10px;
  color: var(--muted);
  font-size: 13px;
}

.meaning-hint strong {
  font-size: 16px;
  font-weight: 600;
}

/* ---------- 结果页 ---------- */

.result-wrap {
  width: min(100%, 600px);
  margin: 0 auto;
  text-align: center;
}

.result-badge {
  display: grid;
  width: 60px;
  height: 60px;
  margin: 8px auto 20px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--ink);
  box-shadow: var(--shadow-strong);
  color: #fff;
  font-size: 30px;
  animation: result-pop 320ms ease-out;
}

@keyframes result-pop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

.result-copy {
  color: var(--muted);
  font-size: 16px;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 26px 0 32px;
}

.result-stats > div {
  padding: 22px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.result-stats strong,
.result-stats span {
  display: block;
}

.result-stats strong {
  margin-bottom: 6px;
  color: var(--ink);
  font: 400 clamp(16px, 2.6vw, 21px)/1.4 var(--pixel-font);
  -webkit-font-smoothing: none;
}

.result-stats span {
  color: var(--muted);
  font-size: 14px;
}

.result-words {
  padding: 24px 28px;
  text-align: left;
}

.result-words h3 {
  margin-bottom: 12px;
  text-align: center;
}

.result-words ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-words li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--line);
}

.result-words li:last-child {
  border-bottom: 0;
}

.result-word-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.result-word-status img {
  width: 20px;
  height: 20px;
}

.result-word-status.failed {
  color: var(--muted);
}

.result-words li span:last-child {
  color: var(--muted);
  font-size: 15px;
}

.result-actions {
  display: grid;
  gap: 12px;
  width: min(100%, 400px);
  margin: 32px auto 0;
}

/* ---------- 学习卡片弹层 ---------- */

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  overflow-y: auto;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  animation: modal-fade 140ms linear;
}

.modal-backdrop[hidden] {
  display: none;
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.word-modal {
  width: min(100%, 540px);
  padding: 32px 36px 28px;
  text-align: center;
  animation: modal-rise 200ms ease-out;
}

@keyframes modal-rise {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-kicker {
  margin-bottom: 14px;
  color: var(--ink);
  font: 11px/1.5 var(--pixel-font);
  letter-spacing: 0.06em;
  -webkit-font-smoothing: none;
}

.word-modal.is-loss .modal-kicker {
  color: var(--muted);
}

.word-modal.is-loss-preview .pronunciation,
.word-modal.is-loss-preview .meaning-line,
.word-modal.is-loss-preview .study-meta {
  display: none;
}

.word-modal.is-loss-preview h2 {
  margin: 24px 0 30px;
  color: var(--ink);
}

.word-modal h2 {
  margin-bottom: 6px;
  color: var(--ink);
  font: 400 clamp(24px, 5vw, 38px)/1.35 var(--pixel-font);
  -webkit-font-smoothing: none;
  text-transform: uppercase;
  word-break: break-all;
}

.pronunciation {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 19px;
}

.meaning-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 16px 0;
  border-top: 2px dashed var(--line);
  border-bottom: 2px dashed var(--line);
}

.meaning-line strong {
  font-size: 23px;
  font-weight: 650;
}

.speak-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--soft);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.speak-button[hidden] {
  display: none;
}

.speak-button:hover:not(:disabled) {
  background: #e8e8e8;
}

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

.study-meta {
  padding: 18px 0 4px;
  text-align: left;
}

.study-category {
  display: inline-block;
  margin-bottom: 14px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  font: 7px/1.4 var(--pixel-font);
  letter-spacing: 0.05em;
  -webkit-font-smoothing: none;
}

.example-block > span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.example-block p {
  margin: 6px 0 0;
  font-size: 16px;
  line-height: 1.7;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 820px) {
  .word-list-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .custom-layout {
    grid-template-columns: 1fr;
  }

  .custom-tip {
    order: -1;
  }

  .game-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .game-controls {
    width: min(100%, 560px);
    margin: 0 auto;
  }
}

@media (max-width: 580px) {
  .app-shell {
    width: min(100% - 28px, 960px);
  }

  .brand-copy small {
    display: none;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .view {
    min-height: calc(100vh - 64px);
    padding: 22px 0 calc(52px + env(safe-area-inset-bottom, 0px));
  }

  .view-home {
    padding-top: 0;
  }

  h1 {
    font-size: clamp(28px, 10vw, 40px);
  }

  h2 {
    font-size: 27px;
  }

  .hero-subtitle,
  .page-heading > p:last-child {
    font-size: 15px;
  }

  .home-hangman {
    width: 148px;
    margin-bottom: 4px;
  }

  .btn-large {
    min-height: 50px;
    font-size: 16px;
  }

  .page-heading {
    margin-bottom: 26px;
    padding-top: 40px;
  }

  .word-list-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    padding-bottom: 120px;
  }

  .word-list-card {
    min-height: 0;
    padding: 18px 16px 16px 24px;
  }

  .sticky-action {
    position: sticky;
    z-index: 5;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    flex-direction: column;
    gap: 10px;
    margin-top: 26px;
  }

  .sticky-action .btn {
    width: 100%;
  }

  .custom-editor,
  .custom-tip {
    padding: 20px;
  }

  .custom-tip {
    display: none;
  }

  .input-meta {
    display: grid;
    gap: 2px;
  }

  .game-toolbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-bottom: 8px;
  }

  .lives-label {
    display: none;
  }

  .progress-chip {
    padding: 9px 12px;
    font-size: 9px;
  }

  .life-hangman {
    width: 168px;
    margin-bottom: 4px;
  }

  .category-badge {
    margin-bottom: 14px;
    font-size: 7px;
  }

  .word-slots {
    gap: 5px;
    min-height: 48px;
  }

  .word-slot {
    width: clamp(28px, 8vw, 36px);
    height: 44px;
    font-size: clamp(15px, 4.8vw, 20px);
  }

  .keyboard {
    grid-template-columns: repeat(7, 1fr);
    gap: 7px;
  }

  .letter-key {
    border-radius: 8px;
    font-size: 13px;
  }

  .hint-row {
    gap: 10px;
    margin-top: 18px;
  }

  .btn-hint {
    min-width: 0;
    padding: 10px 8px;
    font-size: 14px;
  }

  .word-guess {
    margin-bottom: 14px;
  }

  .word-guess input {
    min-height: 44px;
    padding: 8px 12px;
  }

  .word-guess .btn {
    min-width: 76px;
    min-height: 44px;
    padding: 10px 12px;
  }

  .result-stats {
    gap: 12px;
  }

  .result-stats > div {
    padding: 16px 8px;
  }

  .result-words {
    padding: 20px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 12px;
  }

  .word-modal {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    padding: 26px 20px 22px;
  }

  .meaning-line {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .speak-button {
    align-self: center;
  }

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

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