:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #66605a;
  --line: rgba(23, 23, 23, 0.14);
  --paper: #f6f1e8;
  --paper-strong: #fffaf0;
  --clay: #bd4a2b;
  --moss: #51745d;
  --blue: #345f83;
  --violet: #5d527f;
  --shadow: 0 24px 80px rgba(34, 27, 19, 0.16);
  font-family:
    "Inter", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(180deg, #f7f0e5 0%, #e9efe9 42%, #eef1f4 100%);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header {
  min-height: 62px;
  margin-bottom: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--paper-strong);
  background: var(--ink);
  border-radius: 10px;
  font-weight: 800;
}

.brand-name,
.brand-domain {
  display: block;
}

.brand-name {
  font-weight: 800;
}

.brand-domain {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-link,
.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 250, 240, 0.74);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(23, 23, 23, 0.06);
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.icon-link:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 23, 23, 0.32);
  background: #fffaf0;
}

.icon-link svg,
.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(460px, 1.5fr) minmax(270px, 0.9fr);
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.hero-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.44fr);
  align-items: end;
  gap: 18px;
  min-height: 230px;
  padding: 38px;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(23, 23, 23, 0.86) 0%, rgba(23, 23, 23, 0.66) 56%, rgba(189, 74, 43, 0.22) 100%),
    url("https://images.unsplash.com/photo-1519682337058-a94d519337bc?auto=format&fit=crop&w=1800&q=82") center / cover;
  border: 1px solid rgba(23, 23, 23, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel h1 {
  max-width: 900px;
  margin: 8px 0 14px;
  color: #fffaf0;
  font-size: clamp(38px, 5vw, 72px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-panel p {
  max-width: 720px;
  margin: 0;
  color: rgba(255, 250, 240, 0.84);
  font-size: 17px;
  line-height: 1.7;
}

.kicker {
  grid-column: 1;
  color: #f0c18e;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-panel h1,
.hero-panel p {
  grid-column: 1;
}

.progress-card,
.room-list,
.puzzle-panel,
.archive-panel {
  background: rgba(255, 250, 240, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(34, 27, 19, 0.1);
  backdrop-filter: blur(16px);
}

.progress-card {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  min-height: 142px;
  padding: 18px;
  color: #fffaf0;
  background: rgba(255, 250, 240, 0.12);
  border-color: rgba(255, 250, 240, 0.24);
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  background: rgba(255, 250, 240, 0.22);
  border-radius: 999px;
}

#progress-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #f0c18e, #86b889);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.room-list,
.archive-panel {
  min-height: 520px;
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.ghost-button,
.secondary-button,
.primary-button,
.answer-row button {
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease;
}

.ghost-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: rgba(23, 23, 23, 0.05);
}

#room-map {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.room-node {
  width: 100%;
  min-height: 76px;
  padding: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 8px;
}

.room-node span,
.room-node strong,
.room-node em {
  display: block;
}

.room-node span {
  color: var(--clay);
  font-size: 12px;
  font-weight: 900;
}

.room-node strong {
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.3;
}

.room-node em {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.room-node.is-active {
  background: #fffaf0;
  border-color: rgba(189, 74, 43, 0.46);
  box-shadow: 0 12px 28px rgba(189, 74, 43, 0.12);
}

.room-node.is-solved {
  border-color: rgba(81, 116, 93, 0.52);
}

.room-node.is-locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.puzzle-panel {
  min-height: 520px;
  padding: 24px;
}

.room-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.puzzle-panel h2 {
  margin: 18px 0 10px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.puzzle-panel > p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.clue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.clue-card {
  min-height: 150px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 8px;
}

.clue-card span {
  color: var(--clay);
  font-size: 12px;
  font-weight: 900;
}

.clue-card h3 {
  margin: 12px 0 8px;
  font-size: 18px;
  line-height: 1.2;
}

.clue-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

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

.answer-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.answer-row input {
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(23, 23, 23, 0.16);
  border-radius: 8px;
  outline: none;
}

.answer-row input:focus {
  border-color: rgba(52, 95, 131, 0.62);
  box-shadow: 0 0 0 4px rgba(52, 95, 131, 0.12);
}

.answer-row button,
.primary-button {
  min-height: 52px;
  padding: 0 18px;
  color: #fffaf0;
  background: var(--ink);
}

.answer-row button:hover,
.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(23, 23, 23, 0.18);
}

.primary-button:disabled {
  color: rgba(255, 250, 240, 0.54);
  background: rgba(23, 23, 23, 0.42);
  cursor: not-allowed;
}

.feedback {
  min-height: 48px;
  margin-top: 14px;
  padding: 12px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 8px;
  line-height: 1.55;
}

.feedback.is-success {
  color: #203d2d;
  background: rgba(134, 184, 137, 0.18);
  border-color: rgba(81, 116, 93, 0.32);
}

.feedback.is-error {
  color: #6f2515;
  background: rgba(189, 74, 43, 0.11);
  border-color: rgba(189, 74, 43, 0.28);
}

.puzzle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.secondary-button {
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(23, 23, 23, 0.12);
}

.archive-panel {
  overflow: hidden;
}

.api-status {
  padding: 5px 9px;
  color: var(--muted);
  background: rgba(23, 23, 23, 0.06);
  border-radius: 999px;
}

.api-status.is-loading {
  color: var(--blue);
  background: rgba(52, 95, 131, 0.12);
}

.api-status.is-online {
  color: #203d2d;
  background: rgba(81, 116, 93, 0.15);
}

.archive-stack {
  display: grid;
  max-height: 740px;
  gap: 12px;
  overflow: auto;
  padding-right: 2px;
}

.archive-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(23, 23, 23, 0.1);
  border-radius: 8px;
}

.archive-card span {
  color: var(--clay);
  font-size: 12px;
  font-weight: 900;
}

.archive-card h3 {
  margin: 4px 0 0;
  font-size: 17px;
}

.archive-card img {
  width: 82px;
  max-width: 100%;
  height: 122px;
  object-fit: cover;
  background: rgba(23, 23, 23, 0.08);
  border-radius: 6px;
}

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

.archive-card a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.archive-card.is-skeleton span,
.archive-card.is-skeleton h3,
.archive-card.is-skeleton p {
  display: block;
  min-height: 14px;
  background: linear-gradient(90deg, rgba(23, 23, 23, 0.06), rgba(23, 23, 23, 0.12), rgba(23, 23, 23, 0.06));
  border-radius: 6px;
  animation: shimmer 1.2s infinite linear;
}

.site-footer {
  margin-top: 18px;
  padding: 16px 4px 4px;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 23, 23, 0.54);
}

.modal-card {
  position: relative;
  width: min(420px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  overflow: auto;
  padding: 22px;
  background: #fffaf0;
  border: 1px solid rgba(23, 23, 23, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
  outline: none;
}

.modal-card h2 {
  margin: 0 34px 8px 0;
  font-size: 26px;
}

.modal-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-card img {
  display: block;
  width: min(260px, 100%);
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--ink);
  background: rgba(23, 23, 23, 0.06);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.modal-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.modal-links a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.modal-open {
  overflow: hidden;
}

@keyframes shimmer {
  0% {
    background-position: -120px 0;
  }
  100% {
    background-position: 120px 0;
  }
}

@media (max-width: 1120px) {
  .game-layout {
    grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  }

  .archive-panel {
    grid-column: 1 / -1;
    min-height: 0;
  }

  .archive-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 12px;
  }

  .site-header {
    align-items: flex-start;
  }

  .brand-domain {
    display: none;
  }

  .game-layout,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 430px;
    padding: 24px;
    align-content: end;
  }

  .kicker,
  .hero-panel h1,
  .hero-panel p,
  .progress-card {
    grid-column: 1;
    grid-row: auto;
  }

  .hero-panel h1 {
    font-size: 42px;
  }

  .room-list,
  .puzzle-panel,
  .archive-panel {
    min-height: 0;
  }

  .clue-grid,
  .archive-stack {
    grid-template-columns: 1fr;
  }

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

  .puzzle-panel h2 {
    font-size: 28px;
  }

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

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

  .icon-link,
  .icon-button {
    width: 36px;
    height: 36px;
  }

  .hero-panel {
    padding: 20px;
  }

  .hero-panel h1 {
    font-size: 35px;
  }

  .puzzle-actions {
    display: grid;
  }
}
