/* =========================================================
   GOKULDHAM OPEN WORLD — UI
   ========================================================= */
:root {
  --ink: #17130d;
  --ink-2: #221b12;
  --cream: #f8eed8;
  --cream-dim: #cbbfa7;
  --gold: #e9b955;
  --gold-bright: #ffd77a;
  --saffron: #ef8a3d;
  --green: #2f5c48;
  --green-deep: #14231c;
  --maroon: #8f3030;
  --line: rgba(233, 185, 85, 0.3);
  --glass: rgba(16, 22, 18, 0.82);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
  --radius: 18px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b100d;
  color: var(--cream);
  font-family: 'Baloo 2', 'Noto Sans Devanagari', 'Segoe UI', sans-serif;
  user-select: none;
}

button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

#app { position: fixed; inset: 0; }

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(6, 9, 7, 0.45) 100%);
}

/* ---------------- loading ---------------- */
#loading {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: radial-gradient(circle at 50% 38%, #22382b 0%, #101713 55%, #080b09 100%);
  transition: opacity 0.35s ease;
}
#loading.hidden { display: flex !important; opacity: 0; pointer-events: none; }
.load-emblem {
  width: 86px; height: 86px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; color: #3b2a12; font-weight: 800;
  background: linear-gradient(160deg, #ffe8a8, #e3a83f);
  box-shadow: 0 0 0 4px rgba(233, 185, 85, 0.22), 0 0 46px rgba(233, 185, 85, 0.35);
}
.load-title { font-size: 34px; font-weight: 800; letter-spacing: 0.18em; color: var(--gold-bright); }
.load-sub { font-size: 13px; color: var(--cream-dim); letter-spacing: 0.06em; }
.load-bar { width: 210px; height: 4px; border-radius: 9px; background: rgba(255,255,255,0.12); overflow: hidden; margin-top: 10px; }
.load-bar span { display: block; height: 100%; width: 40%; border-radius: 9px; background: linear-gradient(90deg, var(--saffron), var(--gold-bright)); animation: loading 1.1s ease-in-out infinite; }
@keyframes loading { 0% { transform: translateX(-110%); } 100% { transform: translateX(360%); } }

/* ---------------- fade ---------------- */
#fade {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #060a07;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
#fade.show { opacity: 1; pointer-events: all; }

/* =========================================================
   START SCREEN
   ========================================================= */
#start-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: minmax(420px, 46%) 1fr;
  background: linear-gradient(100deg,
      rgba(7, 11, 8, 0.97) 0%,
      rgba(8, 13, 9, 0.95) 34%,
      rgba(8, 13, 9, 0.78) 45%,
      rgba(8, 13, 9, 0.22) 58%,
      rgba(8, 13, 9, 0) 70%);
}

.start-panel {
  height: 100vh;
  overflow-y: auto;
  padding: 28px clamp(20px, 2.8vw, 42px) 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(233,185,85,0.35) transparent;
}
.start-panel::-webkit-scrollbar { width: 8px; }
.start-panel::-webkit-scrollbar-thumb { background: rgba(233,185,85,0.3); border-radius: 8px; }

.start-eyebrow {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(248, 238, 216, 0.55);
  font-weight: 600;
  text-transform: uppercase;
}
.start-title {
  font-size: clamp(48px, 5.4vw, 78px);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--cream);
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.6);
}
.start-title span { color: var(--gold-bright); }
.start-sub {
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--gold);
  font-weight: 700;
  margin-top: 4px;
}
.start-note {
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(248, 238, 216, 0.78);
  max-width: 520px;
  margin: 6px 0 6px;
}
.start-note b { color: var(--gold-bright); }

.start-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--cream-dim);
  font-weight: 700;
  border-bottom: 1px solid rgba(233, 185, 85, 0.18);
  padding-bottom: 7px;
  margin-top: 2px;
}
.start-section-head span:last-child {
  background: rgba(233, 185, 85, 0.15);
  color: var(--gold-bright);
  border-radius: 20px;
  padding: 1px 9px;
  font-size: 11px;
}

