/* Sundered Doctrine · 1st Encounter — Path Planner */

:root {
  --bg:        #09090e;
  --fg:        #e8e6f2;
  --accent:    #b39dff;
  --accent-hi: #d0c4ff;
  --panel:     #0a0a10;
  --panel-2:   #0c0c12;
  --panel-3:   #0e0e16;
  --stage-bg:  #07070b;
  --line:      #212130;
  --line-2:    #22222f;
  --line-3:    #33304a;
  --muted:     #9a95b0;
  --muted-2:   #8b86a3;
  --muted-3:   #a8a3bd;
  --ink:       #07070c;

  --l1: #3498db; --l1-rgb:  52,152,219; --l1-fg: #7fc3ea;
  --l2: #2ecc71; --l2-rgb:  46,204,113; --l2-fg: #6fdc9b;
  --r1: #9b59b6; --r1-rgb: 155, 89,182; --r1-fg: #c18cd8;
  --r2: #e74c3c; --r2-rgb: 231, 76, 60; --r2-fg: #ef8478;

  --stage-min: 0px;
}

*, *::before, *::after { box-sizing: border-box; }

/* Author `display` rules otherwise beat the UA stylesheet's [hidden] { display: none }. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; background: var(--bg); }

body {
  color: var(--fg);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hi); }
::selection { background: rgba(163, 139, 250, .32); }

@keyframes badgePop { from { transform: scale(.6); opacity: 0 } to { transform: scale(1); opacity: 1 } }

/* ---------- layout ---------- */

.app {
  min-height: 100vh;
  padding: clamp(14px, 2.4vw, 30px);
  max-width: 2040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.7vw, 20px);
}

.hd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; }

.hd__title {
  margin: 0;
  font-family: "Patrick Hand", cursive;
  font-weight: 400;
  font-size: clamp(27px, 3.6vw, 42px);
  line-height: 1.05;
  color: var(--accent);
}

.hd__sub {
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #a09ab8;
  padding-bottom: 3px;
}

.cols { display: flex; flex-wrap: wrap; gap: clamp(16px, 1.8vw, 26px); align-items: flex-start; }

.col-main {
  flex: 1 1 440px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.5vw, 18px);
}

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1.4vw, 16px);
  align-items: flex-start;
  justify-content: space-between;
}

.picks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(104px, 100%), 1fr));
  gap: 10px;
  flex: 1 1 300px;
  min-width: 212px;
}

.pick {
  position: relative;
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1.5px solid rgba(var(--c-rgb), .5);
  background-color: rgba(var(--c-rgb), .10);
  color: var(--c-fg);
  font-family: "Patrick Hand", cursive;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .16s, box-shadow .18s, opacity .16s, transform .12s;
}

.pick[data-room="L1"] { --c: var(--l1); --c-rgb: var(--l1-rgb); --c-fg: var(--l1-fg); }
.pick[data-room="L2"] { --c: var(--l2); --c-rgb: var(--l2-rgb); --c-fg: var(--l2-fg); }
.pick[data-room="R1"] { --c: var(--r1); --c-rgb: var(--r1-rgb); --c-fg: var(--r1-fg); }
.pick[data-room="R2"] { --c: var(--r2); --c-rgb: var(--r2-rgb); --c-fg: var(--r2-fg); }

.pick:not(:disabled):hover { transform: translateY(-2px); }
.pick:not(:disabled):active { transform: translateY(0); }

.pick.is-on {
  background-color: rgba(var(--c-rgb), .24);
  box-shadow: inset 0 0 0 1.5px var(--c), 0 10px 30px -14px var(--c);
}

.pick:disabled {
  background-color: rgba(var(--c-rgb), .05);
  opacity: .3;
  cursor: not-allowed;
}

.pick__dot { width: 11px; height: 11px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }

.pick__badge {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--c);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: badgePop .2s ease-out;
}

