:root {
  --bg: #080d14;
  --panel: #111a25;
  --panel-2: #162231;
  --line: #28384a;
  --text: #f3f7fb;
  --muted: #98a8bb;
  --accent: #f2c94c;
  --cyan: #38d4ff;
  font-family: "Malgun Gothic", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 15% -5%, #1c3249 0, transparent 40rem), radial-gradient(circle at 95% 15%, #132331 0, transparent 38rem), var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, select, input { border: 1px solid var(--line); background: #111b27; color: var(--text); border-radius: 8px; }
button { cursor: pointer; padding: .65rem .9rem; }
button:hover { border-color: #58708b; background: #1a293a; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.topbar { min-height: 76px; padding: 12px clamp(18px, 4vw, 54px); display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #31475e; background: rgba(8, 13, 20, .92); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; box-shadow: 0 10px 28px rgba(0,0,0,.18); }
.eyebrow, .section-label { margin: 0 0 4px; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .16em; }
h1, h2 { margin: 0; }
h1 { font-size: clamp(1.45rem, 3vw, 2rem); }
.version-number { color: var(--accent); font-size: clamp(2rem, 4vw, 2.65rem); font-weight: 900; letter-spacing: -.08em; line-height: 1; padding-left: 14px; border-left: 4px solid var(--accent); font-variant-numeric: tabular-nums; }
h2 { font-size: 1.18rem; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.local-badge { color: #b9c5d2; border: 1px solid var(--line); border-radius: 999px; padding: .52rem .8rem; font-size: .82rem; }
.local-badge i { display: inline-block; width: 8px; height: 8px; background: #37d67a; border-radius: 50%; margin-right: 7px; box-shadow: 0 0 10px #37d67a; }
main { width: min(1600px, 100%); margin: auto; padding: 24px clamp(14px, 3vw, 38px) 48px; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(150px, 220px)) 1fr; gap: 12px; align-items: stretch; }
.summary article { background: linear-gradient(145deg, #17283a, #0e1722); border: 1px solid #34495d; border-radius: 12px; padding: 14px 16px; box-shadow: inset 0 1px rgba(255,255,255,.035); }
.summary article:first-child { border-top: 2px solid var(--accent); }
.summary article:nth-child(2) { border-top: 2px solid var(--cyan); }
.summary article span { color: var(--muted); display: block; font-size: .84rem; }
.summary strong { font-size: 1.75rem; display: block; margin-top: 4px; }
.summary small { color: var(--muted); }
.updated { justify-self: end; align-self: end; color: var(--muted); font-size: .82rem; margin: 0; }
.game-type-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 22px 0 8px; padding-bottom: 2px; }
.game-type-tab { min-width: 118px; padding: 9px 13px; color: var(--muted); text-align: left; flex: none; scroll-snap-align: start; }
.game-type-tab b { display: block; color: var(--text); }
.game-type-tab small { color: var(--muted); }
.game-type-tab.active { border-color: var(--accent); background: #2c2818; box-shadow: inset 0 -2px 0 var(--accent); }
.perspective-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 8px; padding-bottom: 2px; }
.game-type-tabs, .perspective-tabs, .server-tabs, .map-tabs { scroll-snap-type: x proximity; scrollbar-width: none; }
.game-type-tabs::-webkit-scrollbar, .perspective-tabs::-webkit-scrollbar, .server-tabs::-webkit-scrollbar, .map-tabs::-webkit-scrollbar { display: none; }
.perspective-tab { min-width: 118px; padding: 9px 13px; color: var(--muted); text-align: left; flex: none; scroll-snap-align: start; }
.perspective-tab b { display: block; color: var(--text); }
.perspective-tab small { color: var(--muted); }
.perspective-tab.active { border-color: var(--accent); background: #2c2818; box-shadow: inset 0 -2px 0 var(--accent); }
.server-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 8px; padding-bottom: 2px; }
.server-tab { min-width: 108px; padding: 9px 13px; color: var(--muted); text-align: left; }
.server-tab, .map-tab { flex: none; scroll-snap-align: start; }
.server-tab b { display: block; color: var(--text); }
.server-tab small { color: var(--muted); }
.server-tab.active { border-color: var(--cyan); background: #102a35; box-shadow: inset 0 -2px 0 var(--cyan); }
.map-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 4px; }
.map-tab { min-width: 150px; text-align: left; padding: 11px 14px; color: var(--muted); }
.map-tab b { color: var(--text); display: block; margin-bottom: 3px; }
.map-tab.active { border-color: var(--accent); background: #2c2818; box-shadow: inset 0 -2px 0 var(--accent); }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; }
.panel { background: rgba(17, 26, 37, .96); border: 1px solid #304256; border-radius: 13px; overflow: hidden; box-shadow: 0 14px 32px rgba(0, 0, 0, .13); }
.panel-heading { min-height: 68px; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.map-heading { gap: 12px; }
.map-heading h2 { line-height: 1.25; }
.map-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.map-meta { color: var(--muted); font-size: .86rem; }
.map-load-status { margin: 5px 0 0; color: var(--muted); font-size: .72rem; }
.map-actions button { color: var(--accent); border-color: #665a25; }
.map-settings { border-bottom: 1px solid var(--line); background: #0d1723; }
.map-settings summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px; cursor: pointer; color: #dce7f2; font-weight: 750; list-style: none; user-select: none; }
.map-settings summary::-webkit-details-marker { display: none; }
.map-settings summary::before { content: "+"; display: grid; place-items: center; width: 21px; height: 21px; flex: none; border-radius: 5px; background: #20384b; color: var(--cyan); font-size: 1.08rem; line-height: 1; }
.map-settings[open] summary::before { content: "−"; }
.map-settings summary:hover { background: #172739; }
.map-settings summary small { margin-left: auto; color: var(--muted); font-size: .73rem; font-weight: 400; }
.map-settings-body { padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.route-toggle { display: inline-flex; align-items: center; gap: 7px; color: #cbd5e1; font-size: .86rem; cursor: pointer; user-select: none; }
.route-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 38px; height: 21px; border-radius: 999px; background: #314154; border: 1px solid #52657a; position: relative; transition: .18s ease; }
.toggle-track::after { content: ""; width: 15px; height: 15px; border-radius: 50%; background: #b9c6d4; position: absolute; left: 2px; top: 2px; transition: .18s ease; }
.route-toggle input:checked + .toggle-track { background: #174c60; border-color: var(--cyan); }
.route-toggle input:checked + .toggle-track::after { transform: translateX(17px); background: var(--cyan); }
.layer-toggles { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 9px 16px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 9px; color: var(--muted); font-size: .76rem; }
.visual-setting { min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #101d2a; }
.color-picker { display: flex; align-items: center; gap: 6px; cursor: pointer; margin-bottom: 4px; }
.color-picker:hover { color: var(--text); }
.color-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.legend i { width: 18px; height: 4px; display: inline-block; border-radius: 4px; }
.density-swatch { background: #ffd02f; box-shadow: 0 0 8px #ffd02f; }
.full-density-swatch { background: #ffd02f; box-shadow: 0 0 8px #ffd02f; }
.solo-density-swatch { background: #ff4fd8; box-shadow: 0 0 8px #ff4fd8; }
.route-swatch { background: #38d4ff; box-shadow: 0 0 8px #38d4ff; }
.landing-point-swatch { background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.8); }
.movement-label { cursor: default; }
.movement-swatch { background: linear-gradient(90deg, #ff453a 0 25%, #30d158 25% 50%, #0a84ff 50% 75%, #ffd60a 75%); box-shadow: 0 0 8px rgba(100, 210, 255, .7); }
.setting-sub-label { margin: 6px 0 3px; color: #b8c5d3; font-size: .72rem; }
.brightness-control, .line-width-control { display: grid; grid-template-columns: minmax(120px, 1fr) 58px 22px; gap: 7px; align-items: center; }
.line-width-control { margin-top: 3px; }
.brightness-control input[type="range"], .line-width-control input[type="range"] { width: 100%; min-width: 120px; accent-color: var(--accent); }
.brightness-control input[type="number"], .line-width-control input[type="number"] { width: 58px; height: 28px; padding: 3px 5px; text-align: right; font-size: .78rem; border-radius: 5px; }
.map-viewport { height: min(72vh, 850px); min-height: 490px; overflow: hidden; position: relative; background: #05080c; touch-action: none; cursor: grab; }
.map-viewport.dragging { cursor: grabbing; }
.map-stage { height: 100%; max-width: 100%; aspect-ratio: 1 / 1; margin: auto; position: relative; transform-origin: center; transition: transform .12s ease-out; }
.map-viewport img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; pointer-events: none; }
.map-images, .map-images img { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-images img[hidden] { display: none; }
.map-stage, .map-viewport canvas { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.map-viewport canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.zoom-controls { position: absolute; right: 14px; bottom: 14px; display: flex; gap: 5px; background: rgba(5, 9, 14, .84); padding: 5px; border: 1px solid var(--line); border-radius: 10px; }
.zoom-controls button { min-width: 42px; padding: .5rem; }
.wheel-step { display: inline-flex; align-items: center; gap: 4px; padding: 0 5px 0 8px; color: var(--muted); font-size: .75rem; border-left: 1px solid var(--line); }
.wheel-step input { width: 45px; height: 32px; padding: 3px 4px; text-align: right; border-radius: 6px; font-size: .78rem; }
.team-legend { position: absolute; left: 14px; bottom: 14px; max-width: calc(100% - 190px); display: flex; flex-wrap: wrap; gap: 5px; padding: 7px; border: 1px solid var(--line); border-radius: 9px; background: rgba(5, 9, 14, .86); z-index: 3; }
.team-chip { display: inline-flex; align-items: center; gap: 5px; color: #d9e2eb; font-size: .72rem; padding: 3px 6px; border-radius: 5px; background: #14202d; }
.team-chip i { width: 9px; height: 9px; border-radius: 50%; }
.team-loading { color: var(--muted); font-size: .76rem; }
.panel-note { color: var(--muted); font-size: .83rem; margin: 14px 16px 8px; }
.ranking { list-style: none; padding: 0 14px 18px; margin: 0; max-height: 750px; overflow: auto; }
.ranking li { display: grid; grid-template-columns: 34px 48px 1fr; gap: 8px; align-items: center; padding: 11px 4px; border-bottom: 1px solid #223143; }
.rank { color: #708399; font-weight: 700; }
.grid-code { font-weight: 900; color: var(--accent); font-size: 1rem; }
.rank-info strong { display: block; font-size: .92rem; }
.rank-info span { color: var(--muted); font-size: .76rem; }
.grid-ranking-section { margin-top: 12px; }
.ranking-window-heading { gap: 16px; }
.ranking-tabs { display: flex; gap: 4px; padding: 4px; background: #0a131e; border: 1px solid var(--line); border-radius: 10px; }
.ranking-tabs button { min-width: 126px; padding: 9px 14px; border: 1px solid transparent; background: transparent; color: var(--muted); font-weight: 700; }
.ranking-tabs button:hover { color: var(--text); background: #1a2b3d; }
.ranking-tabs button[aria-selected="true"] { color: var(--text); background: #22344a; border-color: #54718d; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.ranking-tabs button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.ranking-view { min-height: 174px; }
.ranking-view[hidden] { display: none; }
.ranking-view .panel-note { margin-bottom: 12px; }
.ranking-grid { display: grid; grid-template-columns: repeat(4, minmax(210px, 1fr)); max-height: 360px; gap: 8px; }
.ranking-grid li { min-width: 0; padding: 10px; border: 1px solid #26384b; border-radius: 8px; background: #101c29; }
.ranking-grid li:nth-child(-n+3) { border-color: #5b512f; background: #1b211e; }
.solo-ranking-view .ranking-grid li:nth-child(-n+3) { border-color: rgba(255, 79, 216, .4); background: #251a2d; }
.solo-grid-code { color: var(--solo-density, #ff4fd8); }
.ranking-empty { grid-column: 1 / -1 !important; display: block !important; color: var(--muted); text-align: center; padding: 28px 8px !important; }
.movement-mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; width: 100%; }
.movement-mode-tabs button { min-width: 0; padding: .38rem .3rem; border: 1px solid #2c4055; border-radius: 6px; background: #0c1620; color: var(--muted); font-size: .75rem; }
.movement-mode-tabs button:hover { background: #162536; color: #fff; }
.movement-mode-tabs button.active { border-color: #ff4fd8; background: rgba(255,79,216,.14); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,79,216,.18); }
.team-panel { display: flex; flex-direction: column; min-height: 0; height: calc(min(72vh, 850px) + 69px); }
.team-count { color: var(--accent); font-size: .86rem; white-space: nowrap; }
.team-player-list { flex: 1; min-height: 0; padding: 0 12px 16px; overflow: auto; }
.team-card { border: 1px solid #26374a; border-radius: 9px; margin-top: 9px; overflow: hidden; background: #0d1620; transition: opacity .16s ease, border-color .16s ease; }
.team-card.is-muted { opacity: .48; }
.team-card.is-selected { border-color: #5b7189; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.team-card-head { display: grid; grid-template-columns: 32px 1fr auto; gap: 7px; align-items: center; width: 100%; border: 0; border-radius: 0; background: #172434; padding: 9px; text-align: left; }
.team-card-head:hover { background: #203249; }
.team-color-picker { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 6px; border: 1px solid #53667b; cursor: pointer; }
.team-color-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.team-color-picker i { width: 14px; height: 14px; border-radius: 50%; }
.team-focus { border: 0; padding: 0; background: transparent; color: var(--text); font-weight: 800; text-align: left; }
.team-focus small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.team-zoom-hint { color: var(--cyan); font-size: .7rem; }
.player-list { list-style: none; padding: 0; margin: 0; }
.player-list li { border-top: 1px solid #203043; }
.player-focus { display: grid; grid-template-columns: minmax(90px, 1fr) auto; gap: 7px; width: 100%; padding: 8px 9px; border: 0; border-radius: 0; background: transparent; text-align: left; font-size: .76rem; }
.player-focus:hover { background: #172536; }
.player-focus.is-muted { opacity: .38; }
.player-focus.is-selected { background: #203249; box-shadow: inset 3px 0 0 var(--player-color, var(--cyan)); }
.player-name { color: #e8eef5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-route { color: var(--muted); text-align: right; white-space: nowrap; }
.team-empty { color: var(--muted); padding: 24px 8px; text-align: center; }
.history { margin-top: 12px; }
.history-heading { gap: 18px; }
.filters { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.filters select { padding: .6rem .8rem; min-width: 120px; }
.filters input { padding: .6rem .8rem; width: min(350px, 38vw); }
.selection-summary { padding: 10px 14px; color: var(--muted); font-size: .86rem; border-bottom: 1px solid var(--line); }
.include-check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.match-row.excluded { opacity: .48; }
.match-row.excluded td:not(:first-child):not(:nth-child(2)) { text-decoration: line-through; text-decoration-color: #617087; }
.table-wrap { overflow: auto; max-height: 510px; }
table { border-collapse: collapse; width: 100%; font-size: .84rem; }
th { position: sticky; top: 0; background: #1b2939; color: #c8d4e1; text-align: left; z-index: 2; }
th, td { padding: 11px 13px; border-bottom: 1px solid #213044; white-space: nowrap; }
.sort-header { border: 0; background: transparent; color: inherit; padding: 0; border-radius: 4px; font-weight: 700; }
.sort-header:hover { background: transparent; color: #fff; }
.sort-header span { display: inline-block; width: 12px; color: var(--accent); }
.sort-header.active span::after { content: "↓"; }
.sort-header.active.asc span::after { content: "↑"; }
tbody tr:hover { background: #172536; }
.match-row { cursor: pointer; }
.view-match { color: var(--accent); border-color: #62551e; padding: .35rem .6rem; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: 0 0 10px currentColor; }
.match-id { max-width: 360px; overflow: hidden; text-overflow: ellipsis; color: #91a6ba; }
.empty, .error-state { color: var(--muted); text-align: center; padding: 30px; }
.error-state { position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%); background: #241519; border: 1px solid #71313b; border-radius: 12px; color: #ffb6c0; z-index: 40; }
@media (max-width: 980px) {
  .summary { grid-template-columns: repeat(3, 1fr); }
  .updated { grid-column: 1 / -1; justify-self: start; }
  .workspace { grid-template-columns: 1fr; }
  .team-panel { height: min(72vh, 720px); min-height: 480px; }
  .map-viewport { min-height: 420px; height: 62vh; }
  .ranking { max-height: 420px; }
  .ranking-grid { grid-template-columns: repeat(2, minmax(210px, 1fr)); }
}
@media (max-width: 660px) {
  .topbar { min-height: 68px; padding: 10px 14px; }
  .version-number { font-size: 2rem; }
  .local-badge { display: none; }
  .summary { grid-template-columns: 1fr 1fr; }
  .coordinate-card { grid-column: 1 / -1; }
  .history-heading { align-items: flex-start; flex-direction: column; }
  .map-heading { align-items: flex-start; flex-direction: column; }
  .map-actions { align-items: flex-start; justify-content: flex-start; }
  .filters { width: 100%; flex-direction: column; }
  .filters input, .filters select { width: 100%; }
  .map-viewport { min-height: 320px; height: 55vh; }
  .map-settings summary small { display: none; }
  .legend { grid-template-columns: 1fr; }
  .team-panel { min-height: 360px; height: 55vh; }
  .ranking-window-heading { align-items: stretch; flex-direction: column; }
  .ranking-tabs { width: 100%; }
  .ranking-tabs button { flex: 1; min-width: 0; }
  .ranking-grid { grid-template-columns: 1fr; }
}

.source-badge { display:inline-block; border:1px solid #53728a; border-radius:20px; padding:4px 9px; font-size:.75rem; white-space:nowrap; }
.source-badge.admin { color:#f2d16a; border-color:#766235; }
.source-badge.user { color:#86d8ef; border-color:#376e82; }
.source-owner { display:block; color:#98a8bb; font-size:.72rem; margin-top:4px; }

.guide-link{color:#71d9ed;text-decoration:none;border:1px solid #294456;border-radius:8px;padding:8px 12px;font-size:.8rem;white-space:nowrap}.guide-link:hover{background:#123348;color:#fff}
