/* JTMDAI Quest public build — the visual identity (Pantheon, grounded sci-fi).
   No inline styles anywhere: CSP style-src 'self' is enforced. */

:root {
  --bg: #04222a;
  --bg-deep: #03161c;
  --teal: #2fd6d6;
  --teal-dim: rgba(47, 214, 214, .35);
  --orange: #ff9a3c;
  --amber: #ffcf8a;
  --ink: #e8fbff;
  --muted: #7fb3d0;
  --panel: rgba(8, 16, 20, .88);
  --panel-border: rgba(32, 214, 214, .45);
  --rose: #e97a72;
  --mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
}

#world {
  position: fixed;
  inset: 0;
  display: block;
  cursor: crosshair;
}

/* ---------- minimap ---------- */
#minimap {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 168px;
  height: 112px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: rgba(4, 20, 26, .72);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
  cursor: pointer;
  backdrop-filter: blur(4px);
}

/* ---------- search ---------- */
.search {
  position: fixed;
  top: 14px;
  left: 14px;
  width: min(300px, calc(100vw - 210px));
}

#search-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: rgba(8, 16, 20, .88);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
  backdrop-filter: blur(4px);
}

#search-input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(47, 214, 214, .18); }

#search-input::placeholder { color: var(--muted); }

.search-results {
  margin-top: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  background: rgba(8, 16, 20, .94);
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}

.search-hit {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: none;
  border-bottom: 1px solid rgba(47, 214, 214, .12);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.search-hit:last-child { border-bottom: none; }

.search-hit:hover, .search-hit.selected { background: rgba(47, 214, 214, .12); }

.search-hit .sh-id { color: var(--orange); font-weight: 600; }

.search-empty {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- hud ---------- */
.hud {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
  font-size: 12px;
}

.hud-world {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}

.hud-hint {
  color: var(--muted);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .8);
}

/* ---------- inspector ---------- */
.panel {
  position: fixed;
  right: 16px;
  top: 16px;
  bottom: 16px;
  width: min(360px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 18px 16px 16px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.55;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
  backdrop-filter: blur(6px);
}

.panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--teal-dim);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.panel-close:hover { color: var(--ink); border-color: var(--teal); }

.hidden { display: none !important; }

.insp-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  padding-right: 24px;
  word-break: break-word;
}

.insp-id {
  color: var(--orange);
  font-weight: 600;
  margin-top: 2px;
  word-break: break-all;
}

.insp-field {
  margin-top: 14px;
}