.char-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 7px;
  max-height: 306px;
  overflow-y: auto;
  padding: 2px 4px 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(233,185,85,0.3) transparent;
}
.char-grid::-webkit-scrollbar { width: 6px; }
.char-grid::-webkit-scrollbar-thumb { background: rgba(233,185,85,0.3); border-radius: 6px; }

.char-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  border-radius: 11px;
  padding: 3px;
  color: var(--cream);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.char-card canvas { width: 100%; height: auto; border-radius: 8px; display: block; }
.char-card .char-name {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 1px 1px 2px;
  text-align: center;
  color: rgba(248, 238, 216, 0.82);
}
.char-card:hover { border-color: rgba(233, 185, 85, 0.55); background: rgba(233, 185, 85, 0.1); transform: translateY(-2px); }
.char-card.selected {
  border-color: var(--gold-bright);
  background: rgba(233, 185, 85, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 215, 122, 0.6), 0 8px 20px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}
.char-card.selected .char-name { color: #fff3d4; }

.selected-info {
  border: 1px solid rgba(233, 185, 85, 0.22);
  background: linear-gradient(100deg, rgba(233, 185, 85, 0.09), rgba(233, 185, 85, 0.02));
  border-radius: 12px;
  padding: 10px 14px;
  margin-top: 4px;
  position: relative;
  overflow: hidden;
}
.selected-info::after {
  content: 'गो';
  position: absolute;
  right: 12px;
  top: -10px;
  font-size: 62px;
  color: rgba(233, 185, 85, 0.08);
  font-weight: 800;
}
.sel-names { display: flex; align-items: baseline; gap: 9px; }
.sel-names h2 { font-size: 23px; font-weight: 800; color: var(--gold-bright); line-height: 1; }
.sel-names span { font-size: 13px; color: rgba(248, 238, 216, 0.55); font-family: 'Noto Sans Devanagari', sans-serif; }
#sel-role { font-size: 11.5px; color: var(--saffron); letter-spacing: 0.05em; margin-top: 1px; }
.sel-line { font-size: 12.5px; color: rgba(248, 238, 216, 0.75); margin-top: 4px; font-style: italic; }

.play-btn {
  margin-top: 8px;
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #2d1d08;
  background: linear-gradient(135deg, #ffe19a 0%, #efb14a 55%, #e0912f 100%);
  box-shadow: 0 6px 0 #8f5c1b, 0 14px 30px rgba(0, 0, 0, 0.4);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.play-btn span { font-size: 13px; }
.play-btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.play-btn:active { transform: translateY(5px); box-shadow: 0 1px 0 #8f5c1b; }

.start-hint {
  font-size: 10.5px;
  color: rgba(248, 238, 216, 0.5);
  text-align: center;
  line-height: 1.5;
}
.start-legal { font-size: 9.5px; color: rgba(248, 238, 216, 0.28); text-align: center; }

.start-stage-note {
  align-self: end;
  justify-self: end;
  margin: 0 30px 24px 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255, 246, 220, 0.82);
  background: rgba(11, 16, 12, 0.55);
  border: 1px solid rgba(233, 185, 85, 0.35);
  border-radius: 30px;
  padding: 7px 16px;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 8px;
}
.start-stage-note em { font-style: normal; color: rgba(248, 238, 216, 0.5); border-left: 1px solid rgba(255,255,255,0.16); padding-left: 8px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #74d38f; box-shadow: 0 0 8px #74d38f; animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* =========================================================
   HUD
   ========================================================= */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#hud button, #minimap-wrap, .quest-panel { pointer-events: auto; }

.hud-top-left {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 322px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(100deg, rgba(13, 19, 15, 0.78), rgba(13, 19, 15, 0.42));
  border: 1px solid rgba(233, 185, 85, 0.18);
  border-radius: 14px;
  padding: 8px 13px;
  backdrop-filter: blur(10px);
  width: fit-content;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #3a2910; font-size: 20px; font-weight: 800;
  background: linear-gradient(150deg, #ffe6a1, #db9f36);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.3);
}
.brand-text h1 { font-size: 18px; letter-spacing: 0.11em; line-height: 1; color: var(--cream); font-weight: 800; }
.brand-text p { font-size: 8px; letter-spacing: 0.14em; color: rgba(233,185,85,0.85); margin-top: 3px; }

.status-row { display: flex; gap: 7px; align-items: center; }
.status-pill {
  background: var(--glass);
  border: 1px solid rgba(233, 185, 85, 0.2);
  border-radius: 11px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
}
.clock-pill { letter-spacing: 0.02em; }
.clock-pill span:last-child {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--saffron);
  background: rgba(239, 138, 61, 0.13);
  border-radius: 6px;
  padding: 1px 6px;
}
.points-pill { color: var(--gold-bright); font-variant-numeric: tabular-nums; }

/* quests */
.quest-panel {
  background: linear-gradient(160deg, rgba(15, 21, 17, 0.88), rgba(13, 18, 15, 0.72));
  border: 1px solid rgba(233, 185, 85, 0.19);
  border-radius: 14px;
  padding: 9px 10px 8px;
  backdrop-filter: blur(11px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  max-width: 322px;
}
.quest-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 9px; letter-spacing: 0.16em; color: rgba(233,185,85,0.85);
  font-weight: 700; padding: 0 2px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.quest-count { font-size: 10px; color: var(--cream-dim); letter-spacing: 0.04em; }
.quest-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
}
.quest-row:last-child { border-bottom: none; padding-bottom: 2px; }
.quest-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 8px currentColor; }
.quest-main { flex: 1; min-width: 0; }
.quest-name { font-size: 11.5px; font-weight: 700; color: rgba(248,238,216,0.9); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest-sub { font-size: 9.5px; color: rgba(248,238,216,0.45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: -1px; }
.quest-right { font-size: 10.5px; font-weight: 700; color: var(--cream-dim); font-variant-numeric: tabular-nums; }
.quest-row.active .quest-name { color: var(--cream); }
.quest-row.ready .quest-sub { color: #8fe0a9; }
.quest-row.ready .quest-right { color: #8fe0a9; font-size: 14px; }
.quest-row.done { opacity: 0.55; }
.quest-row.done .quest-name { text-decoration: line-through; }
.quest-row.done .quest-right { color: #8fe0a9; }
.quest-ping {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border-radius: 50%;
  background: var(--gold); color: #3a2413; font-size: 12px; font-weight: 800;
  animation: pulse 1.6s infinite;
}

/* minimap */
.hud-top-right {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
#minimap-wrap {
  width: 186px;
  background: rgba(13, 19, 15, 0.78);
  border: 1px solid rgba(233, 185, 85, 0.28);
  border-radius: 16px;
  padding: 7px 7px 4px;
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
#minimap-wrap:hover { border-color: rgba(233, 185, 85, 0.65); }
#minimap { width: 172px; height: 172px; display: block; border-radius: 11px; }
.minimap-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 8px; letter-spacing: 0.14em; color: rgba(248,238,216,0.52);
  padding: 5px 3px 2px;
}
.minimap-label b {
  color: #2a1d0b; background: var(--gold); border-radius: 4px;
  padding: 0 5px; font-size: 9px;
}
.top-buttons { display: flex; gap: 7px; }
.top-buttons button {
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid rgba(233, 185, 85, 0.26);
  background: rgba(13, 19, 15, 0.78);
  color: var(--cream);
  font-size: 16px;
  backdrop-filter: blur(8px);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.top-buttons button:hover { background: rgba(233, 185, 85, 0.18); border-color: rgba(233,185,85,0.6); }

/* prompt + toasts */
#prompt {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  background: linear-gradient(120deg, rgba(16, 23, 18, 0.94), rgba(19, 27, 21, 0.88));
  border: 1px solid rgba(233, 185, 85, 0.45);
  border-radius: 40px;
  padding: 9px 18px 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--cream);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  z-index: 12;
  white-space: nowrap;
  animation: promptIn 0.18s ease;
}
@keyframes promptIn { from { opacity: 0; transform: translate(-50%, 6px); } to { opacity: 1; transform: translate(-50%, 0); } }
#prompt b { color: var(--gold-bright); font-weight: 800; }
.keycap {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 23px; height: 23px; padding: 0 5px;
  border-radius: 6px; background: var(--gold); color: #33210b;
  font-weight: 800; font-size: 12px; margin-right: 7px;
  box-shadow: 0 2px 0 #8c5e1d;
}
.prompt-quest {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--gold); color: #3a2413; font-weight: 800;
  font-size: 13px; margin-left: 5px; vertical-align: -4px;
}
.prompt-quest.ready { background: #68cf8d; color: #10351f; }

#toasts {
  position: fixed;
  left: 50%;
  bottom: 158px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  z-index: 14;
  pointer-events: none;
  width: min(560px, 92vw);
}
.toast {
  max-width: 100%;
  background: rgba(16, 23, 18, 0.94);
  border: 1px solid rgba(233, 185, 85, 0.3);
  border-left: 4px solid var(--gold);
  color: var(--cream);
  border-radius: 11px;
  padding: 8px 15px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(9px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
}
.toast.in { opacity: 1; transform: translateY(0); }
.toast.success { border-left-color: #63cf8b; }
.toast.warning { border-left-color: #f0b24c; }
.toast.info { border-left-color: #6cb7de; }

.hud-hint {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.03em;
  color: rgba(248, 238, 216, 0.42);
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* =========================================================
   DIALOGUE
   ========================================================= */
#dialog {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  width: min(780px, 94vw);
  z-index: 35;
  animation: dialogIn 0.22s ease;
}
@keyframes dialogIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.dialog-card {
  display: flex;
  gap: 15px;
  padding: 14px;
  border-radius: 20px;
  background: linear-gradient(125deg, rgba(20, 28, 22, 0.97), rgba(12, 17, 14, 0.96));
  border: 1px solid rgba(233, 185, 85, 0.42);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}
.portrait-wrap {
  position: relative;
  width: 116px;
  height: 116px;
  flex: 0 0 auto;
  border-radius: 15px;
  overflow: hidden;
  border: 1px solid rgba(233, 185, 85, 0.4);
  background: #101713;
}
#dialog-portrait { width: 100%; height: 100%; display: block; }
.portrait-glow {
  position: absolute; inset: 0;
  box-shadow: inset 0 -26px 30px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.dialog-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.dialog-head h3 { font-size: 20px; line-height: 1; color: var(--gold-bright); font-weight: 800; letter-spacing: 0.01em; }
.dialog-head p { font-size: 10.5px; color: rgba(239, 138, 61, 0.9); letter-spacing: 0.05em; margin-top: 2px; }
.dialog-badge {
  font-size: 7.5px; letter-spacing: 0.16em; color: rgba(248,238,216,0.4);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 3px 8px;
  flex: 0 0 auto; margin-top: 2px;
}
#dialog-text {
  font-size: 14.5px;
  line-height: 1.45;
  color: rgba(248, 238, 216, 0.92);
  min-height: 44px;
  margin: 9px 0 6px;
  letter-spacing: 0.005em;
}
.dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.dialog-hint { font-size: 9.5px; color: rgba(248,238,216,0.35); letter-spacing: 0.04em; }
.next-btn {
  border: 1px solid rgba(233, 185, 85, 0.45);
  background: rgba(233, 185, 85, 0.14);
  color: var(--gold-bright);
  border-radius: 9px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.15s ease;
}
.next-btn:hover { background: rgba(233, 185, 85, 0.25); }
.choices { display: flex; gap: 8px; margin: 4px 0 8px; flex-wrap: wrap; }
.choice-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--cream);
  border-radius: 9px;
  padding: 7px 15px;
  font-size: 12.5px;
  font-weight: 700;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.choice-btn:hover { background: rgba(255,255,255,0.12); }
.choice-btn.primary {
  background: linear-gradient(135deg, #ffe19a, #e8ad45);
  border-color: #ffe6a8;
  color: #33210b;
  box-shadow: 0 3px 0 #8c5e1d;
}
.choice-btn.primary:hover { filter: brightness(1.05); }

/* =========================================================
   OVERLAYS
   ========================================================= */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(7, 11, 8, 0.72);
  backdrop-filter: blur(9px);
  animation: overlayIn 0.2s ease;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }

/* big map */
.map-card {
  width: min(950px, 96vw);
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(160deg, #1b261f, #121a15);
  border: 1px solid rgba(233, 185, 85, 0.36);
  border-radius: 22px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.map-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.map-eyebrow { font-size: 8.5px; letter-spacing: 0.18em; color: var(--saffron); font-weight: 700; }
.map-head h2 { font-size: 24px; letter-spacing: 0.06em; color: var(--gold-bright); line-height: 1.05; }
.map-head p { font-size: 10.5px; color: rgba(248,238,216,0.5); margin-top: 2px; }
.map-head button {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 auto;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: var(--cream); font-size: 15px;
}
.map-head button:hover { background: rgba(255,255,255,0.12); }
.map-canvas-wrap { flex: 1; min-height: 0; display: flex; justify-content: center; align-items: center; }
#big-map-canvas {
  width: min(100%, 68vh);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1px solid rgba(233, 185, 85, 0.25);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.35);
}
.map-legend {
  display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center;
  font-size: 10px; color: rgba(248,238,216,0.65);
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend-tip { margin-left: auto; color: rgba(248,238,216,0.35); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.gold { background: #ffd166; box-shadow: 0 0 6px rgba(255,209,102,0.8); }
.dot.white { background: rgba(240,240,230,0.85); }
.dot.player { background: #ffe9a8; border: 1px solid #2b2415; }
.dot.item { background: #e94f6d; }

/* pause */
.pause-card {
  width: min(420px, 92vw);
  background: linear-gradient(165deg, #1d2a22, #111814);
  border: 1px solid rgba(233, 185, 85, 0.36);
  border-radius: 22px;
  padding: 26px 24px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: stretch;
}
.pause-emblem {
  width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 2px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, #ffe6a1, #db9f36);
  color: #3a2910; font-size: 26px; font-weight: 800;
  box-shadow: 0 0 0 4px rgba(233,185,85,0.13);
}
.pause-card h2 { font-size: 30px; letter-spacing: 0.16em; color: var(--gold-bright); line-height: 1; }
.pause-card > p { font-size: 12.5px; color: rgba(248,238,216,0.6); }
.pause-stats { display: flex; gap: 8px; margin: 8px 0 4px; }
.pause-stats > div {
  flex: 1; background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.07);
  border-radius: 11px; padding: 9px 4px; display: flex; flex-direction: column; gap: 1px;
}
.pause-stats b { font-size: 18px; color: var(--gold-bright); }
.pause-stats span { font-size: 8.5px; letter-spacing: 0.1em; color: rgba(248,238,216,0.4); text-transform: uppercase; }
.btn {
  border: 1px solid rgba(233,185,85,0.3);
  background: rgba(233,185,85,0.1);
  color: var(--cream);
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: rgba(233,185,85,0.18); }
.btn.primary {
  background: linear-gradient(135deg, #ffe19a, #e8ad45);
  border-color: #ffe6a8;
  color: #33210b;
  box-shadow: 0 4px 0 #8c5e1d;
}
.btn.primary:hover { filter: brightness(1.05); }
.btn.primary:active { transform: translateY(3px); box-shadow: none; }
.btn.ghost { background: transparent; border-color: rgba(255,255,255,0.1); color: rgba(248,238,216,0.6); }
.pause-hint { font-size: 9px; color: rgba(248,238,216,0.32); margin-top: 2px; }

/* ending */
.ending-card {
  width: min(560px, 94vw);
  max-height: 94vh;
  overflow-y: auto;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(233,185,85,0.22), transparent 52%),
    linear-gradient(170deg, #24352a, #121a15 62%);
  border: 1px solid rgba(233, 185, 85, 0.5);
  border-radius: 26px;
  padding: 22px 30px 24px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.ending-burst { font-size: 34px; line-height: 1; }
.ending-eyebrow { font-size: 8.5px; letter-spacing: 0.22em; color: var(--saffron); font-weight: 700; margin-top: 2px; }
.ending-card h2 { font-size: 17px; font-weight: 600; color: rgba(248,238,216,0.8); }
.ending-card h1 {
  font-size: clamp(27px, 4vw, 40px);
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  text-shadow: 0 4px 22px rgba(233,185,85,0.28);
  line-height: 1.05;
}
#ending-portrait {
  width: 96px; height: 96px; border-radius: 50%;
  border: 2px solid rgba(233,185,85,0.6);
  margin: 7px 0 4px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.4);
  background: #1a241d;
}
.ending-card > p { font-size: 12.5px; line-height: 1.5; color: rgba(248,238,216,0.7); max-width: 420px; }
.ending-stats { display: flex; gap: 9px; width: 100%; margin: 9px 0 6px; }
.ending-stats > div {
  flex: 1; border: 1px solid rgba(233,185,85,0.18);
  background: rgba(255,255,255,0.045); border-radius: 12px; padding: 8px 4px;
  display: flex; flex-direction: column;
}
.ending-stats b { color: var(--gold-bright); font-size: 18px; }
.ending-stats span { font-size: 8.5px; letter-spacing: 0.1em; color: rgba(248,238,216,0.4); text-transform: uppercase; }
.ending-card .btn { width: 100%; margin-top: 3px; }

/* ---------------- touch controls ---------------- */
#touch-controls { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
#stick {
  position: absolute;
  left: 22px; bottom: 24px;
  width: 128px; height: 128px;
  border-radius: 50%;
  background: rgba(14, 21, 16, 0.42);
  border: 1.5px solid rgba(233,185,85,0.35);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  touch-action: none;
}
#knob {
  position: absolute;
  left: 50%; top: 50%;
  width: 54px; height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe7a8, #dba33e);
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  transition: transform 0.05s linear;
}
.touch-actions {
  position: absolute;
  right: 20px; bottom: 26px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: auto;
}
.touch-actions button {
  width: 58px; height: 58px;
  border-radius: 50%;
  border: 1.5px solid rgba(233,185,85,0.45);
  background: rgba(14, 21, 16, 0.55);
  color: var(--cream);
  font-size: 20px;
  font-weight: 800;
  backdrop-filter: blur(6px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  touch-action: none;
}
.touch-actions button:active, .touch-actions button.active {
  background: rgba(233,185,85,0.35);
  border-color: var(--gold-bright);
}
#btn-act { width: 66px; height: 66px; background: rgba(233,185,85,0.28); color: var(--gold-bright); }
#btn-run { width: 50px; height: 50px; font-size: 17px; }

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .hud-top-left { width: 286px; }
  #minimap-wrap { width: 166px; }
  #minimap { width: 152px; height: 152px; }
  .char-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  #start-screen {
    display: block;
    overflow-y: auto;
    background:
      radial-gradient(circle at 78% 20%, rgba(33, 55, 40, 0.7), transparent 55%),
      linear-gradient(180deg, rgba(8,12,9,0.9), rgba(6,9,7,0.97));
  }
  .start-panel {
    height: auto;
    min-height: 100vh;
    max-width: 560px;
    margin: 0 auto;
    padding: 22px 18px 30px;
    background: linear-gradient(180deg, rgba(8,12,9,0.55), rgba(8,12,9,0.9));
  }
  .start-stage-note { display: none; }
  .char-grid { max-height: 238px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .start-title { font-size: clamp(44px, 12vw, 64px); }
  .hud-top-left { width: 252px; }
  .brand { padding: 7px 10px; }
  .brand-text h1 { font-size: 15px; }
  .brand-mark { width: 32px; height: 32px; font-size: 17px; }
  #quest-list { font-size: 10px; }
  .quest-name { font-size: 10.5px; }
  .quest-sub { font-size: 9px; }
  .status-pill { padding: 5px 9px; font-size: 11.5px; }
  .hud-top-right { top: 12px; right: 12px; }
  #minimap-wrap { width: 138px; padding: 5px 5px 3px; }
  #minimap { width: 126px; height: 126px; }
  .minimap-label { font-size: 6.5px; padding: 4px 2px 1px; }
  .top-buttons button { width: 33px; height: 33px; font-size: 14px; }
  .hud-hint { display: none; }
  #toasts { bottom: 190px; }
  .dialog-card { padding: 11px; gap: 11px; }
  .portrait-wrap { width: 88px; height: 88px; }
  #dialog-text { font-size: 13px; min-height: 54px; }
  .dialog-head h3 { font-size: 17px; }
  .dialog-badge { display: none; }
  #prompt { bottom: 160px; font-size: 12px; }
}

@media (max-width: 620px) {
  .start-panel { padding: 16px 12px 24px; }
  .char-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; max-height: 232px; }
  .start-note { font-size: 12px; }
  .start-legal { font-size: 8.5px; }
  .sel-names h2 { font-size: 20px; }
  .play-btn { font-size: 15px; padding: 12px; }
  .hud-top-left { top: 10px; left: 10px; width: 208px; gap: 6px; }
  .brand { padding: 6px 8px; gap: 7px; border-radius: 11px; }
  .brand-mark { width: 28px; height: 28px; font-size: 14px; }
  .brand-text h1 { font-size: 12.5px; letter-spacing: 0.07em; }
  .brand-text p { font-size: 6.5px; }
  .brand-text p span { display: none; }
  .status-pill { padding: 4px 8px; font-size: 10.5px; border-radius: 8px; }
  .status-pill .clock-pill span:last-child { font-size: 8px; }
  #quest-list.quest-panel { padding: 7px 8px 6px; border-radius: 11px; }
  .quest-head { font-size: 8px; }
  .quest-row { padding: 5px 2px; gap: 6px; }
  .quest-name { font-size: 9.5px; }
  .quest-sub { font-size: 8px; }
  .quest-right { font-size: 9px; }
  .hud-top-right { top: 10px; right: 10px; }
  #minimap-wrap { width: 112px; padding: 4px; border-radius: 12px; }
  #minimap { width: 104px; height: 104px; border-radius: 8px; }
  .minimap-label { font-size: 5.5px; letter-spacing: 0.05em; }
  .minimap-label b { font-size: 7px; padding: 0 3px; }
  .top-buttons { gap: 5px; }
  .top-buttons button { width: 29px; height: 29px; font-size: 12px; border-radius: 8px; }
  #toasts { bottom: 176px; width: 94vw; }
  .toast { font-size: 11px; padding: 7px 11px; }
  #prompt { bottom: 200px; padding: 7px 13px 7px 9px; font-size: 11px; }
  .keycap { min-width: 19px; height: 19px; font-size: 10px; margin-right: 5px; }
  #dialog { bottom: 10px; width: 96vw; }
  .dialog-card { padding: 9px; gap: 9px; border-radius: 15px; }
  .portrait-wrap { width: 64px; height: 64px; border-radius: 10px; }
  .dialog-head h3 { font-size: 15px; }
  .dialog-head p { font-size: 8.5px; }
  #dialog-text { font-size: 11.5px; line-height: 1.4; margin: 5px 0 4px; min-height: 50px; }
  .dialog-hint { display: none; }
  .next-btn { padding: 4px 10px; font-size: 10.5px; }
  .choice-btn { padding: 6px 11px; font-size: 11px; }
  .map-card { padding: 11px; border-radius: 16px; }
  .map-head h2 { font-size: 18px; }
  .map-head p { font-size: 9px; }
  .map-legend { font-size: 8.5px; gap: 8px 12px; }
  .map-legend-tip { display: none; }
  .pause-card { padding: 20px 18px; }
  .pause-card h2 { font-size: 25px; }
  .ending-card { padding: 18px 18px 20px; }
  .ending-card h1 { font-size: 26px; }
  #ending-portrait { width: 82px; height: 82px; }
  .ending-stats b { font-size: 15px; }
  #stick { width: 104px; height: 104px; left: 14px; bottom: 18px; }
  #knob { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  .touch-actions { right: 14px; bottom: 20px; gap: 7px; }
  .touch-actions button { width: 48px; height: 48px; font-size: 16px; }
  #btn-act { width: 58px; height: 58px; font-size: 18px; }
  #btn-run { width: 42px; height: 42px; font-size: 14px; }
}

@media (max-height: 720px) and (min-width: 901px) {
  .start-title { font-size: 46px; }
  .start-note { display: none; }
  .char-grid { max-height: 200px; }
  .start-panel { gap: 7px; padding-top: 18px; }
  .sel-line { display: none; }
  .start-legal { display: none; }
}

.touch-device .hud-hint { display: none; }
