:root {
  color-scheme: light;
  --ink: #17213f;
  --muted: #6a7289;
  --primary: #5d62d6;
  --primary-deep: #494ebd;
  --primary-soft: #eef0ff;
  --blue-soft: #eaf7ff;
  --border: rgba(111, 122, 169, 0.17);
  --card: rgba(255, 255, 255, 0.86);
  --correct: #16845b;
  --correct-soft: #e8f8f1;
  --wrong: #ce5264;
  --wrong-soft: #fff0f2;
  --shadow: 0 28px 80px rgba(47, 59, 105, 0.22), 0 4px 18px rgba(47, 59, 105, 0.1);
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #e9eff9;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

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

.background {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(90deg, rgba(238, 244, 255, 0.08), rgba(245, 248, 255, 0.18)),
    url("./assets/background.jpg");
  background-position: center;
  background-size: cover;
}

.background::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 72% 24%, rgba(255, 255, 255, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 35%, rgba(231, 238, 250, 0.34) 100%);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  align-items: center;
  justify-content: flex-end;
  padding: clamp(22px, 4vw, 64px);
}

.game-card {
  width: min(100%, 510px);
  min-height: 620px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.08);
  -webkit-backdrop-filter: blur(22px) saturate(1.08);
  animation: card-in 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.header-copy {
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #f2f3ff, #e4eaff);
  box-shadow: inset 0 0 0 1px rgba(93, 98, 214, 0.1);
  font-size: 22px;
}

.eyebrow,
.mini-title {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.mini-title {
  margin-top: 3px;
  font-size: 17px;
  font-weight: 800;
}

.project-credit {
  display: grid;
  flex: 0 0 auto;
  gap: 3px;
  margin-left: auto;
  color: #858ba0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}

.start-content {
  padding-top: 32px;
}

.soft-badge,
.word-hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(93, 98, 214, 0.12);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary-soft), var(--blue-soft));
  color: var(--primary-deep);
  font-size: 13px;
  font-weight: 700;
}