.insp-label {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.insp-value {
  margin-top: 3px;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.insp-actions { margin-top: 16px; }

.btn-go {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid rgba(255, 154, 60, .45);
  border-radius: 9px;
  background: rgba(255, 154, 60, .1);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

.btn-go:hover { background: rgba(255, 154, 60, .2); border-color: var(--orange); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip {
  border: 1px solid var(--teal-dim);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--teal);
  background: rgba(47, 214, 214, .06);
}

.chip.orange {
  color: var(--orange);
  border-color: rgba(255, 154, 60, .4);
  background: rgba(255, 154, 60, .07);
}

/* ---------- welcome ---------- */
.welcome {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 22px;
  background: radial-gradient(ellipse at 50% 40%, rgba(15, 94, 102, .55), rgba(3, 22, 28, .97) 70%);
  padding: 24px;
  text-align: center;
  z-index: 5;
}

.welcome-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--ink);
  text-transform: uppercase;
}

.welcome-sub {
  color: var(--amber);
  font-weight: 600;
  margin-top: 6px;
  font-size: 14px;
}

.welcome-copy {
  max-width: 480px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.welcome-controls {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}

.welcome-controls b { color: var(--teal); font-weight: 700; }

.btn-start {
  padding: 12px 34px;
  border: 1px solid var(--orange);
  border-radius: 12px;
  background: rgba(255, 154, 60, .14);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .05em;
  cursor: pointer;
}

.btn-start:hover { background: rgba(255, 154, 60, .28); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 12.5px;
  color: var(--ink);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
  max-width: min(560px, calc(100vw - 40px));
  text-align: center;
  z-index: 6;
}

.toast.bad { border-color: var(--rose); color: var(--rose); }

/* ---------- party ---------- */
.party {
  position: fixed;
  left: 14px;
  bottom: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.party-count {
  color: var(--amber);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .06em;
}

.party-bar {
  width: 130px;
  height: 6px;
  border-radius: 4px;
  background: rgba(47, 214, 214, .15);
  overflow: hidden;
}

.party-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #2fd6d6, #ff9a3c);
}

.party-toggle {
  border: 1px solid var(--teal-dim);
  border-radius: 8px;
  background: rgba(8, 16, 20, .8);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 9px;
  cursor: pointer;
}

.party-toggle:hover { border-color: var(--teal); }

.party-list {
  position: fixed;
  left: 14px;
  bottom: 74px;
  width: min(280px, calc(100vw - 28px));
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
  backdrop-filter: blur(4px);
}

.party-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(47, 214, 214, .1);
}

.party-row:last-child { border-bottom: none; }

.party-row .pr-name { color: var(--ink); }

.party-row .pr-layer { color: var(--muted); }

/* ---------- battle ---------- */
.battle {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid rgba(255, 154, 60, .5);
  border-radius: 14px;
  padding: 20px 20px 18px;
  box-shadow: 0 12px 60px rgba(0, 0, 0, .65);
  backdrop-filter: blur(8px);
  z-index: 4;
}

.bt-title {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 700;
}

.bt-name {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
  word-break: break-word;
}

.bt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.bt-who {
  width: 92px;
  font-size: 11px;
  color: var(--muted);
}

.bt-bar {
  flex: 1;
  height: 10px;
  border-radius: 6px;
  background: rgba(47, 214, 214, .12);
  overflow: hidden;
}

.bt-fill {
  height: 100%;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #2fd6d6, #7fe8e8);
}

.bt-fill.you { background: linear-gradient(90deg, #ff9a3c, #ffcf8a); }

.bt-fill.hurt { background: linear-gradient(90deg, #e97a72, #ffb3ad); }

.bt-question {
  margin-top: 16px;
  color: var(--amber);
  font-size: 13.5px;
  line-height: 1.6;
}

.bt-options {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bt-opt {
  width: 100%;
  text-align: left;
  padding: 10px 13px;
  border: 1px solid var(--teal-dim);
  border-radius: 10px;
  background: rgba(47, 214, 214, .05);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
  cursor: pointer;
  word-break: break-word;
}

.bt-opt:hover { background: rgba(47, 214, 214, .14); border-color: var(--teal); }

.bt-opt.right { border-color: #2fd6d6; background: rgba(47, 214, 214, .18); color: #d9fffb; }

.bt-opt.wrong { border-color: var(--rose); background: rgba(233, 122, 114, .15); color: #ffd9d5; }

.bt-opt:disabled { cursor: default; opacity: .85; }

.bt-log {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}

.bt-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.btn-close-battle {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--teal-dim);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

.btn-close-battle:hover { color: var(--ink); border-color: var(--teal); }

/* ---------- objective ---------- */
.objective {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 360px));
  background: rgba(8, 16, 20, .82);
  border: 1px solid rgba(255, 154, 60, .4);
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 11.5px;
  color: var(--amber);
  text-align: center;
  letter-spacing: .04em;
  pointer-events: none;
  backdrop-filter: blur(4px);
  z-index: 3;
}

/* ---------- notes ---------- */
.notes {
  position: fixed;
  right: 14px;
  bottom: 74px;
  width: min(300px, calc(100vw - 28px));
  max-height: 240px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  backdrop-filter: blur(4px);
}

.notes-row {
  padding: 4px 0;
  border-bottom: 1px solid rgba(47, 214, 214, .1);
  color: var(--muted);
  word-break: break-word;
}

.notes-row:last-child { border-bottom: none; }

.notes-empty { color: var(--muted); }

/* ---------- battle powers ---------- */
.bt-powers {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.bt-power {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--teal-dim);
  border-radius: 8px;
  background: rgba(47, 214, 214, .05);
  color: var(--teal);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.bt-power:hover { border-color: var(--teal); background: rgba(47, 214, 214, .12); }

.bt-power.used { opacity: .35; cursor: default; }

.bt-powhint {
  margin-top: 6px;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.bt-opt.dim { opacity: .18; }

/* ---------- FF battle: menus + sprite portrait ---------- */
.bt-sprite {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background-size: cover;
  background-position: center;
  margin-top: 10px;
}

.bt-menu {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.bt-menu-item {
  flex: 1;
  min-width: 104px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 154, 60, .4);
  border-radius: 9px;
  background: rgba(255, 154, 60, .07);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  cursor: pointer;
}

.bt-menu-item:hover { background: rgba(255, 154, 60, .18); border-color: var(--orange); }

.bt-menu-item:disabled { opacity: .4; cursor: default; }

/* ---------- v6: dialogue, quests, treasures ---------- */
.dialogue {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%);
  width: min(620px, calc(100vw - 32px));
  background: rgba(6, 18, 24, .94);
  border: 1px solid rgba(255, 154, 60, .5);
  border-radius: 12px;
  padding: 16px 20px 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  box-shadow: 0 10px 44px rgba(0, 0, 0, .65);
  z-index: 5;
  backdrop-filter: blur(6px);
}

.dialogue-hint {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

.quest-row {
  padding: 8px 2px;
  border-bottom: 1px solid rgba(47, 214, 214, .12);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.quest-row:last-child { border-bottom: none; }

.quest-main { flex: 1; }

.quest-name { color: var(--amber); font-weight: 700; font-size: 12px; }

.quest-desc { color: var(--muted); font-size: 11px; margin-top: 2px; }

.quest-prog { color: var(--teal); font-size: 10.5px; margin-top: 2px; letter-spacing: .04em; }

.quest-claim {
  border: 1px solid rgba(255, 154, 60, .5);
  border-radius: 7px;
  background: rgba(255, 154, 60, .1);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 10px;
  padding: 5px 9px;
  cursor: pointer;
  white-space: nowrap;
}

.quest-claim:disabled { opacity: .35; cursor: default; }

.treasure-row { color: #ffd9a0; font-size: 11.5px; padding: 3px 0; }

/* ---------- v7: the cockpit side panel ---------- */
.cockpit {
  position: fixed;
  right: 14px;
  top: 14px;
  bottom: 14px;
  width: min(380px, calc(100vw - 28px));
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 10px 48px rgba(0, 0, 0, .6);
  backdrop-filter: blur(8px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cockpit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px 8px;
}

.cockpit-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .18em;
  color: var(--orange);
}

.cockpit-nav {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
  flex-wrap: wrap;
}

.cockpit-tab {
  flex: 1;
  min-width: 58px;
  padding: 6px 4px;
  border: 1px solid var(--teal-dim);
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .08em;
  cursor: pointer;
}

.cockpit-tab.active {
  color: var(--ink);
  border-color: var(--orange);
  background: rgba(255, 154, 60, .12);
}

#cockpit-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 16px;
  font-size: 12px;
}

.cp-head {
  margin: 10px 0 6px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--orange);
}

.cp-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(47, 214, 214, .14);
  border-radius: 9px;
  margin-bottom: 6px;
  background: rgba(47, 214, 214, .04);
}

.cp-row.active { border-color: rgba(255, 154, 60, .45); background: rgba(255, 154, 60, .06); }

.cp-row.selected { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255, 154, 60, .25); }

.cp-left { flex: 1; }

.cp-name { color: var(--ink); font-weight: 700; word-break: break-word; }

.cp-sub { color: var(--muted); font-size: 10.5px; margin-top: 2px; }

.cp-right { text-align: right; }

.cp-stat { color: var(--teal); font-size: 10.5px; line-height: 1.5; }

.cp-empty { color: var(--muted); font-size: 11.5px; padding: 6px 2px; line-height: 1.6; }
