/* Own-hand cards: the illustration is the card type, the reverse is its text. */
.game-surface .bunker-flip-card {
  --bunker-card-padding: 10px;
  --bunker-card-min: 145px;
  --bunker-art-height: 70px;
  --bunker-action-space: 48px;
  --bunker-easing: cubic-bezier(.22, 1, .36, 1);
  --bunker-select-motion: .28s var(--bunker-easing);
  --bunker-card-inset: 0px;
  --bunker-card-scale: 1;
  --bunker-art-grow: 0;
  --bunker-face-line: var(--line);
  --bunker-face-shadow: 0 2px 4px #314c8410;
  --bunker-selection-fill: color-mix(in srgb, var(--accent-soft) 64%, var(--surface));
  display: flex; flex-direction: column; position: relative; isolation: isolate;
  padding: 0; overflow: visible; min-width: 0;
}
.game-surface .hand-grid:has(.bunker-flip-card) { align-items: stretch; grid-auto-rows: 1fr; }
.game-surface .hand-panel:has([data-bunker-hand]) .panel-head { flex-wrap: nowrap; }
.game-surface .hand-panel:has([data-bunker-hand]) .panel-head > div { min-width: 0; }
.game-surface .hand-panel:has([data-bunker-hand]) .panel-head .button { flex: none; }
.game-surface .bunker-flip-card:has(.bunker-card-peek) {
  background: transparent; border-color: transparent; box-shadow: none;
  transition: background-color var(--bunker-select-motion), border-color var(--bunker-select-motion), box-shadow var(--bunker-select-motion);
}
.game-surface .bunker-flip-card.is-selected:not(:has(.is-flipped)) {
  --bunker-card-inset: var(--bunker-action-space);
  --bunker-card-scale: .97;
  --bunker-art-grow: 1;
  background-color: var(--bunker-selection-fill);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 9%, transparent);
}
.game-surface .bunker-flip-card.public { --bunker-face-line: var(--accent-line); }
.game-surface .bunker-card-peek {
  display: grid; flex: 1; width: 100%; min-width: 0; padding: 0; border: 0; border-radius: inherit;
  position: relative; z-index: 1; margin-block-end: var(--bunker-card-inset);
  background: transparent; color: inherit; text-align: left; perspective: 1000px;
  transition: margin-block-end var(--bunker-select-motion);
  touch-action: pan-y; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.game-surface .bunker-card-peek:is(.is-pressing, .is-flipped) {
  --bunker-face-line: color-mix(in srgb, var(--accent) 48%, var(--line));
  --bunker-face-shadow: 0 5px 13px color-mix(in srgb, var(--accent) 17%, transparent);
}
.game-surface .bunker-card-peek:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.game-surface .bunker-card-rotor {
  display: grid; position: relative;
  scale: var(--bunker-card-scale); transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform .35s var(--bunker-easing), scale var(--bunker-select-motion);
  border-radius: inherit;
}
.game-surface .bunker-card-peek:is(.is-pressing, .is-flipped) .bunker-card-rotor {
  scale: calc(var(--bunker-card-scale) * .97); transition-duration: .35s, .11s;
}
.game-surface .bunker-card-peek.is-flipped .bunker-card-rotor {
  transform: rotateY(180deg); transition-duration: .45s, .11s;
}
.game-surface .bunker-card-front, .game-surface .bunker-card-back {
  grid-area: 1 / 1; min-width: 0; display: flex; flex-direction: column;
  padding: var(--bunker-card-padding); border-radius: inherit;
  background: var(--surface); -webkit-backface-visibility: hidden; backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px var(--bunker-face-line), var(--bunker-face-shadow);
}
.game-surface .bunker-card-front {
  min-height: calc(var(--bunker-card-min) - var(--bunker-card-inset));
  padding-block: calc(var(--bunker-card-padding) - var(--bunker-card-inset) / 8);
  transition: min-height var(--bunker-select-motion), padding-block var(--bunker-select-motion), background-color var(--bunker-select-motion), box-shadow .11s var(--bunker-easing);
}
/* Both faces size the card. The reverse gives back the space used by the selection button. */
.game-surface .bunker-card-back {
  transform: rotateY(180deg); gap: 6px; pointer-events: none;
  margin-block-end: calc(0px - var(--bunker-card-inset));
  transition: margin-block-end var(--bunker-select-motion), box-shadow .11s var(--bunker-easing);
}
.game-surface .bunker-flip-card.public .bunker-card-front,
.game-surface .bunker-flip-card.public .bunker-card-back { background: var(--accent-soft); }
.game-surface .bunker-flip-card.is-selected .bunker-card-front {
  background-color: var(--bunker-selection-fill); box-shadow: none;
}
.game-surface .bunker-card-peek.is-flipped .bunker-card-back { background-color: var(--bunker-selection-fill); }
.game-surface .bunker-flip-card .trait-card-top { min-height: 25px; margin: 0 0 3px; gap: 4px; flex-wrap: nowrap; }
.game-surface .bunker-flip-card .trait-card-label { font-size: 10px; font-weight: 750; min-width: 0; overflow-wrap: anywhere; }
.game-surface .bunker-flip-card .trait-visibility { font-size: 10px; margin-left: 0; white-space: nowrap; }
.game-surface .bunker-card-art {
  display: block; flex: var(--bunker-art-grow) 0 auto; width: 100%;
  height: calc(var(--bunker-art-height) - var(--bunker-card-inset) * .75);
  max-height: var(--bunker-art-height);
  margin: 0 auto 4px; object-fit: contain; pointer-events: none;
  transition: height var(--bunker-select-motion), flex-grow var(--bunker-select-motion);
}
.game-surface .bunker-card-title { display: block; font-size: 15px; font-weight: 800; letter-spacing: -.025em; line-height: 1.18; overflow-wrap: anywhere; }
.game-surface .bunker-card-front > .bunker-card-title { text-align: center; }
.game-surface .bunker-card-background { font-size: 12px; line-height: 1.3; color: var(--muted); }
.game-surface .bunker-card-front > .bunker-card-background { text-align: center; }
.game-surface .bunker-card-description { display: block; font-size: 12px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.game-surface .bunker-card-covered { flex: 1; padding: var(--bunker-card-padding); min-height: var(--bunker-card-min); }
.game-surface .bunker-flip-card .bunker-card-action {
  position: absolute; inset: auto 6px 4px; z-index: 0;
  margin: 0; padding: 0;
  opacity: 0; transform: translateY(-12px);
  transition: opacity .23s var(--bunker-easing), transform .23s var(--bunker-easing);
}
.game-surface .bunker-flip-card .bunker-card-action:not([inert]) { opacity: 1; transform: none; transition-duration: .25s; }
.game-surface .bunker-flip-card .bunker-card-action .button {
  position: relative; isolation: isolate; min-height: 44px; width: 100%;
  background: transparent; border: 0; border-radius: 999px; box-shadow: none;
  font-size: 12px; padding: 6px;
}
.game-surface .bunker-card-action .button::before {
  position: absolute; inset: 6px 0; z-index: -1; border-radius: inherit;
  background: var(--surface-2); content: '';
}
.game-surface .bunker-card-action .button.primary::before { background: var(--accent); }
.game-surface .bunker-hold-hint { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; line-height: 1.3; }
@media (min-width: 761px) {
  .game-surface .bunker-flip-card { --bunker-card-padding: 13px; --bunker-card-min: 165px; --bunker-art-height: 86px; }
  .game-surface .bunker-card-title { font-size: 18px; }
  .game-surface .bunker-card-description { font-size: 14px; }
}
@media (max-width: 360px) {
  .game-surface .bunker-flip-card { --bunker-card-padding: 8px; --bunker-art-height: 62px; }
  .game-surface .bunker-flip-card .trait-card-top { display: grid; justify-items: start; gap: 2px; }
  .game-surface .bunker-card-title { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .game-surface :is(.bunker-flip-card:has(.bunker-card-peek), .bunker-card-peek, .bunker-card-rotor, .bunker-card-front, .bunker-card-back, .bunker-card-art, .bunker-flip-card .bunker-card-action) { transition: none; }
}

.bunker-mode-field, #story-vote-form fieldset {
  min-width: 0; border: 0; padding: 0; margin: 0 0 16px;
}
.bunker-mode-field legend, #story-vote-form legend {
  margin-bottom: 8px; padding: 0; color: var(--text); font-size: 15px; font-weight: 700;
}
.bunker-mode-field .durak-setup-choice { padding-inline: 10px; font-size: 14px; }
.bunker-mode-field > p { color: var(--muted); font-size: 13px; line-height: 1.45; margin: 8px 0 0; }
.bunker-mode-field:has([value="basic"]:checked) .bunker-mode-survival,
.bunker-mode-field:has([value="survival"]:checked) .bunker-mode-basic { display: none; }

.game-surface .story-grid { align-items: start; }
.story-grid > *, .story-final, .story-result { min-width: 0; overflow-wrap: anywhere; }
.game-surface .story-step, .game-surface .story-table { display: grid; gap: 12px; }
.story-step h3, .story-result h3 { font-size: 18px; margin: 0; }
.story-step .button { justify-self: start; white-space: normal; }
.story-speaker, .story-candidate, .story-result {
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.story-speaker .public-traits, .story-candidate .public-traits { padding: 12px 16px; margin: 0; }
.story-danger .eyebrow { display: block; margin-bottom: 5px; }
.story-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.story-candidate { margin-top: 8px; }
.story-candidate label { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; cursor: pointer; }
.story-candidate label span { min-width: 0; }
.story-candidate label small { display: block; font-size: 12px; color: var(--muted); }
.story-candidate input { width: 20px; height: 20px; min-height: 0; flex: none; accent-color: var(--accent); }
.story-candidate:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.story-candidate details { padding-inline: 12px; }
.story-candidate details > p { padding-bottom: 10px; }
.story-candidate summary, .story-table summary, .story-history summary { cursor: pointer; padding-block: 12px; min-height: 44px; }
.story-candidate summary { font-size: 13px; color: var(--accent); }
.game-surface .story-table { padding: 17px; }
.story-table h2 { font-size: 20px; margin: 0; }
.story-table p, .story-result p, .story-history ol, .story-table dl, .story-result dl {
  font-size: 14px; line-height: 1.5; margin: 0; color: var(--muted);
}
.story-table dd, .story-result dd { color: var(--ink); margin: 0 0 6px; font-weight: 650; }
.story-table .world-card > dl, .story-table .world-card > .public-traits { margin: 8px 0; }
.story-history ol { padding: 0 3px 12px 23px; }
.story-history li + li { margin-top: 6px; }
.story-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; margin-top: 16px; }
.story-result { display: grid; align-content: start; gap: 10px; padding: 14px; }
@media (max-width: 760px) {
  .game-surface .story-grid { grid-template-columns: minmax(0, 1fr); }
  .story-step .button, .story-actions .button, #story-vote-form > .button { width: 100%; }
}