.soft-badge {
  padding: 8px 12px;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

.start-content h1 {
  margin: 20px 0 14px;
  font-size: clamp(32px, 7vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.start-content h1 span {
  background: linear-gradient(90deg, #4f54c7, #7998e9);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.mode-grid {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.mode-button {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  width: 100%;
  min-height: 76px;
  align-items: center;
  gap: 14px;
  padding: 12px 18px 12px 12px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.mode-button:hover,
.mode-button:focus-visible {
  z-index: 1;
  border-color: rgba(93, 98, 214, 0.38);
  box-shadow: 0 10px 28px rgba(65, 76, 135, 0.12);
  transform: translateY(-2px);
  outline: none;
}

.mode-button--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #7887e8);
  color: white;
  box-shadow: 0 12px 26px rgba(83, 89, 197, 0.22);
}

.mode-number {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 15px;
  background: rgba(91, 99, 197, 0.1);
  font-size: 19px;
  font-weight: 900;
}

.mode-button--primary .mode-number {
  background: rgba(255, 255, 255, 0.17);
}

.mode-copy {
  display: grid;
  gap: 4px;
}

.mode-copy strong {
  font-size: 16px;
}

.mode-copy small {
  color: var(--muted);
  font-size: 12px;
}

.mode-button--primary .mode-copy small {
  color: rgba(255, 255, 255, 0.76);
}

.button-arrow {
  font-size: 22px;
}

.start-note {
  margin: 20px 0 0;
  color: #858ba0;
  font-size: 12px;
  text-align: center;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
}

.status-row > div:first-child {
  display: grid;
  gap: 4px;
}

.status-row strong {
  font-size: 15px;
}

.status-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.score-pill {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.score-pill span {
  font-size: 11px;
}

.score-pill strong {
  font-size: 18px;
}

.progress-track {
  height: 6px;
  margin-top: 13px;
  overflow: hidden;
  border-radius: 99px;
  background: #e7eaf3;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #8aa8ef);
  transition: width 280ms ease;
}

.question-content,
.reveal-content,
.summary-content {
  text-align: center;
}

.question-content {
  padding-top: 34px;
}

.question-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.emoji-clue {
  display: grid;
  min-height: 132px;
  margin: 18px 0;
  place-items: center;
  border: 1px solid rgba(113, 125, 177, 0.1);
  border-radius: 26px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.98), transparent 42%),
    linear-gradient(145deg, rgba(238, 241, 255, 0.9), rgba(234, 248, 255, 0.86));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: clamp(42px, 10vw, 62px);
  letter-spacing: 0.08em;
}

.word-hint {
  padding: 9px 14px;
}

.answer-form {
  margin-top: 32px;
  text-align: left;
}

.answer-form label {
  display: block;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 800;
}

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

.answer-row input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(103, 112, 155, 0.24);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.answer-row input:focus {
  border-color: rgba(93, 98, 214, 0.58);
  box-shadow: 0 0 0 4px rgba(93, 98, 214, 0.1);
}

.answer-row input[aria-invalid="true"] {
  border-color: var(--wrong);
}

.answer-row input::placeholder {
  color: #a1a6b6;
}

.primary-button,
.secondary-button {
  min-height: 52px;
  border-radius: 15px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.primary-button {
  padding: 0 20px;
  border: 0;
  background: linear-gradient(135deg, var(--primary), #7585e5);
  color: white;
  box-shadow: 0 10px 20px rgba(78, 84, 190, 0.2);
}

.primary-button:hover,
.primary-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.mode-button:active {
  transform: translateY(1px);
}

.input-error {
  margin: 8px 3px 0;
  color: var(--wrong);
  font-size: 12px;
  font-weight: 700;
}

.reveal-content {
  padding-top: 26px;
}

.result-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--correct-soft);
  color: var(--correct);
  font-size: 13px;
  font-weight: 800;
}

.is-wrong .result-chip {
  background: var(--wrong-soft);
  color: var(--wrong);
}

.result-chip span {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: currentColor;
  color: white;
  font-size: 13px;
}

.avatar-frame {
  position: relative;
  width: 152px;
  height: 152px;
  margin: 20px auto 15px;
  padding: 7px;
  border-radius: 40px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(226, 232, 255, 0.9));
  box-shadow: 0 16px 35px rgba(58, 72, 126, 0.18);
}

.avatar-frame::before {
  position: absolute;
  inset: -5px;
  z-index: -1;
  border-radius: 44px;
  background: linear-gradient(145deg, #aebcff, #e7edff);
  content: "";
  opacity: 0.55;
}

.avatar-frame img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 34px;
  object-fit: cover;
}

.answer-label {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.reveal-content h2 {
  margin: 6px 0 8px;
  font-size: 32px;
}

.answer-message {
  min-height: 24px;
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.answer-message strong {
  color: var(--ink);
}

.primary-button--wide {
  display: inline-flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.summary-content {
  padding-top: 30px;
}

.summary-sparkles {
  margin-bottom: 12px;
  color: #8c94df;
  font-size: 22px;
}

.summary-content h1 {
  margin: 8px 0 20px;
  font-size: 34px;
}

.score-result {
  display: grid;
  width: 160px;
  height: 160px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--primary) var(--score-angle), rgba(93, 98, 214, 0.12) 0);
  box-shadow: 0 16px 32px rgba(66, 76, 140, 0.16);
}

.score-result::before {
  grid-area: 1 / 1;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  content: "";
}

.score-result > div {
  z-index: 1;
  grid-area: 1 / 1;
}

.score-result strong {
  font-size: 46px;
  line-height: 1;
}

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

.summary-rate {
  margin: 18px 0 5px;
  color: var(--muted);
  font-size: 14px;
}

.summary-rate strong {
  color: var(--primary-deep);
  font-size: 18px;
}

.summary-message {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.summary-actions {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.secondary-button {
  border: 1px solid rgba(93, 98, 214, 0.2);
  background: rgba(255, 255, 255, 0.65);
  color: var(--primary-deep);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
}

@media (max-width: 720px) {
  .background {
    background-position: 50% center;
  }

  .background::after {
    background: linear-gradient(180deg, rgba(242, 246, 255, 0.06) 16%, rgba(232, 239, 251, 0.74) 72%);
  }

  .app-shell {
    align-items: flex-end;
    padding: max(18px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }

  .game-card {
    min-height: 0;
    max-height: calc(100svh - 28px);
    padding: 20px;
    overflow-y: auto;
    border-radius: 25px;
  }

  .card-header {
    padding-bottom: 16px;
  }

  .start-content {
    padding-top: 22px;
  }

  .start-content h1 {
    margin-top: 16px;
  }

  .mode-grid {
    margin-top: 20px;
  }

  .question-content {
    padding-top: 24px;
  }

  .emoji-clue {
    min-height: 112px;
    margin: 14px 0;
  }

  .answer-form {
    margin-top: 22px;
  }

  .reveal-content {
    padding-top: 20px;
  }

  .avatar-frame {
    width: 132px;
    height: 132px;
    margin-top: 16px;
  }

  .summary-content {
    padding-top: 22px;
  }
}

@media (max-width: 430px) {
  .card-header {
    gap: 9px;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.07em;
  }

  .mini-title {
    font-size: 15px;
  }

  .project-credit {
    font-size: 9px;
  }

  .answer-row {
    grid-template-columns: 1fr;
  }

  .answer-row .primary-button {
    width: 100%;
  }

  .start-note {
    line-height: 1.6;
  }
}

@media (min-width: 1100px) {
  .app-shell {
    padding-right: max(7vw, 76px);
  }
}

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