:root {
  color-scheme: light;
  --ink: #263238;
  --muted: #607282;
  --paper: #fffdf5;
  --paper-strong: #ffffff;
  --line: rgba(38, 50, 56, 0.14);
  --sun: #ffe089;
  --mint: #bce8d6;
  --sky: #b9e5ff;
  --peach: #ffd1b8;
  --lavender: #d8cdf9;
  --leaf: #75c7a2;
  --ocean: #4da3c7;
  --berry: #d9799f;
  --shadow: 0 18px 46px rgba(71, 85, 105, 0.16);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 224, 137, 0.82), transparent 25rem),
    radial-gradient(circle at 88% 18%, rgba(185, 229, 255, 0.9), transparent 24rem),
    radial-gradient(circle at 74% 86%, rgba(216, 205, 249, 0.72), transparent 25rem),
    linear-gradient(135deg, #fff8dd 0%, #e8f8ef 54%, #f5efff 100%);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px) 0 0 / 42px 42px;
}

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

button {
  border: 0;
  color: inherit;
  font: inherit;
  touch-action: manipulation;
}

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

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

.page {
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.page-header,
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1220px;
  margin: 0 auto 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #587084;
  font-size: 0.88rem;
  font-weight: 850;
}

.page-title,
.game-title {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
  letter-spacing: 0;
}

.home-link,
.pill-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 950;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.home-link,
.secondary-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 22px rgba(71, 85, 105, 0.12);
}

.primary-button,
.pill-button.is-active {
  padding: 0 20px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 10px 22px rgba(71, 85, 105, 0.16);
}

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 8px 20px rgba(71, 85, 105, 0.12);
}

.pill-button {
  min-height: 42px;
  padding: 0 15px;
  background: transparent;
  color: #516579;
}

.primary-button:disabled,
.secondary-button:disabled,
.pill-button:disabled {
  cursor: default;
  opacity: 0.4;
  box-shadow: none;
}

.home-link:active,
.primary-button:not(:disabled):active,
.secondary-button:not(:disabled):active,
.pill-button:not(:disabled):active {
  transform: scale(0.97);
}

.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  background: rgba(255, 253, 245, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #405363;
  font-weight: 900;
}

.result-dialog {
  width: min(92vw, 560px);
  padding: 0;
  border: 0;
  border-radius: 30px;
  background: transparent;
}

.result-dialog::backdrop {
  background: rgba(38, 50, 56, 0.34);
  backdrop-filter: blur(4px);
}

.result-panel {
  padding: 24px;
  border-radius: 30px;
  background: linear-gradient(160deg, #fffdf5, #e8f8ef);
  text-align: center;
}

.result-panel h2 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1.05;
}

.result-panel p {
  color: #405363;
  font-size: 1.08rem;
  font-weight: 800;
}

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

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

  .page-header,
  .game-header {
    align-items: stretch;
    flex-direction: column;
  }

  .pill-group {
    align-self: flex-start;
    border-radius: 24px;
  }
}
