/* Robot Battle Cards */
[hidden] { display: none !important; }

.game-page { background: var(--paper); }
.game-top { background: var(--red); border-bottom: var(--edge); }
.topbar__link--on { background: var(--black); }
.logo { color: #fff; text-decoration: none; }

.game { max-width: 62rem; margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }
.game-footer { padding-bottom: 3rem; }

/* ---------- panels and setup ---------- */
.g-panel { background: #fff; border: var(--edge); border-radius: 1.6rem; box-shadow: var(--shadow); padding: 1.5rem; margin-top: 1rem; max-width: 44rem; margin-inline: auto; }
.g-title { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: -.03em; line-height: .95; font-size: clamp(2.4rem, 8vw, 4.2rem); margin: 0 0 .75rem; }
.g-title--small { font-size: clamp(1.7rem, 5.5vw, 2.6rem); }
.g-sub { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.35rem; margin: 1.6rem 0 .6rem; }
.g-lede { font-size: 1.2rem; margin: 0 0 1rem; }
.g-count { margin: 1.25rem 0 0; font-size: .95rem; opacity: .75; }

.g-modes { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.g-mode {
  display: grid; justify-items: center; gap: .15rem; text-align: center; padding: 1rem; cursor: pointer; font: inherit;
  background: #fff; border: var(--edge); border-radius: 1.2rem; box-shadow: 4px 4px 0 var(--black); min-height: 9rem;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.g-mode:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--black); }
.g-mode[aria-pressed="true"] { background: var(--yellow); }
.g-mode__icon { font-size: 2.6rem; line-height: 1; }
.g-mode__title { font-family: var(--display); font-weight: 800; font-size: 1.5rem; text-transform: uppercase; }
.g-mode__note { font-size: 1rem; }

.g-names { display: grid; gap: .8rem; margin-top: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.g-names label { display: grid; gap: .3rem; font-weight: 700; }
.g-input { font: inherit; font-size: 1.1rem; padding: .7rem .9rem; border: 3px solid var(--black); border-radius: .9rem; min-height: 52px; background: #fff; }

.g-level { border: 0; padding: 0; margin: 1rem 0 0; display: grid; gap: .6rem; }
.g-level legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.g-radio { display: block; cursor: pointer; }
.g-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.g-radio__box { display: grid; padding: .7rem 1rem; border: 3px solid var(--black); border-radius: 1rem; background: #fff; min-height: 52px; }
.g-radio input:checked + .g-radio__box { background: var(--yellow); }
.g-radio input:focus-visible + .g-radio__box { outline: 4px solid var(--cyan); outline-offset: 3px; }

.g-sizes { display: flex; flex-wrap: wrap; gap: .7rem; }
.g-size {
  display: grid; justify-items: center; font: inherit; cursor: pointer; padding: .6rem 1.1rem; min-width: 6.5rem; min-height: 64px;
  background: #fff; border: 3px solid var(--black); border-radius: 1rem;
}
.g-size strong { font-family: var(--display); font-size: 1.6rem; line-height: 1; }
.g-size span { font-size: .85rem; }
.g-size[aria-pressed="true"] { background: var(--yellow); }
.g-start { margin-top: 1.5rem; }

.g-rules { margin-top: 1.5rem; border-top: 3px solid var(--black); padding-top: 1rem; }
.g-rules summary { font-weight: 700; cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.g-rules ol { margin: .5rem 0 0; padding-left: 1.4rem; display: grid; gap: .4rem; }

/* ---------- scoreboard ---------- */
.g-score {
  display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .8rem; background: var(--black); color: #fff; border-radius: 1.1rem; padding: .7rem 1rem;
  border: var(--edge); margin-bottom: 1rem; position: sticky; top: .5rem; z-index: 5;
}
.g-score__side { display: grid; }
.g-score__side:last-of-type { text-align: right; }
.g-score__name { font-weight: 700; opacity: .85; }
.g-score__n { font-family: var(--display); font-weight: 800; font-size: 1.5rem; line-height: 1.1; color: var(--yellow); }
.g-score__side.is-turn .g-score__name::after { content: " ◂ picks"; color: var(--cyan); font-size: .85rem; }
.g-score__side:last-of-type.is-turn .g-score__name::after { content: ""; }
.g-score__side:last-of-type.is-turn .g-score__name::before { content: "picks ▸ "; color: var(--cyan); font-size: .85rem; }
.g-score__side.is-win .g-score__n { color: var(--green); }
.g-score__pile, .g-score__round { grid-column: 1 / -1; text-align: center; font-size: .95rem; }
.g-score__round { opacity: .8; }

/* ---------- table ---------- */
.g-table { display: grid; gap: 1rem; justify-items: center; text-align: center; }
.g-hand { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: center; width: 100%; }
.g-hand--reveal { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; max-width: 46rem; }
.g-side { display: grid; gap: .4rem; justify-items: center; min-width: 0; }
.g-side__name { margin: 0; font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.2rem; }
.g-tools { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; align-items: center; margin-top: .5rem; }
.g-tools .g-start { margin-top: 0; }
.g-listen, .g-link {
  display: inline-flex; align-items: center; gap: .4rem;
  font: inherit; font-weight: 700; cursor: pointer; min-height: 48px; padding: .4rem 1.1rem; border-radius: 999px;
  background: var(--yellow); border: 3px solid var(--black); color: var(--black);
}
.g-link { background: none; border: 0; text-decoration: underline; }
.g-banner {
  font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: -.02em; margin: 0; font-size: clamp(1.8rem, 6vw, 3rem); line-height: 1;
  background: var(--green); color: var(--black); border: var(--edge); border-radius: 1.1rem; padding: .6rem 1.2rem; box-shadow: 5px 5px 0 var(--black); transform: rotate(-1.2deg);
}
.g-banner.is-draw { background: var(--yellow); }
.g-why { margin: 0; font-size: 1.1rem; max-width: 36rem; }
.g-pass { text-align: center; }
.g-end { text-align: center; }
.g-trophy { margin: 0; line-height: 1; }

/* ---------- cards ---------- */
.bcard {
  width: min(100%, 21rem); background: #fff; border: var(--edge); border-radius: 1.4rem; box-shadow: var(--shadow); overflow: hidden; text-align: left;
  display: flex; flex-direction: column; animation: deal .35s cubic-bezier(.3, 1.4, .5, 1) both;
}
@keyframes deal { from { transform: translateY(14px) rotate(-2deg) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.bcard__art { position: relative; background: var(--cyan); border-bottom: var(--edge); aspect-ratio: 4 / 3; display: grid; place-items: center; }
.bcard__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bcard__ph { display: grid; place-items: center; opacity: .6; }
.bcard__flag { position: absolute; left: .6rem; top: .6rem; background: #fff; border: 3px solid var(--black); border-radius: 999px; padding: .05rem .6rem; font-size: .85rem; font-weight: 700; }
.bcard__name { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: -.03em; line-height: 1; font-size: 1.9rem; margin: .6rem .9rem .5rem; overflow-wrap: anywhere; }
.bcard__rows { list-style: none; margin: 0; padding: 0; }
.bcard__row {
  display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 3.4rem; padding: .35rem .9rem; border: 0; border-top: 3px solid var(--black);
  background: #fff; font: inherit; text-align: left; color: var(--black);
}
button.bcard__row { cursor: pointer; transition: background-color .1s ease; }
button.bcard__row:hover, button.bcard__row:focus-visible { background: var(--yellow); }
.bcard__icon { width: 1.8rem; display: inline-grid; place-items: center; }
.bcard__label { font-weight: 700; flex: 1; }
.bcard__value { font-family: var(--display); font-weight: 800; font-size: 1.6rem; line-height: 1; }
.bcard__unit { font-size: .8rem; min-width: 3.2rem; opacity: .75; }
.bcard__row.is-picked { background: var(--yellow); outline: 4px solid var(--red); outline-offset: -4px; }

.bcard--back { aspect-ratio: 21 / 27; min-height: 14rem; }
.bcard__backface {
  flex: 1; display: grid; place-content: center; justify-items: center; gap: .5rem; color: #fff; padding: 1rem;
  background: repeating-linear-gradient(135deg, var(--red) 0 18px, var(--red-dark) 18px 36px);
}
.bcard__backicon { line-height: 1; }
.bcard__backname { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 1.4rem; }

.bcard--compact { width: 100%; animation: none; }
.bcard--compact .bcard__name { font-size: clamp(1.1rem, 3.4vw, 1.5rem); }
.bcard--compact .bcard__row { min-height: 2.8rem; padding: .25rem .6rem; gap: .4rem; }
.bcard--compact .bcard__value { font-size: clamp(1.1rem, 3.6vw, 1.4rem); }
.bcard--compact .bcard__label { font-size: .9rem; }
.bcard--compact .bcard__unit { font-size: .72rem; min-width: 2.4rem; }
.bcard.is-won { box-shadow: 0 0 0 6px var(--green), var(--shadow); transform: scale(1.02); }
.bcard.is-lost { filter: grayscale(.7); opacity: .85; }
.bcard.is-draw { box-shadow: 0 0 0 6px var(--yellow), var(--shadow); }

@media (max-width: 40rem) {
  .game { padding: .75rem .9rem 2.5rem; }
  .game-top .topbar { padding: .5rem 1rem; }
  .g-score { padding: .5rem .8rem; margin-bottom: .6rem; }
  .g-score__n { font-size: 1.25rem; }
  .g-table { gap: .6rem; }
  .bcard--full .bcard__art { aspect-ratio: 16 / 8; }
  .bcard--full .bcard__name { font-size: 1.6rem; margin: .4rem .9rem .35rem; }
  .bcard--full .bcard__row { min-height: 3.1rem; }
  .g-panel { padding: 1.1rem; }
  .bcard--compact .bcard__label, .bcard--compact .bcard__unit { display: none; }
  .bcard--compact .bcard__row { justify-content: space-between; }
  .bcard--compact .bcard__value { margin-left: auto; }
  .g-hand--reveal { gap: .6rem; }
  .g-reveal .g-tools {
    position: sticky; bottom: .5rem; z-index: 6; width: 100%; background: var(--paper); border: var(--edge); border-radius: 1.2rem;
    padding: .5rem; box-shadow: 0 -6px 0 var(--paper), var(--shadow);
  }
}

@media (prefers-reduced-motion: reduce) {
  .bcard { animation: none; }
  .bcard.is-won { transform: none; }
  .g-banner { transform: none; }
}

.bcard__row.is-unknown { background: #f1ede4; color: #6b6b6b; }
.bcard__row.is-unknown .bcard__value { color: #8a8a8a; }

.g-switch {
  display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start; margin-top: 1.4rem; padding: .9rem 1rem; cursor: pointer;
  border: 3px solid var(--black); border-radius: 1rem; background: #fff;
}
.g-switch input { width: 1.6rem; height: 1.6rem; margin-top: .15rem; accent-color: var(--red); cursor: pointer; }
.g-switch__text { display: grid; gap: .15rem; }
.g-switch__text span { font-size: .95rem; }
.g-switch:has(input:checked) { background: #fff4c2; }
