:root {
  --ink: #2a2118;
  --cream: #f7f1e4;
  --gold: #e2b15a;
  --green: #1e3a2c;
  --leaf: #2f6b45;
  color: var(--ink);
  font-family: Nunito, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; overflow: hidden; background: #102018; }
button, input { font: inherit; }
canvas#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#hud, #overlay { position: absolute; inset: 0; pointer-events: none; }
#hud > *, #overlay > * { pointer-events: auto; }
.hidden { display: none !important; }

.topbar, .compass, .mini-wrap, .pad, .mute {
  position: absolute;
  color: var(--cream);
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.topbar {
  top: 12px; left: 12px; right: 180px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.pill {
  background: rgba(20, 32, 24, .78);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
}
.hearts { color: #ffb4c0; letter-spacing: 2px; }
.compass {
  left: 12px; bottom: 12px; max-width: min(440px, calc(100% - 200px));
  background: rgba(20, 32, 24, .82);
  border-radius: 16px;
  padding: 10px 14px;
  line-height: 1.35;
}
.mini-wrap { top: 12px; right: 12px; }
.mini-wrap canvas {
  width: 148px; height: 148px; border-radius: 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.28);
  cursor: pointer; background: #142018;
}
.mini-wrap span { display: block; text-align: center; font-size: 12px; font-weight: 800; margin-top: 4px; }
.pad {
  right: 14px; bottom: 14px;
  display: grid; grid-template-columns: 64px 64px 64px; grid-template-rows: 64px 64px 64px;
  gap: 6px;
}
.pad button, .textbtn, .choice, .big {
  border: 0; border-radius: 16px; cursor: pointer; font-weight: 800;
}
.pad button {
  background: rgba(247, 241, 228, .92); color: var(--ink); font-size: 22px;
}
.pad .up { grid-column: 2; grid-row: 1; }
.pad .left { grid-column: 1; grid-row: 2; }
.pad .down { grid-column: 2; grid-row: 3; }
.pad .right { grid-column: 3; grid-row: 2; }
.pad .mapbtn { grid-column: 3; grid-row: 1; font-size: 13px; background: #f2c14b; }
.mute {
  left: 12px; top: 64px; border: 0; border-radius: 999px; padding: 8px 12px;
  background: rgba(20,32,24,.78); color: var(--cream); font-weight: 800; cursor: pointer;
}

#overlay { display: grid; place-items: center; padding: 18px; }
.card {
  width: min(720px, 100%);
  max-height: calc(100% - 12px);
  overflow: auto;
  background: var(--cream);
  color: var(--ink);
  border-radius: 28px;
  padding: 22px 22px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.card h1, .card h2 { font-family: Fraunces, Georgia, serif; margin: 0 0 8px; line-height: 1.05; }
.card p { font-size: 1.12rem; line-height: 1.45; }
.kicker { letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; font-weight: 800; color: var(--leaf); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.big, .textbtn {
  background: var(--leaf); color: white; padding: 14px 18px; font-size: 1.05rem;
}
.textbtn.alt { background: transparent; color: var(--ink); border: 2px solid #d9cbb3; }
.heroes, .grades { display: grid; gap: 10px; }
.heroes { grid-template-columns: repeat(3, 1fr); }
.grades { grid-template-columns: 1fr; }
.choice {
  text-align: left; background: white; color: var(--ink); padding: 10px; border: 2px solid transparent;
}
.choice.rec { border-color: var(--gold); background: #fff8e8; }
.choice img { width: 100%; height: 180px; object-fit: cover; object-position: top; border-radius: 14px; display: block; }
.choice strong { display: block; margin-top: 8px; font-family: Fraunces, Georgia, serif; font-size: 1.25rem; }
.choice small { display: block; color: #5c5146; }
.namebox { width: 100%; padding: 12px 14px; border-radius: 14px; border: 2px solid #e4d8c4; margin: 8px 0 14px; }
.q { font-family: Fraunces, Georgia, serif; font-size: clamp(1.45rem, 3vw, 2rem); margin: 8px 0 14px; }
.answers { display: grid; gap: 8px; }
.answers button {
  text-align: left; padding: 16px 16px; border-radius: 16px; border: 2px solid #eadfce;
  background: white; font-size: 1.15rem; font-weight: 800; cursor: pointer;
}
.answers button.good { background: #d9f5df; border-color: #2f6b45; }
.answers button.bad { background: #ffe1d6; border-color: #b85a38; }
.portrait {
  width: 120px; height: 150px; object-fit: cover; object-position: top; border-radius: 18px; float: right; margin-left: 12px;
}
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-weight: 800; font-size: .95rem; }
.swatch { width: 12px; height: 12px; border-radius: 99px; display: inline-block; margin-right: 6px; }
#fullmap { width: min(100%, 340px); height: auto; background: #142018; border-radius: 16px; display: block; }
.card > .big { position: sticky; bottom: 0; }
@media (max-width: 720px) {
  .heroes { grid-template-columns: 1fr; }
  .choice img { height: 140px; }
  .topbar { right: 12px; }
  .mini-wrap canvas { width: 112px; height: 112px; }
  .compass { max-width: calc(100% - 210px); font-size: .92rem; }
  .pad { grid-template-columns: 54px 54px 54px; grid-template-rows: 54px 54px 54px; }
}
