/* Arena: builds on the DOODLE ROCKS look from /feed.css and /brand.css (paper, ink, orange, cards). */
:root { --line: #d7d5cc; --card-shadow: 2px 3px 0 #e2dfd5; --blue: #2a7de1; }


.arena-shell { max-width: 1180px; margin: auto; padding: 26px 20px 70px; }
.arena-intro { margin-bottom: 20px; }
.arena-intro h1 { font-size: clamp(30px, 6vw, 44px); }
.hl { color: var(--orange); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; max-width: 520px; }
.steps button { font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; padding: 10px 8px; }
.steps button:not([aria-current="step"]):hover { border-color: var(--ink); }
.steps button b { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid currentColor; font-size: 12px; }
.steps button[aria-current="step"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--card-shadow); padding: 18px; margin-bottom: 20px; }
.card h2 { margin-bottom: 6px; }
.card h3 { margin: 4px 0 8px; }
.card-head p { margin-bottom: 14px; }

.cta { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; min-height: 54px; padding: 14px 20px; margin-top: 14px; background: var(--orange); color: var(--ink); border: 1px solid var(--ink); border-radius: 6px; box-shadow: 2px 3px 0 var(--ink); font-weight: 700; font-size: 16px; }
.cta:hover { background: #ff7451; }
.cta:active { transform: translate(2px, 3px); box-shadow: none; }
.cta:disabled { opacity: .6; transform: none; box-shadow: 2px 3px 0 var(--ink); }
.cta.big { font-size: 20px; max-width: 520px; margin: 0 auto 18px; font-family: 'Space Grotesk', sans-serif; letter-spacing: 1px; }
button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- Draw ---- */
.pad-wrap { position: relative; max-width: 460px; margin: auto; }
#pad { display: block; width: 100%; aspect-ratio: 1; background: #fff; border: 1px solid var(--ink); border-radius: 10px; touch-action: none; cursor: crosshair; background-image: radial-gradient(#e4e1d7 1px, transparent 1px); background-size: 22px 22px; }
.pad-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center; font-size: 12px; color: var(--muted); pointer-events: none; margin: 0; }
.pad-tools { display: grid; gap: 8px; max-width: 460px; margin: 12px auto 0; }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tool-row button { min-height: 44px; padding: 6px 14px; font-size: 13px; font-weight: 600; }
.size { flex: 1 1 200px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--muted); min-height: 44px; }
.size input { flex: 1; min-width: 80px; accent-color: var(--orange); }
.size i { display: block; flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle, var(--c, var(--ink)) 0 var(--dot, 4px), transparent calc(var(--dot, 4px) + .5px)); border: 1px dashed #d4d2c8; }
.swatches { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.swatch { flex: none; display: grid; place-items: center; width: 38px; min-height: 0; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; }
.swatch::before { content: ''; width: min(28px, calc(100% - 6px)); aspect-ratio: 1; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px #c9c6bb; transition: transform .1s; }
.swatch:hover::before { transform: scale(1.1); }
.swatch[aria-pressed="true"] { background: transparent; }
.swatch[aria-pressed="true"]::before { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.swatch:focus-visible { outline-offset: 0; }
.pad-tools .swatches, #colors { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); justify-items: center; }
.pad-tools .swatch, #colors .swatch { width: 100%; max-width: 44px; }
.tool-row button:disabled { cursor: default; opacity: .45; }
.tool-row button:not(:disabled):not([aria-pressed="true"]):hover { border-color: var(--ink); }
#bring-to-life { max-width: 460px; margin-left: auto; margin-right: auto; }
.chips-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.pick { flex: none; display: grid; justify-items: center; gap: 4px; width: 92px; padding: 8px 6px; font-size: 11px; font-weight: 600; min-height: 0; }
.pick canvas, .pick img { width: 64px; height: 64px; object-fit: contain; }
.pick small { font-weight: 400; color: var(--muted); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick:hover { border-color: var(--ink); }
.pick:active { transform: translate(1px, 2px); }

/* ---- Gear ---- */
.gear-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr) minmax(250px, 0.8fr); gap: 18px; align-items: start; }
.gear-grid .card { margin-bottom: 0; min-width: 0; }
#stage { display: block; width: 100%; height: auto; border-radius: 10px; background: var(--paper); touch-action: none; }
.stage-card p { margin: 10px 0 0; }
.coarse-hint { display: none; }
@media (pointer: coarse) { .fine-hint { display: none; } .coarse-hint { display: inline; } }
.selected { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; margin-top: 8px; font-weight: 600; }
.selected button { min-height: 40px; padding: 4px 14px; color: #a44124; }
.selected button:hover { border-color: #a44124; }
.kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.kinds button { min-height: 40px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.kinds button:hover { border-color: var(--ink); }
.cards { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; padding-right: 2px; }
.part { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; cursor: grab; user-select: none; touch-action: none; transition: transform .12s, border-color .12s; }
.part:hover { border-color: var(--ink); transform: translateX(2px); }
.part:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.part.added { border-color: var(--orange); }
.part { -webkit-touch-callout: none; -webkit-user-select: none; }
.part.holding { border-color: var(--orange); transform: scale(.97); }
.part canvas { flex: none; width: 54px; height: 54px; }
.part strong { display: block; font-size: 14px; }
.part small { display: block; color: var(--muted); line-height: 1.35; font-size: 11px; }
.part .count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--orange); }
.ghost { position: fixed; z-index: 10; pointer-events: none; width: 64px; height: 64px; opacity: 0; transform: rotate(-6deg) scale(1.15); filter: drop-shadow(2px 3px 0 #25272033); }
.ghost.visible { opacity: 1; }

.field { display: grid; gap: 6px; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field input:focus-visible { outline-offset: 2px; }
.field input { font: inherit; font-family: 'Space Grotesk', sans-serif; font-size: 18px; font-weight: 700; color: var(--ink); padding: 8px 10px; border: 1px solid var(--ink); border-radius: 7px; }
.element { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--paper); font-size: 12px; margin-bottom: 12px; }
.element b { font-family: 'Space Grotesk', sans-serif; font-size: 14px; }
.element i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--ink); flex: none; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; margin: 0 0 14px; font-size: 12px; align-items: center; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; display: flex; gap: 8px; align-items: center; }
.stats dd b { min-width: 3em; text-align: right; font-variant-numeric: tabular-nums; }
.bar { flex: 1; height: 7px; border-radius: 4px; background: #eeece4; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--orange); border-radius: 4px; transition: width .25s; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row button { font-size: 13px; }
.sheet h3 { margin-top: 18px; }
.roster { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.roster li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 2px 4px 2px 8px; }
.roster li.current { border-color: var(--ink); }
.roster li.current .linkish::after { content: 'editing'; margin-left: 8px; font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--orange); }
.roster li.muted { border: 0; padding: 0; font-size: 12px; }
.roster li.undo { justify-content: space-between; border-style: dashed; font-size: 12px; color: var(--muted); padding-left: 12px; }
.roster li.undo button { min-height: 40px; font-size: 12px; font-weight: 600; padding: 4px 12px; }
.roster canvas { width: 44px; height: 44px; flex: none; }
.linkish { border: 0; background: none; padding: 0; min-height: 44px; font-weight: 600; flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }
.x { flex: none; display: grid; place-items: center; border: 0; background: none; width: 44px; min-height: 44px; padding: 0; color: var(--muted); font-size: 20px; border-radius: 8px; }
.x:hover { color: #a44124; background: #fde2dc; }

/* ---- Fight ---- */
.matchup { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 12px; max-width: 620px; margin: 0 auto 14px; }
.side { display: grid; gap: 4px; min-width: 0; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.matchup .vs { padding-bottom: 12px; }
select { font: inherit; font-size: 14px; color: var(--ink); width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid #d4d2c8; border-radius: 7px; background: #fff; text-transform: none; letter-spacing: 0; font-weight: 600; }
select:hover { border-color: var(--ink); }
select:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.arena-wrap { position: relative; border: 1px solid var(--ink); border-radius: 12px; overflow: hidden; background: var(--paper); box-shadow: 0 8px 22px #25272022; }
#arena { display: block; width: 100%; }
.hud { position: absolute; inset: 10px 12px auto; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.plate { width: min(320px, 40%); display: grid; gap: 4px; }
.plate.right { justify-items: end; text-align: right; }
.who { display: flex; align-items: center; gap: 6px; font-family: 'Space Grotesk', sans-serif; font-weight: 700; white-space: nowrap; min-width: 0; }
.who strong { overflow: hidden; text-overflow: ellipsis; }
.plate.right .who { flex-direction: row-reverse; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--ink); flex: none; }
.tag { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 10px; white-space: nowrap; background: #fff; border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; color: var(--muted); }
.hp { width: 100%; height: 12px; border: 1px solid var(--ink); border-radius: 20px; background: #fff; overflow: hidden; }
.hp i { display: block; height: 100%; transition: width .15s; }
.plate.right .hp { direction: rtl; }
.parts { display: flex; gap: 3px; flex-wrap: wrap; }
.plate.right .parts { justify-content: flex-end; }
.chip { position: relative; font-size: 10px; padding: 0 5px 2px; border: 1px solid var(--line); border-radius: 4px; background: #fff; overflow: hidden; }
.chip i { position: absolute; left: 0; bottom: 0; height: 2px; background: #2bb24c; }
.chip.gone { background: #fde2dc; border-color: #f0a08c; text-decoration: line-through; color: #a44124; }
.clock { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 20px; background: #fff; border: 1px solid var(--ink); border-radius: 8px; padding: 0 10px; height: fit-content; font-variant-numeric: tabular-nums; }
.banner { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; background: #f4f1e9aa; pointer-events: none; animation: pop .35s ease-out; text-align: center; }
.banner strong { font-family: 'Space Grotesk', sans-serif; font-size: clamp(34px, 7vw, 58px); letter-spacing: -1.8px; line-height: 1.05; }
.banner strong .winner-mark { color: var(--orange); }
.banner.loading { background: #f4f1e9dd; animation: none; }
.banner.loading strong { font-size: clamp(20px, 4vw, 28px); letter-spacing: -.5px; }
.banner.ready { background: transparent; animation: none; }
.banner.ready strong { font-size: clamp(18px, 3.4vw, 26px); letter-spacing: -.4px; background: #fff; border: 1px solid var(--ink); border-radius: 8px; padding: 6px 14px; box-shadow: 2px 3px 0 var(--ink); }
.banner > span { font-size: 13px; background: #fff; border: 1px solid var(--ink); border-radius: 6px; padding: 3px 10px; }
@keyframes pop { from { transform: scale(1.2); opacity: 0; } }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.controls button { min-height: 44px; padding: 4px 14px; font-size: 13px; font-weight: 600; }
.controls button:not([aria-pressed="true"]):hover { border-color: var(--ink); }
#brain-label { margin-left: auto; }
.log { list-style: none; margin: 0; padding: 12px 14px; max-height: 240px; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--card-shadow); font-size: 13px; display: grid; gap: 3px; }
.log:empty { display: none; }
.log li { display: flex; gap: 10px; align-items: baseline; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.6em; font-size: 11px; }
.log small { margin-left: auto; color: var(--muted); font-size: 10px; }
.log .crit, .log .break { color: #a44124; font-weight: 700; }
.log .block { color: var(--blue); }
.log .win { font-weight: 800; font-size: 15px; }
.log .tactic { color: #7a4fa3; font-style: italic; }

@media (min-width: 1061px) {
  .stage-card { position: sticky; top: 84px; }
}
@media (min-width: 1000px) {
  /* Draw: pad on the left, ready-made bodies and characters alongside. */
  #view-draw:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  #view-draw > .card { margin-bottom: 0; }
  #view-draw > .card + .card { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; }
  #view-draw .chips-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); overflow: visible; }
  #view-draw .pick { width: auto; }
}
@media (max-width: 1060px) {
  .gear-grid { grid-template-columns: 1fr 1fr; }
  .stage-card { grid-column: 1 / -1; max-width: 560px; width: 100%; justify-self: center; }
}
@media (max-width: 680px) {
  .arena-shell { padding: 20px 16px 56px; }
  .arena-intro { margin-bottom: 16px; }
  .steps { gap: 6px; margin-bottom: 16px; }
  .steps button { gap: 6px; font-size: 14px; padding: 8px 4px; }
  .gear-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr 1fr; max-height: none; overflow: visible; padding-right: 0; }
  .part { gap: 6px; padding: 6px; align-items: flex-start; }
  .part:hover { transform: none; }
  .part canvas { width: 40px; height: 40px; }
  .part strong { font-size: 13px; line-height: 1.25; }
  .part small { font-size: 10.5px; }
  .part { position: relative; }
  .part .count { position: absolute; top: 4px; right: 6px; }
  .matchup { grid-template-columns: 1fr; gap: 6px; }
  .matchup .vs { padding: 0; }
  .cta.big { margin-bottom: 14px; }
  .tool-row button { flex: 1; }
  #brain-label { margin-left: 0; flex-basis: 100%; }
  .hud { inset: 6px 8px auto; }
  .parts, .tag { display: none; }
  .who { font-size: 13px; }
  .clock { font-size: 15px; padding: 0 6px; }
  .card { padding: 14px; }
}

/* ---- Doodle → character ---- */
.powers { display: grid; gap: 6px; max-width: 460px; margin: 14px auto 0; font-size: 13px; font-weight: 600; }
.powers .muted { font-weight: 400; }
.powers textarea, .teach input { font: inherit; font-size: 14px; color: var(--ink); padding: 10px 12px; border: 1px solid #d4d2c8; border-radius: 8px; background: #fff; resize: vertical; }
.powers textarea:focus, .teach input:focus { outline: 3px solid var(--orange); outline-offset: 2px; }
.what { font-size: 13px; color: var(--muted); margin: -4px 0 10px; }
.what:empty { display: none; }
.moves { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.moves li { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: 12px; }
.moves li.muted { border: 0; padding: 0; }
.moves b { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 14px; }
.moves small { color: var(--muted); line-height: 1.4; display: block; }
.moves .x { margin: -6px -8px -6px auto; }
.moves li.fresh { border-color: var(--orange); animation: pop .35s ease-out; }
.teach { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; }
.teach-label { grid-column: 1 / -1; font-size: 12px; font-weight: 600; }
.teach-label .muted { font-weight: 400; }
.teach input { min-width: 0; min-height: 44px; }
.teach button { min-height: 44px; font-weight: 600; }
.teach button:disabled { cursor: progress; }
.converting { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: #f4f1e9f0; backdrop-filter: blur(3px); }
.converting-card { text-align: center; width: min(100%, 380px); background: #fff; border: 1px solid var(--ink); border-radius: 14px; box-shadow: 2px 3px 0 var(--ink); padding: 26px 22px 20px; }
.converting-card img { width: 170px; height: 170px; object-fit: contain; animation: waiting-wobble 1.4s ease-in-out infinite; margin-bottom: 10px; }
.converting-card h2 { margin: 0 0 6px; }
.converting-card p { margin: 0; min-height: 3em; }
#converting-time { min-height: 0; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .converting-card img, .banner, .moves li.fresh { animation: none; } }

.pick span { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.ready { border-color: var(--orange); }
.pick.ready small { color: var(--orange); font-weight: 700; }
.notice.busy { color: var(--muted); }
.notice.ok { color: #1d7a3a; font-weight: 600; }
#replay:disabled { cursor: default; }

/* ---- Fight: pick any doodle for either side ---- */
.matchup { align-items: center; }
.fighter-pick { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 10px; width: min(280px, 42vw); min-height: 84px; padding: 8px 12px 8px 8px; text-align: left; border: 1px solid var(--ink); border-radius: 12px; background: #fff; box-shadow: 2px 3px 0 var(--ink); }
.fighter-pick:hover { background: #fff7f2; }
.fighter-pick canvas, .fighter-pick img { width: 64px; height: 64px; object-fit: contain; }
.fighter-pick small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.fighter-pick b { display: block; font-family: 'Space Grotesk', sans-serif; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fighter-pick em { display: block; font-style: normal; font-size: 11px; color: var(--orange); font-weight: 700; }
.chooser { width: min(760px, calc(100vw - 32px)); max-height: min(86vh, 900px); padding: 18px; border: 1px solid var(--ink); border-radius: 14px; background: var(--paper); color: var(--ink); box-shadow: 0 18px 50px #0003; }
.chooser::backdrop { background: #25272066; }
.chooser-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chooser-head h2 { margin: 0; font-size: 22px; }
.chooser input[type=search] { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #d4d2c8; border-radius: 8px; background: #fff; }
.chooser p { margin: 8px 0 12px; }
.chooser-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; overflow-y: auto; max-height: calc(min(86vh, 900px) - 170px); padding: 2px 2px 8px; }
.chooser-grid h3 { grid-column: 1 / -1; margin: 8px 0 0; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.choice { display: grid; justify-items: center; gap: 4px; padding: 8px 6px; min-height: 44px; border: 1px solid #d4d2c8; border-radius: 10px; background: #fff; font-size: 12px; font-weight: 600; }
.choice canvas, .choice img { width: 76px; height: 76px; object-fit: contain; }
.choice span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choice small { font-size: 10px; color: var(--muted); font-weight: 500; }
.choice.ready { border-color: var(--orange); }
.choice.ready small { color: var(--orange); font-weight: 700; }
.choice[aria-pressed="true"] { border-color: var(--ink); box-shadow: 2px 3px 0 var(--ink); }
@media (max-width: 680px) { .fighter-pick { width: 100%; } .matchup .vs { padding: 0; } .chooser-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); } }
