:root {
  color-scheme: light;
  --ink: #162033;
  --muted: #667085;
  --soft: #eef4f6;
  --line: #d8e3e8;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --primary-soft: #e3f4f1;
  --accent: #d92d20;
  --amber: #f59e0b;
  --paper: #ffffff;
  --tile: #fbfefe;
  --shadow: 0 24px 60px rgba(22, 32, 51, 0.16);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #edf5f4;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(15, 118, 110, 0.18), transparent 28%),
    radial-gradient(circle at 88% 6%, rgba(245, 158, 11, 0.18), transparent 26%),
    linear-gradient(135deg, #eef8f6 0%, #f8fbfb 52%, #fff8ed 100%);
}

button,
input {
  font: inherit;
}

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

.shell {
  width: min(100% - 22px, 720px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px 0;
  gap: 12px;
}

.panel {
  width: min(100%, 680px);
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.welcome-panel {
  padding: 24px 20px 24px;
  position: relative;
  overflow: hidden;
}

.welcome-panel::before {
  content: "";
  display: block;
  height: 6px;
  margin: -24px -20px 20px;
  background: linear-gradient(90deg, var(--primary), var(--amber));
  border-radius: 999px;
}

.hidden {
  display: none !important;
}

.brand {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
  opacity: 0.92;
}

.hero-badge {
  width: fit-content;
  margin: 15px 0 14px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff6df;
  color: #9a5b00;
  font-size: 13px;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 7px;
  font-size: clamp(32px, 9.5vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 900;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.15;
  letter-spacing: 0;
}

.subtitle {
  margin-bottom: 16px;
  color: var(--primary);
  font-size: 17px;
  font-weight: 900;
}

.notice {
  margin-bottom: 18px;
  border: 1px solid rgba(15, 118, 110, 0.12);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: #f5fbfa;
  color: #475467;
  font-size: 13px;
  line-height: 1.65;
}

.signup-form {
  display: grid;
  gap: 12px;
  border-radius: 24px;
  padding: 13px;
  background: rgba(248, 251, 251, 0.72);
  border: 1px solid rgba(216, 227, 232, 0.72);
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 16px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input::placeholder {
  color: #98a2b3;
}

input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

input.invalid {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.1);
}

input.valid {
  border-color: var(--primary);
}

.field-hint {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.field-hint.ok {
  color: var(--primary-dark);
}

.field-hint.error {
  color: var(--accent);
}

.form-message {
  min-height: 20px;
  margin: -2px 0 0;
  color: var(--accent);
  font-size: 13px;
  line-height: 1.45;
}

.primary-btn {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--primary-dark), #109083);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(15, 118, 110, 0.28);
  transition: transform 120ms ease, opacity 160ms ease, box-shadow 160ms ease;
}

.primary-btn:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 7px 14px rgba(15, 118, 110, 0.2);
}

.primary-btn:hover {
  box-shadow: 0 18px 34px rgba(15, 118, 110, 0.3);
}

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

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.secondary-btn {
  min-height: 42px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.secondary-btn:disabled {
  opacity: 0.6;
}

.returning-form {
  display: grid;
  gap: 11px;
  margin: 12px 0;
  border-radius: 22px;
  padding: 13px;
  background: rgba(255, 246, 223, 0.72);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.ranking-card {
  margin-top: 14px;
  border: 1px solid rgba(15, 118, 110, 0.13);
  border-radius: 24px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.ranking-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.ranking-head strong {
  display: block;
  font-size: 16px;
}

.ranking-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  color: var(--muted);
  font-size: 13px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 16px;
  padding: 7px 10px;
  background: #f7fbfb;
  border: 1px solid rgba(216, 227, 232, 0.7);
}

.rank-no {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 900;
}

.rank-name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-row strong {
  color: var(--primary-dark);
  font-variant-numeric: tabular-nums;
}

.ranking-empty {
  border-radius: 16px;
  padding: 12px;
  background: #f7fbfb;
  text-align: center;
}

.game-panel {
  width: min(100%, 640px);
  padding: 13px;
}

.game-panel,
.result-panel {
  background: rgba(255, 255, 255, 0.9);
}

.game-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.metric-card {
  min-width: 0;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  background: #f7fbfb;
}

.small-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.game-head strong {
  display: block;
  font-size: clamp(25px, 8vw, 38px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

#targetNumber {
  color: var(--primary-dark);
}

.danger {
  color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  aspect-ratio: 1;
  width: 100%;
  padding: 7px;
  border-radius: 22px;
  background: rgba(238, 244, 246, 0.72);
  border: 1px solid rgba(216, 227, 232, 0.72);
}

.cell {
  width: 100%;
  min-width: 0;
  border: 1px solid #d8e3e8;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #ffffff, var(--tile));
  color: var(--ink);
  font-size: clamp(16px, 6.4vw, 28px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(22, 32, 51, 0.09);
  touch-action: manipulation;
  transition: transform 90ms ease, border-color 120ms ease, background 120ms ease;
}

.cell:active {
  transform: scale(0.96);
}

.cell.done {
  border-color: rgba(15, 118, 110, 0.26);
  background: linear-gradient(180deg, #ebfaf7, var(--primary-soft));
  color: var(--primary-dark);
  cursor: default;
  box-shadow: none;
}

.cell.wrong {
  border-color: var(--accent);
  animation: shake 150ms linear 2;
}

.result-panel,
.admin-panel {
  padding: 26px 20px 22px;
  text-align: center;
}

.result-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 24px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
}

.result-mark.fail {
  background: #fde2df;
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(217, 45, 32, 0.14);
}

#resultText {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.result-rank {
  margin: 14px 0 16px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 22px;
  padding: 14px;
  background: rgba(227, 244, 241, 0.72);
}

.result-rank span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.result-rank strong {
  display: block;
  margin-top: 4px;
  color: var(--primary-dark);
  font-size: clamp(34px, 12vw, 48px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-ranking-card {
  margin: 0 0 18px;
  text-align: left;
}

.qq-box {
  margin: 18px 0 20px;
  padding: 16px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: var(--radius-md);
  background: #effaf8;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.qq-box span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.qq-box strong {
  display: block;
  margin: 7px 0;
  color: var(--primary-dark);
  font-size: clamp(32px, 11vw, 46px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

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

.stat-box {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin: 20px 0 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--tile);
}

.stat-box strong {
  font-size: clamp(56px, 16vw, 96px);
  line-height: 1;
  color: var(--primary-dark);
}

.stat-unit {
  color: var(--muted);
  font-size: 18px;
}

.filing-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0 8px 4px;
  color: #667085;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.filing-footer a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
}

.filing-footer img {
  width: 14px;
  height: 14px;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(4px);
  }
}

@media (min-width: 700px) {
  .welcome-panel {
    padding: 30px;
  }

  .game-panel {
    padding: 18px;
  }

  .grid {
    gap: 10px;
  }
}

@media (max-width: 390px) {
  .shell {
    width: min(100% - 16px, 720px);
    padding: 10px 0;
  }

  .welcome-panel {
    padding: 20px 15px;
  }

  .welcome-panel::before {
    margin: -20px -15px 17px;
  }

  h1 {
    font-size: 32px;
  }

  .subtitle {
    font-size: 16px;
  }

  .notice {
    font-size: 12px;
  }

  input {
    min-height: 46px;
  }

  .game-panel {
    padding: 9px;
  }

  .grid {
    gap: 5px;
    padding: 6px;
  }

  .cell {
    font-size: 20px;
  }

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

  .ranking-list {
    max-height: 210px;
  }

  .filing-footer {
    font-size: 11px;
  }
}
