:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-soft: #fbfcfb;
  --text: #182024;
  --muted: #616970;
  --line: #dce2e0;
  --line-strong: #bcc5c2;
  --green: #24b41f;
  --green-dark: #0f9015;
  --green-soft: #e9f8e8;
  --gold: #f0b429;
  --red: #ef3b50;
  --shadow: 0 18px 50px rgba(20, 34, 29, 0.09);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, rgba(36, 180, 31, 0.09), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.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(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 20px;
}

.game-header {
  position: relative;
  display: grid;
  gap: 18px;
  padding-top: 12px;
}

.lantern {
  position: absolute;
  top: -4px;
  left: 0;
  width: 128px;
  height: 128px;
  filter: drop-shadow(0 12px 20px rgba(239, 59, 80, 0.2));
  pointer-events: none;
}

.guess-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px 148px;
  gap: 16px;
  align-items: stretch;
  padding-left: 148px;
}

.input-wrap {
  position: relative;
}

.input-wrap::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: var(--radius);
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

#guess-input {
  width: 100%;
  min-height: 78px;
  padding: 0 28px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface);
  color: var(--text);
  font-size: 32px;
  font-weight: 650;
  letter-spacing: 0;
  box-shadow: var(--shadow);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

#guess-input:focus {
  border-color: var(--green);
  box-shadow: 0 16px 42px rgba(36, 180, 31, 0.16);
}

.primary-button {
  min-height: 78px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #32c326 0%, var(--green-dark) 100%);
  color: #fff;
  font-size: 31px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 18px 32px rgba(16, 144, 21, 0.24);
  transition:
    transform 160ms ease,
    filter 160ms ease;
}

.primary-button:hover {
  filter: brightness(1.04);
}

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

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.attempt-card {
  display: grid;
  place-items: center;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 17px;
  line-height: 1.2;
}

.attempt-card strong,
.attempt-card b span {
  color: var(--green-dark);
}

.attempt-card b {
  color: var(--text);
  font-size: 30px;
}

h1 {
  margin: 8px 0 0;
  text-align: center;
  font-size: 24px;
  line-height: 1.25;
}

.status-text {
  min-height: 34px;
  max-width: 920px;
  margin: 0 auto;
  text-align: center;
  color: var(--text);
  font-size: 22px;
  font-weight: 550;
  line-height: 1.5;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.05fr);
  gap: 18px;
  margin-top: 18px;
}

.info-stack {
  display: grid;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.rules-panel {
  padding: 28px 30px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-title h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.panel-title p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.title-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--green);
  font-size: 20px;
  font-weight: 900;
}

.title-icon.bulb {
  color: var(--green);
  filter: drop-shadow(0 0 6px rgba(36, 180, 31, 0.28));
}

.rules-panel ol {
  margin: 0;
  padding-left: 25px;
  color: #20282d;
  font-size: 20px;
  line-height: 1.85;
}

.hint-panel {
  padding: 22px 28px;
}

.hint-panel p {
  margin: 0 0 18px;
  color: #344048;
  font-size: 18px;
  line-height: 1.65;
  white-space: pre-line;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: #263139;
  font-size: 16px;
  font-weight: 650;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--green);
  color: var(--green-dark);
  box-shadow: 0 10px 24px rgba(36, 180, 31, 0.09);
}

.history-panel {
  min-height: 520px;
  padding: 26px 22px;
}

.history-title {
  justify-content: flex-start;
}

.meter-icon {
  width: 32px;
  height: 31px;
  border-radius: 6px;
  background:
    linear-gradient(90deg, var(--green) 0 6px, transparent 6px 10px, var(--green) 10px 18px, transparent 18px 22px, var(--green) 22px 30px),
    linear-gradient(180deg, transparent 0 12px, rgba(36, 180, 31, 0.18) 12px 100%);
  clip-path: polygon(0 52%, 20% 52%, 20% 22%, 40% 22%, 40% 4%, 60% 4%, 60% 36%, 80% 36%, 80% 14%, 100% 14%, 100% 100%, 0 100%);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 380px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-soft), #fff);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: #4a545c;
  font-size: 18px;
}

.empty-state p {
  margin: 8px 0 0;
}

.empty-illustration {
  display: grid;
  place-items: center;
  width: 118px;
  height: 118px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--green-soft);
}

.empty-illustration span {
  width: 58px;
  height: 72px;
  border: 4px solid #aab5b2;
  border-radius: 8px;
  background:
    linear-gradient(#aab5b2, #aab5b2) 14px 20px / 30px 3px no-repeat,
    linear-gradient(#aab5b2, #aab5b2) 14px 34px / 30px 3px no-repeat,
    linear-gradient(#aab5b2, #aab5b2) 14px 48px / 22px 3px no-repeat,
    #fff;
  transform: rotate(5deg);
}

.history-list {
  display: grid;
  gap: 10px;
}

.guess-row {
  display: grid;
  grid-template-columns: 54px minmax(88px, 1fr) minmax(140px, 190px) 74px;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.guess-turn {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.guess-word {
  overflow: hidden;
  color: var(--text);
  font-size: 20px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #ecf0ef;
}

.score-fill {
  width: var(--score);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6dd56a, var(--green));
}

.guess-row.medium .score-fill {
  background: linear-gradient(90deg, #f5cb5c, var(--gold));
}

.guess-row.low .score-fill,
.guess-row.zero .score-fill {
  background: linear-gradient(90deg, #aeb7b4, #7e8985);
}

.guess-score {
  color: var(--green-dark);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.guess-detail {
  grid-column: 2 / -1;
  margin-top: -7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guess-row.medium .guess-score {
  color: #9b6b05;
}

.guess-row.low .guess-score,
.guess-row.zero .guess-score {
  color: #68716e;
}

.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.game-footer p {
  margin: 0;
  line-height: 1.6;
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.shake {
  animation: shake 180ms ease-in-out 0s 2;
}

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

@media (max-width: 920px) {
  .app-shell {
    width: min(100vw - 24px, 720px);
    padding-top: 18px;
  }

  .lantern {
    width: 76px;
    height: 76px;
  }

  .guess-bar {
    grid-template-columns: 1fr 112px;
    padding-left: 88px;
  }

  .attempt-card {
    grid-column: 1 / -1;
    min-height: 64px;
  }

  #guess-input,
  .primary-button {
    min-height: 64px;
    font-size: 24px;
  }

  .game-grid {
    grid-template-columns: 1fr;
  }

  .history-panel {
    min-height: 420px;
  }

  .game-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .footer-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 18px, 430px);
  }

  .game-header {
    gap: 13px;
  }

  .lantern {
    top: -2px;
    width: 62px;
    height: 62px;
  }

  .guess-bar {
    grid-template-columns: 1fr;
    gap: 10px;
    padding-left: 68px;
  }

  #guess-input,
  .primary-button {
    min-height: 58px;
    font-size: 21px;
  }

  .attempt-card {
    min-height: 56px;
  }

  h1 {
    font-size: 21px;
  }

  .status-text {
    font-size: 18px;
  }

  .rules-panel,
  .hint-panel,
  .history-panel {
    padding: 20px 16px;
  }

  .panel-title h2 {
    font-size: 21px;
  }

  .rules-panel ol {
    font-size: 17px;
    line-height: 1.7;
  }

  .guess-row {
    grid-template-columns: 42px minmax(72px, 1fr) 68px;
  }

  .score-track {
    grid-column: 2 / -1;
    order: 4;
  }

  .guess-detail {
    grid-column: 2 / -1;
    order: 5;
    margin-top: -4px;
    white-space: normal;
  }
}
