/* The Maw - look and feel. The deep sea at night, one violet accent. Colors are variables so a new theme is easy.
   Everything must fit a phone held upright (412 px wide): text wraps, nothing has a fixed width wider than that. */
:root {
  --bg: #08080b;
  --panel: rgba(22,22,26,0.92);
  --panel2: #22222a;
  --line: #3b3b46;
  --text: #f1f1ec;
  --dim: #a0a0aa;
  --accent: #8a7dff;
  --gold: #ffd65c;
  --good: #8fd16a;
  --bad: #ff6a3d;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-user-select: none; user-select: none; touch-action: none; }
canvas#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.ico { color: var(--accent); display: inline-block; min-width: 1em; text-align: center; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#hud button { pointer-events: auto; }
#hud.behind > * { visibility: hidden; }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; padding: 10px 12px 0; gap: 12px; }
.hud-left { flex: 0 1 250px; min-width: 0; }
.hud-center { flex: 1 1 0; min-width: 0; max-width: 460px; text-align: center; }
.hud-right { flex: 0 1 250px; min-width: 0; text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; line-height: 1.4; text-shadow: 0 1px 3px #000; }
.bar { position: relative; height: 18px; background: rgba(0,0,0,0.6); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 5px; }
.bar .fill { position: absolute; inset: 0 auto 0 0; width: 0%; transition: width 0.1s linear; border-radius: 9px; }
.bar.hp .fill { background: linear-gradient(#e9e9e2, #9c9c94); }
.bar.hunger .fill { background: linear-gradient(#ffe08a, #d9a21c); }
.bar.tier .fill { background: linear-gradient(#cfc8ff, #6f5ff0); }
.bar.tier.boss .fill { background: linear-gradient(#ff8a5c, #d93a1c); }
.bar span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 16px; color: #fff; padding: 0 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 2px #000, 0 0 2px #000, 1px 1px 1px #000, -1px -1px 1px #000; }
.tier-name { font-size: 16px; font-weight: 600; letter-spacing: 0.04em; margin-bottom: 4px; text-shadow: 0 2px 6px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#btn-pause { margin-top: 4px; width: 44px; height: 34px; background: rgba(0,0,0,0.6); border: 1px solid var(--line); border-radius: 6px; }
/* what to do right now: always on screen */
.objective { margin: 6px auto 0; width: fit-content; max-width: calc(100% - 20px); padding: 3px 12px; border-radius: 12px; background: rgba(6,6,9,0.7); border: 1px solid var(--line);
  font-size: 14px; text-align: center; color: var(--text); }
.objective.gold { border-color: var(--gold); color: var(--gold); }
.objective.bad { border-color: var(--bad); color: var(--bad); }
/* news: one message at a time, wraps on a narrow screen */
.banner { margin: 10px auto 0; width: fit-content; max-width: calc(100% - 24px); text-align: center; font-size: 22px; font-weight: 700; letter-spacing: 0.03em; line-height: 1.2;
  text-shadow: 0 2px 10px #000, 0 0 18px rgba(138,125,255,0.5); color: #d9d3ff; padding: 4px 12px; background: rgba(6,6,9,0.45); border-radius: 10px; }
.banner.pop { animation: bannerin 0.25s ease-out; }
@keyframes bannerin { from { transform: translateY(-8px); opacity: 0; } }
.dash { position: absolute; right: 18px; bottom: 22px; width: 76px; height: 76px; border-radius: 50%; background: rgba(0,0,0,0.5); border: 2px solid var(--accent); color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; transition: opacity 0.15s; }
/* the Maw's one attack, bottom left */
.mawpanel { position: absolute; left: 12px; right: 110px; bottom: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.mp-name { font-size: 17px; font-weight: 700; letter-spacing: 0.04em; text-shadow: 0 2px 6px #000, 0 0 3px #000; }
.mp-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-block; background: rgba(6,6,9,0.75); border: 1px solid var(--c, var(--line)); border-radius: 9px; padding: 1px 7px; font-size: 13px; white-space: nowrap; }
.chip .ci { color: var(--c, var(--accent)); }
.chip b { color: #fff; }

/* ---- Overlay screens ---- */
.overlay { position: fixed; inset: 0; background: rgba(8,8,11,0.9); overflow-y: auto; overflow-x: hidden; display: flex; justify-content: center; align-items: flex-start; padding: 22px 14px 60px; touch-action: pan-y; }
.overlay.clear { background: rgba(8,8,11,0.72); }
.overlay.menu { background: rgba(8,8,11,0.45); }
.screen { width: 100%; max-width: 920px; min-width: 0; }
h1 { font-size: 64px; letter-spacing: 0.22em; margin: 22px 0 4px; text-align: center; font-weight: 200; text-shadow: 0 0 30px rgba(138,125,255,0.35); padding-left: 0.22em; }
h1 span { color: var(--accent); font-weight: 700; text-shadow: 0 0 26px rgba(138,125,255,0.9); }
h2 { font-weight: 500; margin: 0; letter-spacing: 0.06em; }
h3 { margin: 0 0 8px; font-weight: 500; color: var(--dim); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.sub { text-align: center; color: var(--dim); margin-bottom: 18px; }
.sub.help { font-size: 13px; margin-top: 8px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.row.tabs { margin-bottom: 14px; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 16px; transition: background 0.1s, border-color 0.1s, transform 0.08s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: linear-gradient(#b3a8ff, #6f5ff0); color: #111; border-color: var(--accent); font-weight: 800; font-size: 22px; letter-spacing: 0.12em; padding: 14px 52px; box-shadow: 0 0 28px rgba(138,125,255,0.45); }
.btn.primary:hover { background: #cfc8ff; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.btn.danger:hover:not(:disabled) { border-color: var(--bad); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.panel.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.dim { color: var(--dim); }
.accent { color: var(--accent); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.matter { font-size: 17px; font-variant-numeric: tabular-nums; }
.matter b { color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card, .entry { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; min-width: 0; }
.card .name, .entry .name { font-weight: 600; }
.card .lv, .entry .lv { float: right; color: var(--dim); font-variant-numeric: tabular-nums; font-weight: 400; font-size: 13px; margin-left: 8px; }
.card .desc, .entry .desc { color: var(--dim); font-size: 13px; margin: 4px 0 6px; }
.card .now { font-size: 13px; margin: 0 0 8px; }
.entry .fus { font-size: 13px; line-height: 1.4; }
.entry.locked { opacity: 0.5; }
.entry.fusion { border-color: rgba(138,125,255,0.5); }
.entry.boss { border-color: rgba(255,106,61,0.55); }
.pips { height: 4px; background: #000; border-radius: 2px; margin: 6px 0 8px; overflow: hidden; }
.pips i { display: block; height: 100%; background: var(--accent); }
.help-box { font-size: 13.5px; line-height: 1.5; }
.tips .tip-row { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.45; }
.tips .tip-row:last-child { border-bottom: 0; }
.tips .tip-row b { display: block; color: var(--accent); margin-bottom: 2px; }
.tips .tip-row span { color: var(--text); }

/* choices */
.win-title { font-size: 38px; text-align: center; margin: 4vh 0 6px; letter-spacing: 0.08em; font-weight: 200; }
.win-title.small { font-size: 28px; margin-top: 1vh; }
.win-title.victory { color: var(--accent); }
.nowmaw { text-align: center; font-size: 13px; margin: -8px 0 12px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; align-items: center; }
.nowmaw b { margin-right: 4px; color: var(--accent); }
.picks { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
.pick { width: 240px; max-width: 100%; background: var(--panel); border: 2px solid var(--rar, var(--line)); border-radius: 14px; padding: 14px; text-align: left;
  transition: transform 0.08s, box-shadow 0.1s; animation: cardin 0.18s ease-out backwards; }
.pick:nth-child(2) { animation-delay: 0.05s; } .pick:nth-child(3) { animation-delay: 0.1s; } .pick:nth-child(4) { animation-delay: 0.15s; }
@keyframes cardin { from { transform: translateY(18px); opacity: 0; } }
.pick:hover { transform: translateY(-4px); box-shadow: 0 8px 26px rgba(138,125,255,0.25); }
.pick .k { color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.pick .big-ico { float: right; font-size: 34px; line-height: 1; color: var(--rar, var(--accent)); margin: 0 0 4px 8px; }
.pick .t { font-size: 20px; font-weight: 700; margin: 1px 0 6px; color: var(--rar, var(--text)); }
.pick .d { color: #c9c9d2; font-size: 14px; line-height: 1.35; margin-bottom: 4px; clear: both; }
.pick .d b { color: #fff; }
.pick .ev { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: rgba(138,125,255,0.18); border: 1px solid var(--accent); font-size: 13.5px; line-height: 1.35; }
.pick .ev b { color: #d9d3ff; }
.pick.evolves { box-shadow: 0 0 24px rgba(138,125,255,0.5); }
.pick .h { color: #9a92d6; font-size: 12px; margin-top: 6px; border-top: 1px solid var(--line); padding-top: 5px; }
.picktools { margin-top: 12px; }

/* pause and results */
.stat-line { display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.stat-line span:last-child { text-align: right; min-width: 0; }
.formname { font-size: 20px; font-weight: 700; color: var(--accent); }
.trait-row { display: grid; grid-template-columns: 22px 92px 1fr; gap: 6px; align-items: baseline; font-size: 13.5px; padding: 3px 0; }
.logline { font-size: 13.5px; padding: 3px 0; border-bottom: 1px solid var(--line); color: #c9c9d2; }
.logline:last-child { border-bottom: 0; }
table { border-collapse: collapse; width: 100%; }
td, th { padding: 4px 6px; text-align: left; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: 14px; }
th { color: var(--dim); font-weight: 500; font-size: 12px; }
textarea { width: 100%; height: 90px; background: #000; color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-family: monospace; font-size: 11px; user-select: text; }

/* ---- phones ---- */
@media (max-width: 720px) {
  h1 { font-size: 40px; }
  .hud-top { padding: 6px 6px 0; gap: 6px; }
  .hud-left { flex: 0 0 34%; }
  .hud-right { flex: 0 0 auto; font-size: 11px; line-height: 1.25; }
  .bar { height: 16px; }
  .bar span { font-size: 10.5px; line-height: 14px; padding: 0 4px; }
  .tier-name { font-size: 12px; margin-bottom: 3px; }
  #btn-pause { width: 40px; height: 30px; margin-top: 2px; }
  .objective { font-size: 12.5px; margin-top: 4px; }
  .banner { font-size: 16px; margin-top: 8px; }
  .mawpanel { left: 6px; right: 98px; bottom: 8px; }
  .mp-name { font-size: 14px; }
  .chip { font-size: 11.5px; padding: 0 5px; }
  .pick { width: 100%; padding: 10px 12px; }
  .pick .t { font-size: 18px; margin-bottom: 4px; }
  .pick .d { font-size: 13.5px; }
  .picks { gap: 8px; }
  .win-title { font-size: 28px; }
  .win-title.small { font-size: 22px; }
  .sub { margin-bottom: 14px; font-size: 14px; }
  .overlay { padding: 14px 10px 50px; }
  .btn.primary { padding: 14px 40px; }
  .trait-row { grid-template-columns: 20px 78px 1fr; }
  .grid { grid-template-columns: 1fr; }
}
/* a phone held sideways: little height, so the cards get tighter */
@media (max-height: 480px) {
  .win-title.small { font-size: 20px; margin: 0 0 2px; }
  .sub { margin-bottom: 8px; font-size: 13px; }
  .pick { padding: 8px 10px; width: 31%; min-width: 200px; }
  .pick .big-ico { font-size: 26px; }
  .pick .d { font-size: 12.5px; }
  .overlay { padding-top: 8px; }
  .dash { width: 64px; height: 64px; bottom: 12px; }
}
@media (hover: hover) and (pointer: fine) {
  .dash { width: 56px; height: 56px; font-size: 10px; opacity: 0.8; }
}
