/* Grown - look and feel. Black, white, grey and yellow. Colors are variables so a new theme is easy. */
:root {
  --bg: #0c0c0b;
  --panel: #171715;
  --panel2: #20201d;
  --line: #3a3a36;
  --text: #f1f1ec;
  --dim: #9b9b94;
  --accent: #f2c230;
  --good: #8fd16a;
  --bad: #e0553f;
}

* { 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; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; display: flex; justify-content: space-between; padding: 10px 12px; gap: 12px; }
#hud button { pointer-events: auto; }
.hud-left, .hud-right { width: 240px; }
.hud-center { flex: 1; max-width: 520px; text-align: center; }
.hud-right { text-align: right; font-variant-numeric: tabular-nums; font-size: 14px; line-height: 1.5; }
.bar { position: relative; height: 18px; background: rgba(0,0,0,0.6); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.bar .fill { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--text); transition: width 0.1s linear; }
.bar.hp .fill { background: #7d7d77; }
.bar.xp .fill { background: var(--accent); }
.bar.tier .fill { background: var(--accent); }
.bar.tier.boss .fill { background: var(--bad); }
.bar span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 16px; color: #fff; 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; }
.tier-name small { color: var(--dim); font-weight: 400; margin-left: 6px; }
.attacks { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.attacks .a { background: rgba(0,0,0,0.55); border: 1px solid var(--line); border-radius: 3px; padding: 2px 6px; font-size: 12px; }
.attacks .a.fused { border-color: var(--accent); color: var(--accent); }
#btn-pause { margin-top: 6px; width: 40px; height: 32px; background: rgba(0,0,0,0.6); border: 1px solid var(--line); border-radius: 4px; }
.banner { position: absolute; top: 18%; left: 0; right: 0; text-align: center; font-size: 22px; font-weight: 600; text-shadow: 0 2px 8px #000; color: var(--accent); }

/* ---- Overlay screens ---- */
.overlay { position: fixed; inset: 0; background: rgba(8,8,7,0.88); overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; padding: 24px 14px 60px; touch-action: pan-y; }
.overlay.clear { background: rgba(8,8,7,0.6); }
.screen { width: 100%; max-width: 920px; }
h1 { font-size: 56px; letter-spacing: 0.3em; margin: 20px 0 4px; text-align: center; font-weight: 300; }
h1 span { color: var(--accent); }
h2 { font-weight: 500; margin: 0 0 12px; letter-spacing: 0.06em; }
.sub { text-align: center; color: var(--dim); margin-bottom: 22px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 9px 16px; transition: background 0.1s, border-color 0.1s; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 700; font-size: 20px; padding: 14px 44px; }
.btn.primary:hover { background: #ffd84a; }
.btn.small { padding: 4px 10px; 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: 8px; padding: 14px 16px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 8px; font-weight: 500; color: var(--dim); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.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: 18px; font-variant-numeric: tabular-nums; }
.matter b { color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.card .name { font-weight: 600; }
.card .lv { float: right; color: var(--dim); font-variant-numeric: tabular-nums; }
.card .desc { color: var(--dim); font-size: 13px; margin: 4px 0 8px; min-height: 2.6em; }
.pips { height: 4px; background: #000; border-radius: 2px; margin: 6px 0 8px; overflow: hidden; }
.pips i { display: block; height: 100%; background: var(--accent); }

/* level-up cards */
.picks { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8vh; }
.pick { width: 230px; background: var(--panel); border: 2px solid var(--line); border-radius: 10px; padding: 16px; text-align: left; transition: transform 0.08s, border-color 0.1s; }
.pick:hover { transform: translateY(-4px); border-color: var(--accent); }
.pick .k { color: var(--dim); font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; }
.pick .t { font-size: 20px; font-weight: 600; margin: 6px 0; }
.pick .d { color: var(--dim); font-size: 14px; }
.pick.fuse { border-color: var(--accent); }
.pick.attack .k { color: #fff; }

/* gear */
.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 14px; }
.slot { border: 1px dashed var(--line); border-radius: 8px; padding: 10px; min-height: 108px; }
.item { border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; padding: 8px 10px; background: var(--panel); margin-bottom: 6px; }
.item .nm { font-weight: 600; }
.item .st { color: var(--dim); font-size: 13px; }
.item .acts { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.list { max-height: none; }
table { border-collapse: collapse; width: 100%; }
td, th { padding: 4px 8px; text-align: left; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { color: var(--dim); font-weight: 500; font-size: 13px; }
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; }
.win-title { font-size: 40px; text-align: center; margin: 6vh 0 6px; letter-spacing: 0.1em; font-weight: 300; }
.win-title.victory { color: var(--accent); }
.stat-line { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 6px 0; }

@media (max-width: 720px) {
  h1 { font-size: 38px; }
  .hud-left, .hud-right { width: 130px; }
  .hud-right { font-size: 12px; }
  .tier-name { font-size: 13px; }
  .attacks .a { font-size: 10px; padding: 1px 4px; }
  .pick { width: 100%; }
}
