/**
 * @file masa-base.css
 * @description Futello Masası overlay and its non-game screens (hub, setup with team picker, waiting room, end screen): UNO-style bright blue backdrop, white-rimmed colored cards, shared buttons, inputs, toast and timer.
 * @dependencies css/main.css variables (fonts)
 */

body.masa-open { overflow: hidden; }
.masa-root {
  --m-blue: #2b6cf0; --m-navy: #0a1538; --m-gold: #fbbf24; --m-red: #f43f5e; --m-green: #10b981;
  --m-card: rgba(10, 20, 50, .82); --m-line: rgba(255, 255, 255, .14); --m-mut: #bfdbfe; --m-txt: #f8fafc;
  position: fixed; inset: 0; z-index: 9000; color: var(--m-txt);
  font-family: var(--font-family, 'Outfit', sans-serif);
  background: radial-gradient(120% 70% at 50% 30%, #2b6cf0 0%, #1e3a8a 48%, #0a1538 100%);
}
.masa-root[hidden] { display: none; }
.masa-app { position: relative; height: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; }
.masa-app > * { min-height: 0; }
.masa-head { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 8px; }
.masa-head small { display: block; font-size: 11px; letter-spacing: .14em; color: var(--m-mut); font-weight: 800; }
.masa-head h2 { margin: 0; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 24px; letter-spacing: .06em; line-height: 1.05; }
.masa-back { width: 38px; height: 38px; flex: none; border-radius: 12px; border: 2px solid rgba(255,255,255,.6); background: rgba(10,20,50,.5); color: #fff; font-size: 22px; font-weight: 900; cursor: pointer; }
.masa-scroll { flex: 1; overflow-y: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.masa-foot { display: flex; gap: 10px; padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px)); }
.masa-foot > * { flex: 1; }

.masa-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; border-radius: 16px; padding: 13px 16px; cursor: pointer; text-decoration: none;
  font-family: var(--font-display, 'Rajdhani', sans-serif); font-weight: 700; font-size: 18px; letter-spacing: .06em; text-transform: uppercase;
  color: #062033; background: linear-gradient(180deg, #7df9ff, #00c6e0); box-shadow: 0 4px 0 #036b7a; }
.masa-btn.gold { color: #3b1d02; background: linear-gradient(180deg, #fff59d, #fbbf24 40%, #d97706); box-shadow: 0 4px 0 #78350f; }
.masa-btn.red { color: #fff; background: linear-gradient(180deg, #fda4af, #f43f5e 45%, #be123c); box-shadow: 0 4px 0 #7f1d1d; }
.masa-btn.ghost { color: #fff; background: rgba(10,20,50,.6); box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); }
.masa-btn.wa { color: #fff; background: linear-gradient(180deg, #4ade80, #16a34a); box-shadow: 0 4px 0 #14532d; }
.masa-btn[disabled] { opacity: .45; cursor: default; }
.masa-input { width: 100%; box-sizing: border-box; border-radius: 12px; border: 2px solid rgba(255,255,255,.35); background: rgba(10,20,50,.75); color: #fff; padding: 11px 12px; font-size: 16px; font-weight: 700; font-family: inherit; }
.masa-input.code { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 20px; }
.masa-input.pin { letter-spacing: .4em; text-align: center; max-width: 120px; }
.masa-toast { position: absolute; left: 16px; right: 16px; bottom: 90px; z-index: 50; border-radius: 14px; padding: 12px 14px; background: #111; border: 2px solid #fff; font-weight: 700; font-size: 14px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.6); cursor: pointer; }
.masa-timer { margin-left: auto; position: relative; flex: none; min-width: 74px; height: 54px; border-radius: 16px; background: #111; border: 3px solid #fff; display: grid; place-items: center; overflow: hidden; box-shadow: 0 6px 16px rgba(0,0,0,.45); }
.masa-timer b { position: relative; z-index: 1; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 34px; line-height: 1; }
.masa-timer i { position: absolute; left: 0; bottom: 0; height: 6px; background: var(--m-gold); width: 100%; transition: width .25s linear; }
/* Last seconds: red and beating */
.masa-timer.urgent { background: #b91c1c; border-color: #fecaca; animation: masaBeat 1s ease-in-out infinite; }
.masa-timer.urgent i { background: #fff; }
@keyframes masaBeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }

.mh-card { background: var(--m-card); border: 1px solid var(--m-line); border-radius: 18px; padding: 12px 14px; }
.mh-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mh-card h3 small { font-size: 11px; color: var(--m-mut); font-weight: 600; }
.mh-refresh { margin-left: auto; border: none; background: rgba(255,255,255,.12); color: #fff; border-radius: 10px; width: 30px; height: 30px; font-size: 16px; cursor: pointer; }
.mh-hero { text-align: center; padding: 8px 0 4px; }
.mh-hero p { margin: 10px 0 14px; color: var(--m-mut); font-size: 14px; }
.mh-hero .masa-btn { width: 100%; }
.mh-cards { position: relative; height: 92px; }
.mh-cards i { position: absolute; left: 50%; top: 4px; width: 58px; height: 82px; margin-left: -29px; border-radius: 10px; border: 4px solid #fff; background: #0b1a44; box-shadow: 0 6px 14px rgba(0,0,0,.5); }
.mh-cards i::before { content: ''; position: absolute; inset: 16% 9%; border-radius: 50%; background: linear-gradient(135deg, #00f2fe, #2563eb); transform: rotate(-28deg); }
.mh-cards i:nth-child(1) { transform: translateX(-38px) rotate(-14deg); background: #e11d2a; }
.mh-cards i:nth-child(3) { transform: translateX(38px) rotate(14deg); background: #16a34a; }
.mh-join { display: flex; gap: 8px; }
.mh-join .masa-btn { flex: none; font-size: 16px; padding: 10px 14px; }
.mh-note { display: block; margin-top: 8px; font-size: 12px; color: #fde68a; }
.mh-note.bad { color: #fca5a5; }
.mh-empty { margin: 4px 0; font-size: 13px; color: var(--m-mut); }
.mh-table { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 8px; border-radius: 14px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: #fff; cursor: pointer; text-align: left; font-family: inherit; }
.mh-code { font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 20px; letter-spacing: .12em; padding: 4px 8px; border-radius: 8px; background: #111; border: 2px solid #fff; }
.mh-info { flex: 1; min-width: 0; }
.mh-info b { display: block; font-size: 14px; }
.mh-info small { font-size: 11px; color: var(--m-mut); }
.mh-seats { font-weight: 900; color: var(--m-gold); }
.mh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.mh-stats b { display: block; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 26px; color: var(--m-gold); }
.mh-stats small { font-size: 10.5px; color: var(--m-mut); }
.mh-rank { margin: 0; padding: 0; list-style: none; }
.mh-rank li { display: flex; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 14px; }
.mh-rank li.me { color: var(--m-gold); }
.mh-rank li span { width: 26px; color: var(--m-mut); }
.mh-rank li b { flex: 1; }
.mh-rank li em { font-style: normal; font-weight: 800; }
.mh-rank li.empty { color: var(--m-mut); }

.ms-segs { display: flex; gap: 8px; flex-wrap: wrap; }
.ms-seg { flex: 1; min-width: 70px; border-radius: 12px; padding: 10px 8px; border: 2px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: #fff; font-weight: 800; font-size: 14px; cursor: pointer; font-family: inherit; }
.ms-seg small { display: block; font-size: 10.5px; font-weight: 600; color: var(--m-mut); margin-top: 2px; }
.ms-seg.on { border-color: var(--m-gold); background: rgba(251,191,36,.18); box-shadow: 0 0 14px rgba(251,191,36,.35); }
.ms-label { margin: 12px 0 6px; font-size: 12px; font-weight: 800; color: var(--m-mut); letter-spacing: .08em; }
.ms-pin { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 13px; font-weight: 700; }
.ms-teams, .mt-teams { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ms-team { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; border: none; background: none; color: #fff; cursor: pointer; padding: 0; font-family: inherit; }
.ms-team small { font-size: 10px; line-height: 1.1; text-align: center; color: #e2e8f0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-team i { font-style: normal; font-size: 9px; color: var(--m-mut); }
.ms-team em { position: absolute; top: -6px; right: 0; font-style: normal; font-size: 14px; }
.ms-team-card { position: relative; width: 52px; height: 70px; border-radius: 10px; border: 4px solid #fff; background: var(--tp); display: grid; place-items: center; box-shadow: 0 5px 12px rgba(0,0,0,.45); overflow: hidden; }
.ms-team-card::before { content: ''; position: absolute; inset: 17% 8%; border-radius: 50%; background: var(--ts); transform: rotate(-28deg); }
.ms-team-card b { position: relative; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 15px; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.ms-picker { position: absolute; inset: 0; z-index: 40; background: rgba(2,6,23,.75); display: flex; align-items: flex-end; }
.ms-picker-box { width: 100%; max-height: 86%; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: 22px 22px 0 0; background: #0f1d4a; border-top: 3px solid #fff; }
.ms-picker-box header { display: flex; justify-content: space-between; align-items: center; font-size: 18px; }
.ms-picker-list { overflow-y: auto; }
.ms-picker-list h4 { margin: 12px 0 8px; font-size: 13px; color: var(--m-mut); }
.ms-pick-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.ms-pick { display: flex; flex-direction: column; align-items: center; gap: 4px; border: none; background: none; color: #fff; cursor: pointer; font-family: inherit; }
.ms-pick small { font-size: 10px; text-align: center; line-height: 1.1; }
.ms-pick.in { opacity: .45; }

.ml-code { text-align: center; }
.ml-code-big { font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 48px; letter-spacing: .3em; line-height: 1.1; }
.ml-code small { color: var(--m-mut); }
.ml-share { display: flex; gap: 8px; margin-top: 12px; }
.ml-share .masa-btn { flex: 1; font-size: 15px; padding: 10px; }
.ml-seats { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ml-seats li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.ml-seats li.off { opacity: .55; }
.ml-seats li.empty { opacity: .45; }
.ml-seats li b { flex: 1; }
.ml-seats li em { font-style: normal; font-size: 12px; color: var(--m-gold); font-weight: 700; }
.ml-seats li em.off { color: #fca5a5; }
.ml-seats .av, .me-pod .av { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; border: 3px solid #fff; background: rgba(255,255,255,.15); }
.ml-sum { margin: 0 0 10px; font-weight: 700; }
.ml-teams { display: flex; gap: 6px; flex-wrap: wrap; }
.ml-teams span { position: relative; width: 34px; height: 46px; border-radius: 7px; border: 3px solid #fff; background: var(--tp); display: grid; place-items: center; overflow: hidden; }
.ml-teams span::before { content: ''; position: absolute; inset: 18% 8%; border-radius: 50%; background: var(--ts); transform: rotate(-28deg); }
.ml-teams b { position: relative; font-size: 10px; text-shadow: 0 1px 2px #000; }
.ml-wait { text-align: center; padding: 14px; font-weight: 700; color: var(--m-mut); }

.masa-app > .me { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.me-podium { display: flex; justify-content: center; align-items: flex-end; gap: 10px; padding: 8px 0 4px; }
.me-pod { width: 96px; text-align: center; }
.me-pod .crown { font-size: 26px; }
.me-pod .av { margin: 0 auto 6px; }
.me-pod .blk { border: 4px solid #fff; border-bottom: none; border-radius: 12px 12px 0 0; display: grid; place-items: center; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 28px; }
.me-pod b { display: block; margin-top: 6px; font-size: 14px; }
.me-pod em { font-style: normal; color: var(--m-gold); font-weight: 800; font-size: 13px; }
.me-rows { margin: 0; padding: 0; list-style: none; }
.me-rows li { display: flex; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 14px; }
.me-rows li.me { color: var(--m-gold); }
.me-rows li span { width: 22px; }
.me-rows li b { flex: 1; }
.me-rows li em { font-style: normal; font-size: 12px; color: var(--m-mut); }
.me-rows li i { font-style: normal; font-weight: 900; color: #86efac; }
.me-title { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.me-title span { font-size: 28px; }
.me-title small { display: block; color: var(--m-mut); font-size: 12px; }

/* Home screen entry tile (rendered by js/ui/lobby/lobby-home-sections.js) */
.home-tile.home-tile-masa { grid-column: 1 / -1; background: linear-gradient(90deg, rgba(43, 108, 240, .35), rgba(225, 29, 42, .22)); border-color: rgba(255, 255, 255, .22); }
.em-masa { background: rgba(251, 191, 36, .2); }
.home-new { font-style: normal; font-size: 9px; font-weight: 900; letter-spacing: .06em; color: #3b1d02; background: #fbbf24; border-radius: 6px; padding: 1px 5px; margin-left: 4px; vertical-align: middle; }

/* Bottom dock "Masa" tab (js/ui/lobby/lobby-home-sections.js renderHomeDock): mini fanned UNO-style cards */
.home-dock-tab.dock-masa { color: #fbbf24 !important; }
.home-dock-tab.dock-masa .home-dock-label { background: linear-gradient(90deg, #fde68a, #fbbf24, #f97316); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 900; }
.dock-masa-cards { position: relative; width: 54px; padding: 0 !important; overflow: visible; }
.dock-masa-cards i { position: absolute; left: 50%; top: 1px; width: 15px; height: 21px; margin-left: -7.5px; border-radius: 3.5px; border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,.5); transform-origin: 50% 120%; animation: dockMasaFan 3.2s ease-in-out infinite; }
.dock-masa-cards i::before { content: ''; position: absolute; inset: 22% 10%; border-radius: 50%; background: rgba(255,255,255,.85); transform: rotate(-28deg); }
.dock-masa-cards i:nth-child(1) { background: #e11d2a; --r: -22deg; }
.dock-masa-cards i:nth-child(2) { background: #2563eb; --r: 0deg; z-index: 1; }
.dock-masa-cards i:nth-child(3) { background: #16a34a; --r: 22deg; }
.dock-masa-cards em { position: absolute; top: -7px; right: -2px; z-index: 2; font-style: normal; font-size: 7.5px; font-weight: 900; letter-spacing: .04em; color: #fff; background: #e11d2a; border: 1.5px solid #fff; border-radius: 6px; padding: 0 3px; line-height: 11px; box-shadow: 0 0 8px rgba(225,29,42,.8); }
@keyframes dockMasaFan {
  0%, 100% { transform: rotate(var(--r)); }
  50% { transform: rotate(calc(var(--r) * 1.35)) translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) { .dock-masa-cards i { animation: none; transform: rotate(var(--r)); } }
