:root {
  --ink: #fff4d8;
  --soft: #ecd2a4;
  --oak: #3d2412;
  --gold: #e6b54a;
  --leather: #8a3f16;
  --font: "Noto Sans SC", "PingFang SC", sans-serif;
  --display: "Cinzel", "Noto Sans SC", serif;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: #1a120c;
}

button { font-family: inherit; cursor: pointer; border: 0; }

.hidden { display: none !important; }

.app {
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
  background: #24160e;
}

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  z-index: 0;
}

.haze,
.game-frame {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.haze {
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(18, 10, 6, 0.18), transparent 28%, rgba(20, 10, 6, 0.12) 62%, rgba(12, 8, 5, 0.38));
}

.game-frame {
  z-index: 30;
  box-shadow:
    inset 0 0 0 8px #2a160c,
    inset 0 0 0 12px #c9a056,
    inset 0 0 0 16px #5a3014;
}

.screen {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
}

.panel {
  background:
    linear-gradient(180deg, rgba(255, 220, 150, 0.14), transparent 40%),
    repeating-linear-gradient(90deg, #6b3a1c 0 14px, #5a2f16 14px 22px);
  border: 3px solid #2a150a;
  box-shadow: 0 10px 0 #140a06, inset 0 1px 0 rgba(255, 230, 180, 0.2);
}

.title-stack {
  position: absolute;
  left: 28px;
  top: 28px;
  width: min(420px, calc(100% - 180px));
  padding: 22px 24px 20px;
  border-radius: 24px;
}

.kicker,
.title-en {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

.title-stack h1,
.panel h2,
.board h2 {
  margin: 8px 0 0;
  font-family: var(--display);
  line-height: 0.95;
  color: #fff6df;
}

.title-stack h1 {
  font-size: clamp(26px, 4.6vw, 46px);
  line-height: 1.15;
  text-shadow: 0 4px 0 #3d1f0a;
}

.title-en { margin-top: 10px; font-size: 16px; }

.home-progress {
  position: absolute;
  top: 26px;
  right: 28px;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 800;
  color: #3d220c;
  background: linear-gradient(180deg, #ffe08a, #d7a03c);
  border: 3px solid #7a4814;
}

.home-panel {
  position: absolute;
  left: 50%;
  bottom: 5vh;
  transform: translateX(-50%);
  width: min(640px, calc(100% - 36px));
  padding: 22px 24px 24px;
  text-align: center;
  border-radius: 24px;
}

.lede,
.tip {
  margin: 8px 0 0;
  color: var(--soft);
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

.primary,
.ghost,
.back,
.listen,
.link-btn {
  padding: 12px 22px;
  font-size: 18px;
  font-weight: 800;
  border-radius: 999px;
}

.primary {
  color: #fff8e8;
  background: linear-gradient(180deg, #c45a22, #8a3a12);
  border: 3px solid #4a1c08;
  box-shadow: 0 6px 0 #2a1006;
}

.primary.big { padding: 15px 36px; font-size: 24px; }
.primary:hover { transform: translateY(1px); }

.ghost,
.back,
.link-btn {
  color: #3d220c;
  text-decoration: none;
  background: linear-gradient(180deg, #ffe7a8, #e2b24a);
  border: 3px solid #7a4814;
  box-shadow: 0 6px 0 #4a2a08;
}

.link-btn { display: inline-block; }

.listen {
  margin-top: 6px;
  padding: 7px 12px;
  font-size: 14px;
  color: #fff8e8;
  background: linear-gradient(180deg, #2a7a6e, #145248);
  border: 3px solid #083830;
  box-shadow: 0 4px 0 #042420;
}

.panel-wrap {
  min-height: 100dvh;
  padding: 28px 22px;
}

.panel.wide {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 22px;
  border-radius: 28px;
}

.panel header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.help-grid,
.world-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.help-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.help-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(20, 10, 6, 0.28);
  border: 2px solid rgba(232, 195, 106, 0.28);
}

.help-card strong { display: block; margin-bottom: 6px; }

.world-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.world-card {
  text-align: left;
  padding: 16px;
  border-radius: 20px;
  color: #3d220c;
  background: linear-gradient(180deg, #fff1c4, #e2b24a);
  border: 3px solid #5a3010;
  box-shadow: 0 8px 0 #2a1406;
}

.world-card h3 {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: 22px;
}

.world-card p { margin: 6px 0 0; color: #6a4018; }

.world-card:disabled {
  cursor: not-allowed;
  filter: grayscale(0.45) brightness(0.82);
}

.world-card.open:hover { transform: translateY(-3px); }

.play { min-height: 100dvh; }

#stage {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  display: block;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  pointer-events: none;
}

.hud button { pointer-events: auto; }

.board {
  border-radius: 16px;
  padding: 8px 12px 10px;
  max-width: min(240px, 40vw);
  background:
    linear-gradient(180deg, rgba(255, 220, 150, 0.14), transparent 40%),
    repeating-linear-gradient(90deg, #6b3a1c 0 14px, #5a2f16 14px 22px);
  border: 3px solid #2a150a;
  box-shadow: 0 6px 0 #140a06;
}

.board.compact h2 {
  margin: 4px 0 0;
  font-size: 15px;
}

.board .tip { display: none; }

.status {
  min-width: 120px;
  text-align: right;
}

.status p { margin: 0 0 4px; font-weight: 800; font-size: 14px; }

.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 7;
  margin: 0;
  padding: 10px 20px;
  border-radius: 999px;
  pointer-events: none;
  background: #2a150a;
  border: 2px solid #c9a056;
}

.result-card {
  position: absolute;
  left: 50%;
  bottom: 8vh;
  transform: translateX(-50%);
  width: min(500px, calc(100% - 36px));
  text-align: center;
  padding: 24px;
  border-radius: 28px;
  z-index: 8;
}

.result-letters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.result-letters span {
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 800;
  background: #8a3a12;
  border: 2px solid #2a150a;
}

.result-score {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: 42px;
  color: var(--gold);
}

@media (max-width: 720px) {
  .help-grid { grid-template-columns: 1fr; }
  .title-stack { left: 16px; top: 18px; }
  .hud { padding: 12px; }
  .mission-tip { display: none; }
}