.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.btn-ghost {
  min-height: 58px;
  padding: 0 20px;
  border-radius: 14px;
  border: 1px solid #2c2c3c;
  background: transparent;
  color: #a9a4c0;
  font-size: 14px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .15s, border-color .15s, opacity .15s;
}
.btn-ghost:not(:disabled):hover { color: #efeaff; border-color: #4a4463; }
.btn-ghost:disabled { opacity: .38; cursor: default; }

.zoom {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 14px;
  border: 1px solid var(--line-2);
  background: var(--panel-3);
  min-height: 58px;
}

.zoom__label {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 9px 0 7px;
}

.zoom__btn {
  min-width: 52px;
  min-height: 46px;
  padding: 0 12px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s;
}
.zoom__btn[aria-pressed="true"] { background: rgba(163, 139, 250, .16); color: #c9baff; }

/* ---------- route ---------- */

.route { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 30px; }
.route__label { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.route__empty { font-size: 15px; color: var(--muted-3); }
.route__hint { font-size: 14px; color: var(--muted); margin-left: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px 6px 8px;
  border-radius: 999px;
  font-size: 15px;
  border: 1px solid rgba(var(--c-rgb), .4);
  background: rgba(var(--c-rgb), .12);
  color: var(--c);
}

.chip__num {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  background: var(--c);
}

/* ---------- map ---------- */

.mapwrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--stage-bg);
  overflow: hidden;
}

.viewport {
  width: 100%;
  overflow: auto;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1406 / 970;
  min-width: var(--stage-min);
}

.stage img { display: block; width: 100%; height: 100%; user-select: none; }

.stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hot {
  position: absolute;
  padding: 0;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: transparent;
  font: inherit;
  cursor: pointer;
  transition: background .16s, border-color .16s;
}

.hot--l2 { left: 1%;    top: 3.1%;  width: 20.7%; height: 39.7%; --c: var(--l2); --c-rgb: var(--l2-rgb); }
.hot--r2 { left: 77.9%; top: 3.1%;  width: 21.1%; height: 39.7%; --c: var(--r2); --c-rgb: var(--r2-rgb); }
.hot--l1 { left: 1%;    top: 45.4%; width: 21.4%; height: 36.1%; --c: var(--l1); --c-rgb: var(--l1-rgb); }
.hot--r1 { left: 77.5%; top: 45.4%; width: 21.5%; height: 36.1%; --c: var(--r1); --c-rgb: var(--r1-rgb); }

.hot:not(:disabled):hover { border-color: var(--c); background: rgba(var(--c-rgb), .13); }
.hot.is-on { border-color: var(--c); background: rgba(var(--c-rgb), .15); }
.hot:disabled { cursor: not-allowed; }

/* ---------- notes ---------- */

.notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--muted-2);
  text-wrap: pretty;
}

/* ---------- truths panel ---------- */

.truths {
  flex: 1 1 300px;
  min-width: 258px;
  max-width: 470px;
  padding: clamp(14px, 1.4vw, 18px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.truths__hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }

.truths__title {
  margin: 0;
  font-family: "Patrick Hand", cursive;
  font-weight: 400;
  font-size: 24px;
  line-height: 1;
  color: var(--accent);
}

.truths__count { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 96px;
  padding: 9px 6px;
  border-radius: 13px;
  border: 1px dashed var(--line-3);
  background: var(--panel-2);
  cursor: pointer;
  font: inherit;
  color: #b3aecb;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.slot.is-filled { border-style: solid; border-color: #3b3457; background: rgba(163, 139, 250, .10); }
.slot.is-open { border-color: #8f7ae0; box-shadow: 0 0 0 1px #8f7ae0; }

.slot__glyph, .opt__glyph, .row__glyph {
  width: 100%;
  aspect-ratio: 135 / 138;
  border-radius: 5px;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
}

.slot__glyph { max-width: 58px; }
.opt__glyph  { max-width: 54px; }
.row__glyph  { max-width: 62px; }

.slot__label { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #e2ddf5; text-align: center; line-height: 1.15; }
.slot__plus  { font-size: 22px; line-height: 1; color: #5f5b76; }
.slot__empty { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }

.slots__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 9px; min-height: 20px; }
.slots__hint { font-size: 12px; color: var(--muted); }

.link {
  border: none;
  background: none;
  padding: 8px 2px;
  font: inherit;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- symbol picker ---------- */

.picker { margin-top: 12px; padding: 12px; border: 1px solid #332c4d; border-radius: 14px; background: #0e0e18; }
.picker__hd { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.picker__title { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #c9c2e4; }
.picker__close { border: none; background: none; padding: 8px 4px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(70px, 100%), 1fr)); gap: 8px; }

.opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  cursor: pointer;
  font: inherit;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: #584d80; background: #15151f; }
.opt.is-on { border-color: #8f7ae0; background: rgba(163, 139, 250, .14); }
.opt__label { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: #c9c2e4; text-align: center; line-height: 1.1; }

/* ---------- truth rows ---------- */

.rows { margin-top: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(266px, 100%), 1fr)); gap: 6px; }

.row {
  display: grid;
  grid-template-columns: 20px repeat(3, 1fr);
  align-items: start;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 11px;
  border: 1px solid #17171f;
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color .15s, background .15s;
}
.row:hover { border-color: #332c4d; background: #101018; }
.row.is-exact { border-color: #8f7ae0; background: rgba(163, 139, 250, .10); }

.row__num { font-size: 11px; color: var(--muted-2); padding-top: 16px; }
.row__cell { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.row__label { font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: #b3aecb; text-align: center; line-height: 1.15; }

.nomatch { margin-top: 12px; padding: 14px; border: 1px dashed var(--line-3); border-radius: 12px; font-size: 13px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
