/* Seats own a fixed-size hand area; played cards have a separate inner lane. */
.arena {
  background: radial-gradient(ellipse at 50% 38%, #138646 0, #086738 49%, #043e2c 100%);
  box-shadow: inset 0 0 85px #002d2659, 0 20px 65px #0004;
}
.ring-seat .portrait, .rival .avatar {
  border-radius: 50%;
  background: #fff8e9;
  border-color: #29b8dc;
}
.ring-seat.theirs .portrait, .rival .avatar { border-color: #e5664c; }
.bot-portrait { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.ring-seat b { background: #0879a0; color: #fff; }
.ring-seat.theirs b { background: #be3936; }
.ring-seat.current .portrait { box-shadow: 0 0 0 3px #a4ed3e, 0 0 14px #81ef4870; }
.arena #teamSeats { z-index: 3; }
.team-game #played { z-index: 4; pointer-events: none; }
.seat-hand { height: 42px; }
.arena .seat-hand > .peek-fan {
  left: 50%; right: auto; top: 0; width: max-content; max-width: none;
  transform: translateX(-50%); gap: 0;
}
.arena .seat-hand .peek-fan .card { width: 43px; flex: 0 0 43px; margin: 0; }
.arena .seat-hand .peek-fan .card + .card { margin-left: -21px; }
.arena .seat-hand .peek-fan .card:first-child:not(:only-child) { transform: rotate(-7deg); }
.arena .seat-hand .peek-fan .card:last-child:not(:only-child) { transform: rotate(7deg); }
#envidoRail button { background: #08677e; border-color: #63b4bd77; }
#trucoRail button { background: #bf352f; border-color: #f28c6980; }

@media (min-width: 651px) {
  .arena.team-game .table-pile[data-owner="0"] { top: 74%; }
  .arena.six-game .table-pile[data-owner="3"],
  .arena.team-game:not(.six-game) .table-pile[data-owner="2"] { top: 38%; }
  #pennantRack16 { left: calc(50% + 72px); right: auto; top: 84px; width: 128px; height: 82px; }
  #pennantRack16 .pennant-art { max-width: 67px; }
}

@media (max-width: 650px) {
  main { padding: 4px 6px env(safe-area-inset-bottom); }
  .top { min-height: 36px; gap: 5px; margin-bottom: 4px; }
  .brand small { display: none; }
  .brand h1 { font-size: 23px; margin: 0; white-space: nowrap; }
  .tools { gap: 4px; }
  .tools button { min-height: 32px; padding: 6px 8px; font-size: 11px; }
  .bottom { margin-top: 4px; font-size: 9px; line-height: 12px; }
  .arena, .arena.team-game {
    height: calc(100svh - 62px - env(safe-area-inset-bottom));
    min-height: 576px; max-height: none; border-radius: 18px;
  }
  .arena:before { inset: 7px; border-radius: 13px; }
  .arena .sample { left: 13px; top: 12px; z-index: 2; }
  .arena .sample small { font-size: 8px; letter-spacing: 1.5px; margin-bottom: 4px; }
  .arena .sample .card { width: 52px; }
  .arena #scoreButton { top: 11px; right: 10px; width: 113px; gap: 4px; }
  .arena .score b { font-size: 23px; line-height: 1.15; }
  .arena .score-caption { font-size: 8px; }
  #pennantRack16 { top: 64px; right: 13px; width: 86px; height: 56px; gap: 0; z-index: 1; }
  #pennantRack16 .pennant-art { max-width: 45px; }
  #pennantRack16 .pennant-art:nth-child(2) { margin-left: -3px; transform: translateY(7px) rotate(12deg); animation: none; }
  #mate16 { top: auto; left: 8px; bottom: 8px; width: 34px; opacity: .95; }
  #tableProps18 { right: 7px; bottom: 6px; width: 39px; }

  .arena.team-game .center, .arena.team-game.showing-proof .center {
    top: 0; bottom: 0; left: 0; width: 100%; max-width: none; transform: none;
  }
  .arena.team-game #teamSeats { inset: 0; }
  .arena .ring-seat {
    width: 76px; max-width: none; height: 106px; transform: translateX(-50%);
  }
  .arena .ring-seat .portrait { width: 36px; height: 36px; flex: 0 0 36px; border-width: 3px; }
  .arena .ring-seat b { font-size: 10px; line-height: 15px; margin-top: 3px; padding: 0 5px; }
  .arena .seat-hand { width: 64px; height: 52px; flex: 0 0 52px; margin-top: 4px; }
  .arena .seat-hand.peekable { min-width: 64px; min-height: 52px; }
  .arena .seat-hand > span:not(.peek-fan) { top: 0; }
  .arena .seat-hand > span > .card { width: 21px; }
  .arena .seat-hand .peek-fan .card { width: 34px; flex-basis: 34px; }
  .arena .seat-hand .peek-fan .card + .card { margin-left: -17px; }
  .arena .private-flor16 { gap: 0; }
  .arena .private-flor16 .card { width: 30px!important; flex: 0 0 30px; }
  .arena .private-flor16 .card + .card { margin-left: -13px; }

  .arena.six-game .ring-seat-1 { left: 12%; top: calc(45% - 16px); }
  .arena.six-game .ring-seat-2 { left: 12%; top: 21%; }
  .arena.six-game .ring-seat-3 { left: 50%; top: 16px; }
  .arena.six-game .ring-seat-4 { left: 88%; top: 21%; }
  .arena.six-game .ring-seat-5 { left: 88%; top: calc(45% - 16px); }
  .arena.team-game:not(.six-game) .ring-seat-1 { left: 12%; top: 33%; }
  .arena.team-game:not(.six-game) .ring-seat-2 { left: 50%; top: 16px; }
  .arena.team-game:not(.six-game) .ring-seat-3 { left: 88%; top: 33%; }
  .arena.team-game .played > .table-pile {
    width: clamp(28px, 8.5cqw, 42px); left: var(--mobile-x); top: var(--mobile-y);
  }
  .arena.team-game .played > .table-pile[data-owner="0"] { --mobile-x: 50%; --mobile-y: calc(100% - 270px); }
  .arena.six-game .table-pile[data-owner="1"] { --mobile-x: 32%; --mobile-y: calc(49% + 30px); }
  .arena.six-game .table-pile[data-owner="2"] { --mobile-x: 32%; --mobile-y: calc(32% + 35px); }
  .arena.six-game .table-pile[data-owner="3"] { --mobile-x: 50%; --mobile-y: calc(22% + 25px); }
  .arena.six-game .table-pile[data-owner="4"] { --mobile-x: 68%; --mobile-y: calc(32% + 35px); }
  .arena.six-game .table-pile[data-owner="5"] { --mobile-x: 68%; --mobile-y: calc(49% + 30px); }
  .arena.team-game:not(.six-game) .table-pile[data-owner="1"] { --mobile-x: 32%; --mobile-y: calc(42% + 30px); }
  .arena.team-game:not(.six-game) .table-pile[data-owner="2"] { --mobile-x: 50%; --mobile-y: calc(22% + 25px); }
  .arena.team-game:not(.six-game) .table-pile[data-owner="3"] { --mobile-x: 68%; --mobile-y: calc(42% + 30px); }
  .arena.team-game .phase-label { top: 3px; left: 50%; max-width: 45%; font-size: 8px; line-height: 10px; }
  .arena.team-game .stake { top: 43%; font-size: 9px; opacity: .55; }
  .arena .watermark { top: 43%; font-size: 12px; letter-spacing: 4px; }
  .arena .ring-seat .turn-clock, .arena .ring-seat .turn-clock.bot-clock {
    width: 38px; height: 38px; top: -4px; left: -4px;
  }
  .arena .ring-seat .turn-clock b { font-size: 21px; line-height: 1; margin: 0; padding: 0; background: none; }

  .arena .player, .arena.team-game .player {
    bottom: 86px; width: 230px; max-width: calc(100% - 116px); pointer-events: none;
  }
  .arena .hand { height: 110px; padding-bottom: 7px; }
  .arena .hand .card-hit { width: 68px; flex-basis: 68px; height: 110px; margin: 0 -14px; padding-top: 0; }
  .arena .player-name { min-height: 32px; margin-top: 5px; gap: 7px; }
  .arena .player-name #selfPortrait { width: 30px; height: 30px; flex-basis: 30px; }
  .arena .identity-text16 b { font-size: 12px; }
  .arena .identity-text16 #handPoints { font-size: 10px; }
  .arena #teamSignals {
    left: 50%; right: auto; bottom: 49px; transform: translateX(-50%);
    flex-direction: row; gap: 5px; width: max-content; max-width: calc(100% - 24px);
  }
  .arena #teamSignals .comment-signal {
    min-width: 42px; min-height: 29px; padding: 4px 6px; font-size: 12px; line-height: 1.1;
    border-radius: 5px; box-shadow: 1px 2px 0 #0002;
  }
  .arena #teamSignals .comment-signal:after { left: 7px; bottom: -4px; border-top-width: 5px; border-right-width: 5px; }
  .arena #envidoRail { right: 8px; bottom: 126px; gap: 4px; }
  .arena #envidoRail button { min-width: 68px; max-width: 74px; min-height: 30px; padding: 6px 4px; font-size: 10px; }
  .arena #trucoRail { left: 8px; bottom: 97px; }
  .arena #trucoRail button { min-width: 63px; min-height: 31px; padding: 6px 8px; font-size: 12px; }
  .arena .actions, .arena.team-game .actions { left: 8px; right: auto; bottom: 135px; max-width: calc(100% - 16px); gap: 4px; }
  .arena .actions button { padding: 6px 8px; min-height: 30px; font-size: 11px; }
  .arena > .turn-clock, .arena > .turn-clock.bot-clock { right: 17px; bottom: 87px; width: 34px; height: 34px; }
  .arena > .turn-clock b { font-size: 20px; }
  .arena > .turn-clock small { top: 36px; font-size: 8px; }
  #tableChat21 { bottom: 8px; width: calc(100% - 108px); gap: 5px; }
  #tableChat21 input { min-height: 33px; height: 33px; padding: 5px 8px; border-radius: 8px; }
  #tableChat21 button { flex-basis: 33px; min-height: 33px; border-radius: 8px; }
  .arena .self-speech, .arena .seat-speech { font-size: 12px!important; padding: 5px 8px; max-width: 135px; }
  .arena .seat-speech { bottom: auto; top: -30px; }
  .arena.six-game .ring-seat-3 .seat-speech, .arena.team-game:not(.six-game) .ring-seat-2 .seat-speech {
    top: 36px; left: 50%; right: auto; transform: translateX(-50%);
  }
  .arena:not(.team-game) .rival { top: 16px; left: 50%; }
  .arena:not(.team-game) .rival .avatar { width: 38px; height: 38px; padding: 0; }
  .arena:not(.team-game) .rival .card { width: 30px; margin: 0 -9px; }
  .arena:not(.team-game) .rival label { font-size: 11px; margin: 4px; }
  .arena:not(.team-game) .center { top: 37%; transform: translate(-50%, -35%); }
  .arena:not(.team-game) .played .card, .arena:not(.team-game) .slot { width: 45px; }
  .arena:not(.team-game) .played { gap: 10px; }
  .arena:not(.team-game) .bubble:not(.player-call) { top: 117px; padding: 5px 10px; font-size: 12px; }
}

@media (max-width: 360px) {
  .brand h1 { font-size: 20px; }
  .tools button { font-size: 10px; padding: 6px; }
  .arena .hand .card-hit { width: 63px; flex-basis: 63px; margin: 0 -14px; }
  .arena .seat-hand .peek-fan .card { width: 31px; flex-basis: 31px; }
  .arena .seat-hand .peek-fan .card + .card { margin-left: -16px; }
  .arena #envidoRail button { min-width: 63px; max-width: 64px; font-size: 9px; }
  .arena #teamSignals { gap: 4px; }
  .arena #teamSignals .comment-signal { min-width: 39px; padding-inline: 5px; }
  #pennantRack16 { right: 10px; width: 80px; }
  #pennantRack16 .pennant-art { max-width: 42px; }
}
