*{box-sizing:border-box}
html,body{margin:0;padding:0;min-height:100%}
body.territory-arcade-page{font-family:Arial,Helvetica,sans-serif;background:radial-gradient(circle at top,#173b36 0%,#0d2530 42%,#06111e 100%);color:#eef2ff}
button{font:inherit}
.is-hidden{display:none !important}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.territory-shell{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:18px}
.territory-stage{position:relative;width:min(1220px,100%)}
.territory-frame{position:relative;width:100%;border-radius:28px;overflow:hidden;background:linear-gradient(180deg,#071d2a 0%,#07111f 100%);box-shadow:0 28px 70px rgba(0,0,0,.42);border:1px solid rgba(148,163,184,.16)}
#territoryCanvas{display:block;width:100%;height:auto;max-height:calc(100vh - 70px);background:#102235}
.territory-hud{position:absolute;left:18px;right:18px;top:18px;z-index:5;display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.territory-hud>div{padding:8px 14px;border-radius:999px;background:rgba(6,17,30,.84);border:1px solid rgba(148,163,184,.18);backdrop-filter:blur(8px);font-size:14px;box-shadow:0 8px 18px rgba(0,0,0,.18)}
.territory-hud-actions{margin-left:auto;display:flex;gap:8px;background:transparent !important;border:0 !important;padding:0 !important;box-shadow:none !important}
.territory-hud-btn{border:1px solid rgba(148,163,184,.24);background:rgba(6,17,30,.92);color:#eef2ff;border-radius:14px;padding:10px 15px;font-weight:700;cursor:pointer}
.territory-hud-btn:hover,.territory-main-btn:hover,.territory-start-btn:hover,.territory-action-btn:hover{filter:brightness(1.05)}
.territory-status-bar{position:absolute;left:24px;right:24px;bottom:76px;z-index:4;display:flex;justify-content:center;pointer-events:none}
.territory-status-text{min-height:34px;padding:8px 12px;border-radius:14px;background:rgba(6,17,30,.9);border:1px solid rgba(148,163,184,.18);box-shadow:0 10px 24px rgba(0,0,0,.2);font-size:13px;font-weight:700;color:#eff6ff;text-align:center;max-width:min(700px,100%)}
.territory-control-dock{position:absolute;left:0;right:0;bottom:0;z-index:4;min-height:62px;padding:7px 14px 6px;background:linear-gradient(180deg,rgba(35,75,68,.94) 0%,rgba(22,48,48,.98) 100%);display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:center;border-top:2px solid rgba(110,151,122,.48)}
.territory-score-strip{display:flex;align-items:center;gap:8px;min-width:0;overflow:auto;padding-bottom:2px}
.score-pill{position:relative;display:grid;grid-template-columns:12px max-content;grid-template-areas:"dot name" "dot score";align-items:center;column-gap:8px;min-width:138px;padding:6px 30px 6px 9px;border-radius:12px;background:rgba(6,17,30,.86);border:1px solid rgba(255,255,255,.12)}
.score-pill.is-current{border-color:#fde68a;box-shadow:0 0 0 2px rgba(253,230,138,.18) inset}
.score-pill.is-current::after{content:"";position:absolute;right:8px;top:7px;width:18px;height:18px;border-radius:999px;background:#fde68a url("../../assets/icons/action-play.svg") center/12px 12px no-repeat;filter:drop-shadow(0 2px 4px rgba(0,0,0,.26))}
.score-pill.is-expired{animation:territoryPulse 1s ease-in-out infinite;border-color:#fca5a5;cursor:pointer}
.score-pill.is-out{opacity:.48}
.score-dot{grid-area:dot;width:12px;height:34px;border-radius:999px}
.score-name{grid-area:name;font-size:13px;font-weight:800;white-space:nowrap}
.score-value{grid-area:score;font-size:12px;color:#dbeafe;white-space:nowrap}
.territory-control-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.territory-action-btn{min-height:38px;padding:0 10px;border-radius:12px;border:1px solid rgba(255,255,255,.12);background:rgba(6,17,30,.88);color:#f8fafc;font-weight:800;cursor:pointer}
.territory-action-btn.is-warning{background:#7f1d1d}
.territory-icon-action{width:40px;padding:0;display:inline-flex;align-items:center;justify-content:center}
.territory-icon-action img{width:20px;height:20px;filter:invert(1)}
.territory-alert-mark{display:inline-flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:999px;background:#dc2626;color:#fff;font-size:22px;font-weight:900;line-height:1;animation:territoryPulse 1s ease-in-out infinite}
.territory-overlay{position:absolute;inset:0;display:none;align-items:center;justify-content:center;z-index:7;background:rgba(2,6,23,.54);padding:20px;border-radius:28px}
.territory-overlay.show{display:flex}
.territory-card{width:min(780px,96%);max-height:calc(100vh - 40px);overflow:auto;background:rgba(7,18,31,.96);border:1px solid rgba(148,163,184,.18);border-radius:26px;padding:24px;box-shadow:0 24px 60px rgba(0,0,0,.42)}
.territory-card h1,.territory-card h2{margin:0 0 12px}
.territory-card p{margin:0;color:#dbe4ff;line-height:1.6}
.small-card{max-width:560px}
.territory-eyebrow{font-size:13px;letter-spacing:.09em;text-transform:uppercase;color:#86efac;margin-bottom:8px}
.territory-setup-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:20px 0 16px}
.territory-setup-group{display:grid;gap:8px}
.territory-setup-group--wide{grid-column:1 / -1}
.territory-setup-label{font-size:13px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#cbd5e1}
.territory-choice-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.territory-choice-row--days{grid-template-columns:repeat(4,minmax(0,1fr))}
.territory-main-btn{border:0;border-radius:16px;min-height:62px;padding:10px 12px;font-size:18px;font-weight:800;cursor:pointer}
.territory-main-btn.is-green{background:#22c55e;color:#052e16}
.territory-main-btn.is-blue{background:#2563eb;color:#eff6ff}
.territory-main-btn.is-selected{outline:3px solid rgba(255,255,255,.55);box-shadow:0 0 0 2px rgba(15,23,42,.45) inset}
.territory-main-btn:disabled{opacity:.42;cursor:not-allowed;filter:saturate(.55)}
.territory-open-games{display:grid;gap:8px;margin:18px 0 6px;max-height:min(340px,45vh);overflow:auto;padding-right:4px}
.territory-open-games-head,.territory-open-game{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;align-items:center}
.territory-open-games-head{padding:0 4px;color:#cbd5e1;font-size:12px;font-weight:800;text-transform:uppercase}
.territory-open-game{width:100%;min-height:48px;padding:10px 12px;border:1px solid rgba(148,163,184,.22);border-radius:14px;background:#0d1b2c;color:#eef2ff;text-align:left;cursor:pointer}
.territory-open-game span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.territory-open-game strong{color:#86efac;white-space:nowrap}
.territory-open-empty{padding:14px 16px;border-radius:14px;background:#0d1b2c;border:1px solid rgba(148,163,184,.18);color:#dbe4ff;line-height:1.5}
.territory-computer-mode{display:grid;gap:12px;margin:20px 0 8px;padding:16px;border:1px solid rgba(134,239,172,.3);border-radius:18px;background:linear-gradient(135deg,rgba(20,83,45,.32),rgba(13,27,44,.88))}
.territory-mode-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.territory-mode-heading>div{display:grid;gap:4px}
.territory-mode-heading strong{font-size:17px;color:#f0fdf4}
.territory-mode-heading span{font-size:12px;color:#bbf7d0}
.territory-mode-badge{flex:0 0 auto;padding:5px 9px;border-radius:999px;background:#22c55e;color:#052e16 !important;font-size:11px !important;font-weight:900;text-transform:uppercase}
.territory-ai-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.territory-ai-options button{display:grid;gap:3px;min-height:62px;padding:10px 12px;border:1px solid rgba(255,255,255,.16);border-radius:14px;background:#102b2e;color:#f8fafc;text-align:left;cursor:pointer}
.territory-ai-options button:hover,.territory-ai-options button:focus-visible{border-color:#86efac;background:#153b35;outline:0;transform:translateY(-1px)}
.territory-ai-options strong{font-size:15px;color:#fde68a}
.territory-ai-options span{font-size:11px;line-height:1.35;color:#dbeafe}
.boot-bottom-row{display:flex;align-items:flex-end;justify-content:space-between;gap:14px}
.territory-help-box{padding:14px 16px;border-radius:18px;background:#0d1b2c;border:1px solid rgba(148,163,184,.18);color:#dbe4ff;line-height:1.6}
.territory-start-btn{min-height:58px;padding:0 20px;border:0;border-radius:18px;background:#f59e0b;color:#1f1300;font-size:18px;font-weight:900;cursor:pointer}
.compact-start-btn{min-height:50px;font-size:16px;border-radius:14px}
.territory-send-icon-btn{width:52px;padding:0;display:inline-flex;align-items:center;justify-content:center}
.territory-send-icon-btn img{width:21px;height:21px;filter:brightness(0) saturate(100%)}
.kick-vote-list{display:grid;gap:8px;margin-top:14px}
.kick-vote-list label,.kick-vote-row{display:flex;align-items:center;gap:9px;min-height:42px;padding:8px 10px;border-radius:12px;background:#0d1b2c;border:1px solid rgba(148,163,184,.16)}
.kick-vote-summary{margin-top:10px;padding:9px 11px;border-radius:12px;background:#0d1b2c;border:1px solid rgba(148,163,184,.16);font-weight:800;color:#fde68a}
.team-chat-messages{display:grid;align-content:start;gap:3px;min-height:132px;max-height:220px;overflow:auto;margin:10px 0;padding:4px;border-radius:10px;background:#0d1b2c;border:1px solid rgba(148,163,184,.16)}
.team-chat-message{display:grid;gap:2px;padding:5px 6px;border-radius:7px;background:rgba(255,255,255,.05);font-size:12px;line-height:1.25}
.team-chat-message.is-other{background:rgba(96,165,250,.10)}
.team-chat-message-head{display:flex;align-items:center;gap:5px}
.team-chat-message strong{font-size:12px;color:#86efac}
.team-chat-message time{margin-left:auto;color:#bfd0ff;font-size:10px;white-space:nowrap}
.team-chat-message span{line-height:1.35;color:#eef2ff}
.team-chat-empty{margin:0;color:#cbd5e1}
.team-chat-compose{display:grid;gap:6px;font-weight:800;color:#cbd5e1}
.team-chat-compose textarea{min-height:52px;max-height:82px;resize:none;border-radius:8px;border:1px solid rgba(148,163,184,.26);background:#06111e;color:#eef2ff;padding:7px 8px;font:inherit}
.overlay-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:16px;flex-wrap:wrap}
.centered-actions{justify-content:center}
.result-card{text-align:center}
.result-message{font-size:24px;line-height:1.45;font-weight:800;color:#f8fbff;text-shadow:0 2px 10px rgba(0,0,0,.28);white-space:pre-line}
@keyframes territoryPulse{
  0%,100%{box-shadow:0 0 0 0 rgba(248,113,113,.16),0 0 0 2px rgba(248,113,113,.18) inset}
  50%{box-shadow:0 0 0 7px rgba(248,113,113,.24),0 0 0 2px rgba(248,113,113,.34) inset}
}

@media (max-width:760px){
  .territory-control-dock{grid-template-columns:1fr;gap:8px;padding:10px 10px 8px}
  .territory-control-actions{justify-content:stretch}
  .territory-action-btn{flex:1 1 130px}
  .territory-status-bar{bottom:126px}
  .territory-setup-grid{grid-template-columns:1fr}
  .territory-setup-group--wide{grid-column:auto}
  .territory-choice-row,.territory-choice-row--days{grid-template-columns:1fr 1fr}
  .territory-ai-options{grid-template-columns:1fr}
  .boot-bottom-row{flex-direction:column;align-items:stretch}
  .territory-start-btn{width:100%}
}
@media (max-width:720px){
  .territory-shell{padding:10px}
  .territory-hud{left:10px;right:10px;top:10px;gap:8px}
  .territory-hud>div{font-size:12px;padding:7px 10px}
  .territory-status-bar{left:12px;right:12px;bottom:136px}
  .territory-overlay{padding:10px}
  .territory-card{padding:18px}
}
@media (pointer:coarse) and (orientation:landscape) and (max-height:640px){
  .territory-shell{padding:8px}
  #territoryCanvas{max-height:calc(100vh - 18px)}
  .territory-hud{left:8px;right:8px;top:8px;gap:6px}
  .territory-hud>div{font-size:11px;padding:6px 9px}
  .territory-hud-btn{padding:8px 12px;border-radius:12px;min-height:40px}
  .territory-status-bar{bottom:76px}
  .territory-status-text{min-height:32px;padding:7px 10px;font-size:12px;border-radius:12px}
  .territory-control-dock{grid-template-columns:minmax(0,1fr) auto;min-height:62px;padding:8px 10px 6px;gap:8px}
  .territory-action-btn{min-height:40px;padding:0 10px;border-radius:12px;font-size:13px}
  .score-pill{min-width:118px;padding:6px 8px}
  .territory-card{max-height:calc(100vh - 16px);padding:18px;border-radius:20px}
  .territory-main-btn{min-height:52px;font-size:15px}
}
