/**
 * @file masa-table.css
 * @description Futello Masası game table: header, jersey-avatar seats around the round table (me at the bottom), seat tags with the score badge, center (big question plate, pile), bottom area with the two-row hand of big cards (Kilit tape, thrown card), team cards and the card throw animation. Red backdrop during the sabotage steps (masa-stage.css).
 * @dependencies css/masa/masa-base.css
 */

.mt { --tp: #e11d2a; --ts: #ffffff; display: flex; flex-direction: column; height: 100%; }
.masa-root:has(.mt.evil) { background: radial-gradient(120% 70% at 50% 30%, #e11d48 0%, #7f1d3a 48%, #1a0610 100%); }
.mt-head { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 6px; }
.mt-title { min-width: 0; }
.mt-title small { display: block; font-size: 10.5px; letter-spacing: .14em; color: var(--m-mut); font-weight: 800; }
.mt-title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-banner { margin: 2px 14px 4px; border-radius: 12px; padding: 7px 10px; background: linear-gradient(90deg, #111, #3b0764); border: 2px solid #fff; font-size: 13px; text-align: center; animation: mtPop .35s ease-out; }
.mt-banner.good { background: linear-gradient(90deg, #14532d, #166534); }

.mt-table { position: relative; flex: 1; min-height: 250px; margin: 22px 26px 34px; }
.mt-felt { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.13), rgba(255,255,255,.04) 70%); box-shadow: inset 0 0 0 3px rgba(255,255,255,.16); }
.mt-dir { position: absolute; left: 50%; top: 50%; width: 62%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 4px solid transparent; border-top-color: rgba(255,255,255,.35); border-bottom-color: rgba(255,255,255,.35); animation: mtSpin 14s linear infinite; }

.mt-seat { position: absolute; z-index: 4; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; width: 84px; }
.mt-seat .mk { width: 60px; height: 64px; }
.mt-seat.off { opacity: .45; }
.mt-seat .score { position: absolute; top: 34px; right: -8px; min-width: 34px; height: 28px; padding: 0 7px; gap: 1px; grid-auto-flow: column; align-items: baseline; border-radius: 14px; background: #fff; color: #1e3a8a; font-family: var(--font-display, 'Rajdhani', sans-serif); font-weight: 900; font-size: 19px; display: grid; place-items: center; border: 2px solid #1e3a8a; box-shadow: 0 3px 0 rgba(0,0,0,.35); }
.mt-seat .nm { margin-top: 3px; max-width: 92px; padding: 1px 7px; border-radius: 8px; background: rgba(10,20,50,.88); font-size: 11.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-seat .nm i { font-style: normal; color: #7dd3fc; font-weight: 700; }
.mt-seat .score small { font-size: 11px; font-weight: 900; color: #64748b; }
.mt-seat .tag { position: absolute; top: -16px; white-space: nowrap; font-size: 9px; font-weight: 900; letter-spacing: .06em; border-radius: 6px; padding: 2px 6px; background: #334155; }
.mt-seat .tag.y { background: var(--m-gold); color: #3b1d02; }
.mt-seat .tag.g { background: var(--m-green); color: #03231a; }
.mt-seat .tag.off { background: #64748b; }


.mt-center { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); z-index: 2; width: 66%; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.mt-plate { width: 100%; padding: 7px 8px; border-radius: 14px; background: rgba(10,20,50,.9); border: 2px solid rgba(255,255,255,.35); }
.mt-plate small { display: block; font-size: 9.5px; letter-spacing: .1em; color: var(--m-mut); font-weight: 800; text-transform: uppercase; }
.mt-plate.slim { padding: 4px 8px; }
.mt-plate b { display: block; font-size: 14px; line-height: 1.2; margin-top: 2px; }
.mt-plate.big { padding: 10px 10px 12px; border: 3px solid #fff; box-shadow: 0 8px 22px rgba(0,0,0,.45); animation: mtPop .35s ease-out; }
.mt-plate.big b { font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 21px; line-height: 1.1; letter-spacing: .01em; }
.mt-plate.big b span { display: block; font-size: 24px; margin-bottom: 2px; }
.mt-team-big { position: relative; width: 58px; height: 80px; border-radius: 11px; border: 4px solid #fff; background: var(--tp); display: grid; place-items: center; overflow: hidden; box-shadow: 0 8px 18px rgba(0,0,0,.5); animation: mtDeal .5s ease-out; }
.mt-team-big::before { content: ''; position: absolute; inset: 17% 8%; border-radius: 50%; background: var(--ts); transform: rotate(-28deg); }
.mt-team-big b { position: relative; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 17px; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.mt-pile { position: relative; width: 60px; height: 78px; }
.mt-pile i { position: absolute; inset: 0; border-radius: 10px; border: 4px solid #fff; background: #0b1a44; transform: translateX(var(--x)) rotate(var(--r)); box-shadow: 0 5px 12px rgba(0,0,0,.5); }
.mt-pile i::before { content: ''; position: absolute; inset: 17% 9%; border-radius: 50%; background: linear-gradient(135deg, #00f2fe, #2563eb); transform: rotate(-28deg); }
.mt-pile i:last-child { animation: mtThrow .45s cubic-bezier(.2,.8,.25,1) both; }

.mt-bottom { padding: 4px 12px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 8px; }
.mt-wait { margin: 0; text-align: center; font-size: 13px; color: var(--m-mut); }
.mt-wait b { color: #fff; }
.mt-hint { margin: 0; text-align: center; font-size: 12.5px; color: #fde68a; }
.mt-actions { display: flex; gap: 10px; }
.mt-actions .masa-btn { flex: 1; }
.mt-hand { display: flex; flex-direction: column; gap: 6px; }
.mt-row { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mt-hand.cols-2 .mt-row { grid-template-columns: repeat(2, 1fr); }
.mt-hand.cols-3 .mt-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mt-hand.cols-4 .mt-row { grid-template-columns: repeat(4, 1fr); }
.mc { position: relative; height: 72px; border-radius: 10px; border: 4px solid #fff; background: var(--tp); color: #111; padding: 0 2px; cursor: pointer; overflow: hidden; box-shadow: 0 5px 12px rgba(0,0,0,.4); transition: transform .15s; font-family: inherit; }
.mc::before { content: ''; position: absolute; inset: 15% 6%; border-radius: 50%; background: #fff; transform: rotate(-28deg); }
/* Name: big, with a white halo so the card colors behind never hide the letters */
.mc b { position: relative; display: block; font-size: 17px; line-height: 1.05; font-weight: 900; letter-spacing: -.01em; color: #0b1220; text-shadow: 0 0 2px #fff, 0 0 4px #fff, 0 0 7px #fff, 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff; overflow-wrap: anywhere; }
.mc b small { display: block; margin-bottom: 1px; font-size: 11.5px; font-weight: 800; color: #7f1d1d; letter-spacing: 0; }
.mc.long b { font-size: 15px; }
.mc.xlong b { font-size: 13px; }
.mc.used { opacity: .18; filter: grayscale(1); }
.mc[disabled] { cursor: default; }
.mc.thrown { transform: translateY(-6px) scale(1.03); box-shadow: 0 0 0 3px var(--m-gold), 0 0 22px rgba(251,191,36,.95); }
.mc i { position: absolute; right: 3px; top: 3px; font-style: normal; font-size: 9px; font-weight: 900; letter-spacing: .08em; padding: 1px 7px; border-radius: 6px; background: var(--m-gold); color: #3b1d02; }
.mt-tape { position: absolute; inset: -3px; z-index: 2; border-radius: 12px; border: 3px solid #fff; display: grid; place-items: center; background: repeating-linear-gradient(-35deg, rgba(17,17,17,.85) 0 12px, rgba(225,29,42,.85) 12px 24px); animation: mtPop .35s ease-out; }
.mt-tape b { background: #111; border: 2px solid #fff; border-radius: 9px; padding: 4px 8px; font-size: 11.5px; }
.mt-teams .ms-team-card { width: 100%; max-width: 54px; }

@keyframes mtSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes mtPop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
@keyframes mtPulse { 50% { transform: scale(1.08); } }
@keyframes mtFlip { from { transform: rotateY(90deg) scale(.7); opacity: 0; } to { transform: rotateY(0) scale(1); opacity: 1; } }
@keyframes mtThrow { from { transform: translateY(170px) rotate(40deg) scale(.8); opacity: 0; } to { transform: translateX(var(--x)) rotate(var(--r)); opacity: 1; } }
@keyframes mtDeal { from { transform: translateY(40px) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-height: 700px) {
  .mt-table { margin: 18px 30px 26px; min-height: 210px; }
  .mc { height: 62px; }
}

/* Short phone screens (iPhone SE in Safari ≈ 375×500): smaller seats, plate, hand and question cards so every card stays on screen */
@media (max-height: 600px) {
  .mt-head { padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 4px; gap: 8px; }
  .mt-head .masa-back { width: 34px; height: 34px; }
  .mt-title b { font-size: 13.5px; }
  .mt-head .masa-timer { height: 44px; min-width: 62px; border-radius: 14px; }
  .mt-head .masa-timer b { font-size: 28px; }
  .mt-banner { margin: 0 12px 2px; padding: 4px 8px; font-size: 12px; }
  .mt-banner + .mt-table { margin-top: 22px; }
  .mt-table { margin: 14px 34px 16px; min-height: 160px; }
  .mt-seat { width: 76px; }
  .mt-seat .mk { width: 46px; height: 49px; }
  .mt-seat .score { top: 26px; right: -4px; min-width: 28px; height: 23px; font-size: 16px; padding: 0 5px; }
  .mt-seat .nm { font-size: 10px; max-width: 78px; padding: 0 5px; }
  .mt-center { width: 52%; gap: 4px; }
  .mt-plate { padding: 4px 6px; border-radius: 11px; }
  .mt-plate small { font-size: 8.5px; }
  .mt-plate b { font-size: 12px; }
  .mt-plate.big { padding: 6px 7px 7px; }
  .mt-plate.big small { display: none; }
  .mt-plate.big b { font-size: 15px; margin: 0; }
  .mt-plate.big b span { display: inline; font-size: 15px; margin: 0; }
  /* who threw is on the seat tags; the pile would push the plate into the seats */
  .mt-table.phase-card_pick .mt-pile { display: none; }
  .mt-team-big { width: 42px; height: 58px; border-width: 3px; }
  .mt-team-big b { font-size: 13px; }
  .mt-bottom { padding: 2px 10px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  .mt-wait, .mt-hint { font-size: 11.5px; }
  .mt-hand, .mt-row { gap: 5px; }
  .mc { height: 50px; border-width: 3px; border-radius: 8px; }
  .mc b { font-size: 15px; }
  .mc b small { font-size: 10px; margin: 0; }
  .mc.long b { font-size: 13px; }
  .mc.xlong b { font-size: 11.5px; }
  .mt-teams .ms-team-card { height: 56px; border-width: 3px; }
  .mt-actions .masa-btn { padding: 10px 12px; font-size: 14px; }
  .masa-foot { padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
  .masa-foot .masa-btn { padding: 10px 8px; }
  .me-pod .blk { font-size: 22px; }
}
