:root {
  --bg: #0b0910;
  --panel: #17131f;
  --panel2: #211b2c;
  --line: #3a3048;
  --text: #ece4d6;
  --dim: #9a8fa8;
  --accent: #ffcf5a;
  --p0: #5ab0ff;
  --p1: #ff6a5a;
  --proj: #3b5bdb;
  --mod: #2f9e44;
  --multi: #e8a400;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font-family: 'Pixelify Sans', ui-monospace, monospace; display: grid; place-items: center; }

#stage { position: relative; width: 1280px; height: 720px; transform-origin: center center; flex: none; }
#game { position: absolute; inset: 0; width: 1280px; height: 720px; image-rendering: pixelated; background: #120e18; cursor: crosshair; }

.screen { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 6, 12, .72); backdrop-filter: blur(2px); }
.hidden { display: none !important; }

.panel { background: var(--panel); border: 3px solid var(--line); box-shadow: 0 0 0 3px #000, 0 20px 60px #000a; padding: 28px 34px; min-width: 420px; text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.menu-panel { width: 560px; }
h1 { margin: 0; font-size: 56px; line-height: .9; color: var(--accent); text-shadow: 4px 4px 0 #6a2c00; letter-spacing: 1px; }
h1 span { display: block; font-size: 40px; color: #c9a8ff; text-shadow: 4px 4px 0 #2c1460; }
h2 { margin: 0; font-size: 34px; color: var(--accent); }
h3 { margin: 14px 0 8px; font-size: 18px; color: var(--accent); font-weight: 600; }
h3 small { color: var(--dim); font-weight: 400; font-size: 13px; margin-left: 6px; }
.sub { color: var(--dim); margin: 0; font-size: 16px; }
.err { color: #ff7a6a; min-height: 1em; margin: 0; }
.row { display: flex; gap: 10px; width: 100%; }
.row > * { flex: 1; }
.join input { flex: 0 0 140px; }

.field { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; color: var(--dim); font-size: 14px; }
input { font: inherit; font-size: 20px; background: #0e0b14; color: var(--text); border: 2px solid var(--line); padding: 8px 12px; outline: none; }
input:focus { border-color: var(--accent); }
#code { text-transform: uppercase; letter-spacing: 6px; text-align: center; }

.btn { font: inherit; font-size: 18px; font-weight: 600; padding: 10px 16px; background: var(--panel2); color: var(--text); border: 2px solid var(--line); box-shadow: 0 4px 0 #000; cursor: pointer; transition: transform .05s; }
.btn:hover { border-color: #6a5a80; }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
.btn.primary { background: #6a3c00; border-color: var(--accent); color: #fff3d0; }
.btn.primary.on { background: #1f5a2a; border-color: #6aff8a; }
.btn.ghost { background: transparent; box-shadow: none; color: var(--dim); }
.btn:disabled { opacity: .4; cursor: default; }

.controls { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; color: var(--dim); font-size: 14px; border-top: 2px dashed var(--line); padding-top: 12px; width: 100%; }
.controls b { width: 100%; color: var(--text); }
kbd { font: inherit; background: #000; border: 1px solid var(--line); padding: 0 5px; color: var(--text); }

.bigcode { font-size: 64px; letter-spacing: 12px; color: var(--accent); text-shadow: 4px 4px 0 #6a2c00; }

/* ---------- prep ---------- */
#prep { background: rgba(8, 6, 12, .92); place-items: stretch; }
.prep { display: flex; flex-direction: column; height: 100%; padding: 16px 28px; gap: 8px; }
.prep-head { display: flex; align-items: center; gap: 18px; border-bottom: 3px solid var(--line); padding-bottom: 10px; }
.prep-head .title { flex: 1; font-size: 24px; text-align: center; }
.prep-head .timer { font-size: 32px; color: var(--accent); min-width: 54px; text-align: right; }
.score { font-size: 22px; display: flex; gap: 10px; align-items: center; }
.score .p0 { color: var(--p0); } .score .p1 { color: var(--p1); }
.score .rdy { font-size: 13px; color: #6aff8a; }

/* draft */
.draft { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.draft-title { font-size: 36px; color: var(--accent); text-shadow: 3px 3px 0 #6a2c00; }
.draft-title span { color: var(--dim); font-size: 24px; margin-left: 10px; text-shadow: none; }
.cards { display: flex; gap: 28px; }
.card { width: 250px; min-height: 340px; background: var(--panel); border: 3px solid var(--line); box-shadow: 0 0 0 3px #000, 0 12px 30px #0008;
  padding: 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; transition: transform .12s, border-color .12s; }
.cards.many { gap: 16px; }
.cards.many .card { width: 206px; min-height: 320px; padding: 14px 12px; }
.card:hover { transform: translateY(-8px); border-color: var(--accent); }
.card canvas { width: 96px; height: 96px; image-rendering: pixelated; }
.card .cn { font-size: 22px; color: var(--accent); text-align: center; line-height: 1.1; }
.card .ck { font-size: 14px; }
.card .cd { color: var(--dim); font-size: 15px; text-align: center; line-height: 1.35; flex: 1; }
.card .ts { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 14px; border-top: 2px dashed var(--line); padding-top: 8px; color: var(--dim); }
.card .ts b { color: var(--text); font-weight: 400; }

/* build */
.build { flex: 1; display: flex; flex-direction: column; gap: 12px; justify-content: center; max-width: 900px; width: 100%; margin: 0 auto; }
.wand-card { background: var(--panel); border: 2px solid var(--line); padding: 12px 16px; }
.wand-card .whead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.wand-card .wname { font-size: 20px; color: var(--accent); }
.wand-card .wnum { color: var(--dim); font-size: 20px; }
.wand-card .wstats { color: var(--dim); font-size: 14px; }
.wand-card .wstats b { color: var(--text); font-weight: 400; }
.bag { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.bag h3 { margin: 0; }

.slots { display: flex; flex-wrap: wrap; gap: 6px; }
.slot { width: 56px; height: 56px; background: #0c0a10; border: 2px solid #2c2438; position: relative; display: grid; place-items: center; user-select: none; }
.slot.filled { cursor: grab; }
.slot.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.slot.drop { border-color: var(--accent); background: #2a2010; }
.slot.new::after { content: 'NEW'; position: absolute; top: -9px; right: -6px; font-size: 10px; background: var(--accent); color: #000; padding: 0 3px; }
.slot canvas { width: 52px; height: 52px; image-rendering: pixelated; pointer-events: none; }
.inv .slot { width: 48px; height: 48px; }
.inv .slot canvas { width: 44px; height: 44px; }

.hint { color: var(--dim); font-size: 14px; text-align: center; margin: 4px 0 0; }

.tooltip { position: absolute; z-index: 50; pointer-events: none; background: #0d0a12f2; border: 2px solid var(--line); padding: 8px 10px; width: 250px; font-size: 14px; box-shadow: 0 8px 20px #000a; }
.tooltip .tn { font-size: 17px; color: var(--accent); }
.tooltip .tk { font-size: 12px; margin-bottom: 4px; }
.tooltip .td { color: var(--dim); margin-bottom: 6px; }
.tooltip .ts { display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; font-size: 13px; }

.banner { position: absolute; left: 0; right: 0; top: 40%; text-align: center; font-size: 64px; color: var(--accent); text-shadow: 4px 4px 0 #000, 0 0 30px #000; pointer-events: none; }
.banner small { display: block; font-size: 24px; color: var(--text); }
