
:root { color-scheme: dark; --bg:#111914; --panel:#19231d; --line:#ffffff14; --text:#edf1e8; --muted:#a0ada0; --accent:#d1e99a; --accent-ink:#233315; --danger:#efaaa2; }
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html,body { margin:0; width:100%; height:100%; background:var(--bg); color:var(--text); font-family:Inter,Pretendard,"Noto Sans KR",system-ui,sans-serif; }
body { overflow:hidden; }
button,input,select,textarea { font:inherit; }
button { min-height:44px; padding:10px 14px; border:1px solid var(--line); border-radius:10px; color:var(--text); background:#ffffff05; cursor:pointer; touch-action:manipulation; white-space:nowrap; }
button:hover { background:#ffffff0c; border-color:#d1e99a55; }
button:disabled { opacity:.35; cursor:default; }
button.active,button[aria-pressed="true"],button[aria-expanded="true"],.primary-button { background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:700; }
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
input,select,textarea { width:100%; min-height:44px; padding:11px; border:1px solid var(--line); border-radius:9px; background:#111a14; color:var(--text); font-size:16px; }
textarea { resize:vertical; }
label { display:grid; gap:8px; font-size:12px; color:var(--muted); }
.muted { color:var(--muted); font-size:12px; line-height:1.8; }
.eyebrow,.section-label { margin:0; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.13em; }
.full-width { width:100%; }
.panel { background:var(--panel); border:1px solid var(--line); }
.danger-text,.danger-button { color:var(--danger); }
.danger-button { margin-top:12px; }
.auth-gate { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, #183c2a 0, #07110d 52%); }
.auth-card { width: min(430px, calc(100% - 36px)); padding: 44px; text-align: center; background: rgba(8, 23, 16, .88); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 30px 90px #0008; }
.brand-mark { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 22px; color: var(--accent-ink); background: var(--accent); border-radius: 15px; font-weight: 950; letter-spacing: -.08em; }
.brand-mark.small { width: 34px; height: 34px; margin: 0; border-radius: 10px; font-size: 14px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .18em; }
.auth-card h1 { margin: 10px 0; font-size: clamp(27px, 6vw, 39px); letter-spacing: -.04em; }
.auth-card p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.auth-card button { width: 100%; margin-top: 12px; }


.app-shell { height:100dvh; display:flex; flex-direction:column; }
.topbar { flex:0 0 72px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:0 28px; border-bottom:1px solid var(--line); position:relative; z-index:30; }
.brand { display:flex; align-items:center; gap:11px; }
.brand > div { display:grid; gap:4px; }
.brand strong { font-size:16px; letter-spacing:-.04em; }
.brand span:not(.brand-mark) { font-size:8px; letter-spacing:.15em; color:var(--muted); }
.match-heading { display:grid; gap:5px; text-align:center; min-width:0; }
.match-heading strong { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.save-status,#saveStatus { font-size:10px; color:var(--muted); }
.file-menu { position:absolute; right:20px; top:66px; padding:8px; width:240px; border-radius:14px; box-shadow:0 16px 50px #0008; display:grid; gap:4px; }
.file-menu button { text-align:left; }
.workspace { flex:1; min-height:0; display:flex; gap:20px; padding:22px 28px 16px; }
.board-column { flex:1; min-width:0; min-height:0; display:grid; grid-template-rows:auto auto minmax(0,1fr) auto auto; gap:12px; }
.workspace-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
h1 { margin:5px 0 0; font-size:24px; font-weight:550; letter-spacing:-.04em; max-width:35vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mode-switch { display:flex; gap:3px; padding:4px; background:#0c140f; border:1px solid var(--line); border-radius:12px; }
.mode-switch button { border:0; min-height:40px; font-size:12px; }
.board-toolbar { display:flex; gap:8px; align-items:center; justify-content:space-between; min-width:0; }
.tool-buttons { display:flex; gap:5px; overflow-x:auto; scrollbar-width:thin; min-width:0; padding:2px; }
.tool-buttons button { flex-shrink:0; font-size:14px; }
.tool-buttons button span { font-size:11px; }
.history-buttons { display:flex; gap:4px; flex-shrink:0; }
.history-buttons button { width:44px; padding:8px; font-size:20px; }
.board-frame { min-height:0; position:relative; border:1px solid #ffffff1f; border-radius:16px; overflow:hidden; background:#0c1710; }
#board { width:100%; height:100%; display:block; touch-action:none; user-select:none; -webkit-user-select:none; }
.view-controls { position:absolute; right:12px; bottom:12px; display:flex; gap:2px; background:#101b16ed; padding:3px; border:1px solid var(--line); border-radius:12px; }
.view-controls button { border:0; font-size:12px; padding:7px 10px; }
.view-controls button:first-child,.view-controls button:last-child { width:40px; font-size:20px; }
.selection-bar { position:absolute; top:12px; left:12px; right:12px; margin:auto; width:max-content; max-width:calc(100% - 24px); display:flex; align-items:center; gap:8px; padding:4px 5px 4px 12px; border:1px solid #d1e99a55; background:#14231aee; border-radius:12px; }
.selection-bar span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.selection-bar button { border:0; }
.board-caption { display:flex; justify-content:space-between; gap:8px; color:var(--muted); font-size:11px; min-height:17px; }
#sceneCounter { font-variant-numeric:tabular-nums; white-space:nowrap; letter-spacing:.1em; }
.workspace-nav { display:flex; gap:8px; align-items:center; }
.workspace-nav > button { display:flex; align-items:center; gap:8px; font-size:16px; }
.workspace-nav span { font-size:12px; }
.scene-navigation { display:flex; gap:4px; margin-left:auto; }
.workspace-panel { flex:0 0 310px; width:310px; border-radius:16px; display:flex; flex-direction:column; min-height:0; }
.panel-heading { display:flex; align-items:center; justify-content:space-between; padding:20px; border-bottom:1px solid var(--line); }
.panel-heading h2 { margin:5px 0 0; font-size:19px; font-weight:550; }
.panel-heading button { border:0; font-size:23px; }
.panel-content { padding:20px; overflow-y:auto; overscroll-behavior:contain; }
#teamPanel section + section { border-top:1px solid var(--line); padding-top:20px; margin-top:20px; }
.match-inputs { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:6px; margin-top:12px; }
.match-inputs input { min-width:0; font-size:14px; }
.match-inputs span { font-size:10px; color:var(--muted); }
.fotmob-box { display:grid; gap:8px; margin-top:14px; }
.fotmob-box small { color:var(--muted); font-size:11px; line-height:1.6; }
.section-heading { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.section-heading > span { font-size:10px; color:var(--muted); }
.formation-row,.split-fields,.team-tabs { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
.team-tabs button { overflow:hidden; text-overflow:ellipsis; }
.roster-caption { font-size:11px; color:var(--muted); margin:16px 0 8px; }
.roster-list { display:grid; gap:5px; }
.roster-player { display:grid; grid-template-columns:30px minmax(0,1fr) 34px; gap:8px; align-items:center; width:100%; text-align:left; padding:8px; }
.roster-player .number { display:grid; place-items:center; background:var(--player-color); color:#172114; border-radius:50%; width:28px; height:28px; font-size:11px; font-weight:800; }
.roster-player .name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; }
.roster-player .position { font-size:10px; color:var(--muted); text-align:right; }
.bench-player { grid-template-columns:30px minmax(0,1fr) auto; }
.sub-button { font-size:11px; padding:8px; }
.bench-empty,.substitution-hint { font-size:12px; color:var(--muted); line-height:1.7; padding:10px 0; }
.sub-target { border-color:var(--accent); }
#inspectorForm,#viewPanel { display:grid; gap:18px; }
.inspector-empty { text-align:center; padding:40px 0; color:var(--muted); line-height:1.8; font-size:13px; }
.inspector-empty > span { font-size:32px; }
.check-row { display:flex; align-items:center; gap:10px; min-height:44px; }
.check-row input { width:20px; height:20px; min-height:0; accent-color:var(--accent); }
.legend { display:grid; gap:10px; color:var(--muted); font-size:12px; }
.scene-list { display:grid; gap:8px; margin:16px 0; }
.scene-button { display:grid; grid-template-columns:64px 1fr; column-gap:12px; text-align:left; align-items:center; white-space:normal; }
.scene-button svg { width:64px; grid-row:1 / 3; border-radius:4px; background:#294332; }
.scene-button strong { font-size:10px; color:var(--muted); }
.scene-button span { font-size:12px; overflow:hidden; text-overflow:ellipsis; }
.scene-button.active { background:#d1e99a0b; color:var(--text); border-color:var(--accent); }
.scene-editor { display:grid; gap:14px; padding-top:16px; border-top:1px solid var(--line); }
.toast { position:fixed; bottom:90px; left:50%; transform:translateX(-50%); z-index:80; max-width:90vw; padding:12px 18px; border-radius:12px; background:var(--accent); color:var(--accent-ink); box-shadow:0 8px 40px #0007; font-size:13px; }
dialog { width:min(400px,calc(100% - 32px)); color:var(--text); background:var(--panel); border:1px solid var(--line); border-radius:18px; padding:24px; }
dialog::backdrop { background:#0009; }
dialog h2 { font-size:19px; margin-top:0; }
dialog form > div { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.pitch-line { fill: none; stroke: rgba(240,255,245,.72); stroke-width: 3; vector-effect: non-scaling-stroke; }
.player-node { cursor: grab; }
.player-node:active { cursor: grabbing; }
.player-node.selected .player-disc { stroke: var(--accent); stroke-width: 6; }
.player-disc { stroke: rgba(0,0,0,.58); stroke-width: 4; filter: url(#shadow); }
.player-number { fill: #10150f; font-size: 16px; font-weight: 950; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.player-label { fill: white; stroke: #07110d; stroke-width: 4; paint-order: stroke; font-size: 13px; font-weight: 800; text-anchor: middle; pointer-events: none; }
.player-position { fill: #dce8df; stroke: #07110d; stroke-width: 3; paint-order: stroke; font-size: 10px; font-weight: 750; text-anchor: middle; pointer-events: none; }
.drawing { cursor: pointer; }
.drawing.selected { filter: drop-shadow(0 0 5px var(--accent)); }
.drawing-line { fill: none; stroke-linecap: round; stroke-width: 7; }
.drawing-zone { stroke-width: 4; stroke-dasharray: 10 7; }
.drawing-text { font-size: 28px; font-weight: 850; paint-order: stroke; stroke: #07110d; stroke-width: 6; }
.ball { cursor: grab; filter: url(#shadow); }
#board.hide-player-text .player-label,
#board.hide-player-text .player-position { display: none; }

body.web-optimized #board { box-shadow: none; }
body.web-optimized .player-disc,
body.web-optimized .ball { filter: none; }
body.web-optimized .drawing.selected { filter: none; }


.player-disc { filter:none; }
.player-number { font-size:18px; }
.player-hit { fill:transparent; pointer-events:all; }
.player-node.selected .player-disc { stroke:#fff; stroke-width:5; }
.player-node.locked { cursor:not-allowed; }
.player-node.locked .player-disc { stroke-dasharray:3 3; }
.drawing-line { stroke-width:5; }
.drawing[data-movement="run"] { stroke-dasharray:16 12; }
.drawing[data-movement="dribble"] { stroke-dasharray:18 7 3 7; }
@media (max-width:1100px) { .workspace { padding:16px; gap:12px; } .topbar { padding:0 18px; } .workspace-panel { flex-basis:280px; width:280px; } .panel-content,.panel-heading { padding:16px; } }
@media (max-width:850px) {
  .topbar { flex-basis:60px; padding:0 14px; gap:10px; }
  .brand > div { display:none; }
  .match-heading { flex:1; text-align:left; }
  .workspace { padding:12px 12px calc(8px + env(safe-area-inset-bottom)); }
  .board-column { gap:9px; }
  .workspace-heading .eyebrow { display:none; }
  h1 { font-size:18px; margin:0; max-width:30vw; }
  .mode-switch button { padding:8px 12px; }
  .workspace-panel { position:fixed; z-index:40; left:10px; right:10px; bottom:calc(66px + env(safe-area-inset-bottom)); width:auto; max-height:62dvh; box-shadow:0 -16px 60px #0007; border-radius:20px; }
  .panel-heading { padding:12px 18px; }
  .panel-heading .eyebrow { display:none; }
  .panel-heading h2 { font-size:17px; margin:0; }
  .panel-content { padding:16px 18px; }
  .workspace-nav { gap:5px; }
  .workspace-nav > button { flex:1; justify-content:center; padding:8px; gap:5px; }
  .scene-navigation button { padding:8px; width:40px; }
  .view-controls { right:8px; bottom:8px; }
}
@media (max-width:480px) {
  .tool-buttons button { padding:9px; }
  .tool-buttons button span { font-size:11px; }
  .workspace-nav > button { flex-direction:column; gap:1px; font-size:13px; }
  .workspace-nav span { font-size:10px; }
  .workspace-heading { gap:6px; }
  .mode-switch button { padding:8px 10px; font-size:11px; }
  #interactionHint { font-size:10px; }
  .scene-navigation { gap:2px; }
}
@media (max-height:550px) and (orientation:landscape) {
  .topbar { flex-basis:48px; }
  .workspace { padding:8px 12px; }
  .board-column { grid-template-columns:1fr auto; grid-template-rows:auto minmax(0,1fr) auto; gap:6px 10px; }
  .workspace-heading { grid-column:1; grid-row:1; }
  .workspace-heading .eyebrow { display:none; }
  h1 { font-size:16px; }
  .board-toolbar { grid-column:2; grid-row:1 / 4; flex-direction:column; width:120px; min-height:0; }
  .tool-buttons { flex-wrap:wrap; overflow-y:auto; align-content:start; justify-content:center; }
  .tool-buttons button { min-height:40px; padding:7px; font-size:12px; }
  .board-frame { grid-column:1; grid-row:2; }
  .board-caption { display:none; }
  .workspace-nav { grid-column:1; grid-row:3; }
  .workspace-nav > button { min-height:40px; }
  .workspace-panel { left:auto; right:12px; top:56px; bottom:12px; width:min(340px,55vw); max-height:none; }
}
@media (prefers-reduced-motion:reduce) { * { scroll-behavior:auto !important; } }
