/* === 1x1SPORT Taktiktafel — web rework === */
:root {
  --bg: #F4F2EE;
  --panel: #E9E6E1;
  --panel-2: #DFDBD4;
  --hover: #C9C4BB;
  --line: #1A1A1A;
  --line-soft: #B7B2A8;
  --ink: #141414;
  --ink-2: #3B3A36;
  --ink-3: #6F6C64;
  --paper: #FBFAF7;

  --blue:  #59C2FB;
  --yellow:#FFD302;
  --red:   #E80707;
  --green: #85CA59;
  --grey:  #565B6C;
  --black: #111111;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-1: 0 1px 0 rgba(0,0,0,.04), 0 6px 24px -12px rgba(0,0,0,.18);
  --shadow-2: 0 24px 80px -28px rgba(0,0,0,.35);
  --font-ui: 'Inter Tight', 'Inter', system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ========== window chrome ========== */
.win {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* ========== splash ========== */
.splash {
  position: absolute; inset: 0;
  background: var(--bg);
  display: grid; place-items: center;
  overflow: hidden;
}
.splash-art {
  position: absolute; inset: -12%;
  transform: rotate(-8deg);
  opacity: .75;
  pointer-events: none;
}
.splash-card {
  position: relative; z-index: 2;
  width: min(680px, 86vw);
  padding: 56px 72px 40px;
  background: rgba(251,250,247,0.72);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 20px;
  box-shadow: var(--shadow-2);
  text-align: center;
}
.splash-logo {
  display: block; margin: 0 auto 20px;
  height: 88px; width: 88px;
  object-fit: contain;
}
.splash h1 {
  margin: 0 0 36px;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: clamp(28px, 3.6vw, 44px);
  letter-spacing: -0.04em;
  line-height: 1.0;
  text-transform: uppercase;
}
.splash h1 .thin { font-weight: 300; letter-spacing: -0.05em; color: var(--ink-2); }
.splash-actions { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 44px; padding: 0 20px;
  border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink);
  font-weight: 600; font-size: 13.5px; letter-spacing: 0.04em; text-transform: uppercase;
  transition: transform .08s ease, background .15s ease, color .15s ease;
}
.btn:hover { background: var(--ink); color: #fff; }
.btn:hover svg { stroke: #fff; }
.btn:active { transform: translateY(1px); }
.btn.ghost { border-color: transparent; background: transparent; text-transform: none; letter-spacing: 0; font-weight: 500; }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.btn svg { stroke: currentColor; }
.splash-footer {
  margin-top: 40px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.3em;
  color: var(--ink-3);
}
.splash-version {
  position: absolute; top: 18px; right: 22px; z-index: 3;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.1em;
}

/* ========== field picker ========== */
.picker {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
}
.picker-inner { width: min(960px, 86vw); }
.picker-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 28px; }
.picker-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.03em; font-weight: 700; }
.picker-head .step { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.2em; }
.picker-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
}
.picker-card {
  background: var(--paper);
  border: 1px solid #DCD7CD;
  border-radius: 14px;
  padding: 28px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  cursor: pointer;
  transition: border-color .15s, transform .15s, background .15s;
}
.picker-card:hover { border-color: var(--line); transform: translateY(-2px); }
.picker-card svg { display: block; }
.picker-card .pc-label {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  font-size: 13px; color: var(--ink-2);
}
.picker-card .pc-label .pc-name { font-weight: 600; color: var(--ink); }
.picker-card .pc-label .pc-meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); letter-spacing: 0.08em; }

.picker-back { margin-top: 24px; text-align: center; }

/* ========== editor ========== */
.editor {
  position: absolute; inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: 1fr 320px;
  grid-template-areas:
    "canvas panel"
    "toolbar toolbar";
  background: var(--bg);
}
.canvas-wrap { grid-area: canvas; position: relative; overflow: hidden; padding: 22px 22px 16px 22px; min-height: 0; display: flex; align-items: center; justify-content: center; }
.canvas-wrap > .stage { max-width: 100%; max-height: 100%; height: 100%; width: 100%; }
.stage.sized { height: 100%; width: auto; }
.panel { grid-area: panel; background: var(--panel); border-left: 1px solid #D6D1C8; display: flex; flex-direction: column; }
.toolbar { grid-area: toolbar; border-top: 1px solid #D6D1C8; background: #EDEAE4; }

/* canvas stage */
.stage {
  position: relative;
  background: var(--paper);
  border: 1px solid #D6D1C8;
  border-radius: 8px;
  overflow: hidden;
  color: #141414;
  box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 20px 40px -32px rgba(0,0,0,.2);
}
.stage.dark { color: #E9E6E1; }
.stage svg.thumb, .stage-svg { color: inherit; }
/* semantic styles for the supplied field SVGs */
.stage-svg .goal-fill    { fill: none; stroke: currentColor; stroke-width: 2.5; }
.stage-svg .pitch-stroke { fill: none; stroke: currentColor; stroke-width: 2.5; }
.stage-svg .box-stroke   { fill: none; stroke: currentColor; stroke-width: 2; }
.stage-svg .dash-group   { opacity: 0.55; }
.stage-svg .spot-tick    { fill: none; stroke: currentColor; stroke-width: 1.5; }
.stage-svg .spot-dash    { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 6 6; opacity: 0.8; }
.stage-svg .halfway      { fill: none; stroke: currentColor; stroke-width: 2; stroke-dasharray: 8 6; opacity: 0.8; }
.stage-svg .grid-dash    { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 6 6; opacity: 0.8; }
.stage-svg .dot-fill     { fill: currentColor; stroke: none; }
.stage-svg .label-fill   { fill: currentColor; stroke: none; opacity: 0.45; }
.stage-svg .logo-fill    { fill: currentColor; stroke: none; }

/* thumbnails (field picker) */
.field-svg.thumb .goal-fill { fill: none; stroke: #111; stroke-width: 4; }
.field-svg.thumb .pitch-stroke { fill: none; stroke: #111; stroke-width: 4; }
.field-svg.thumb .box-stroke { fill: none; stroke: #111; stroke-width: 3; }
.field-svg.thumb .halfway { fill: none; stroke: #111; stroke-width: 3; stroke-dasharray: 10 8; }
.field-svg.thumb .dot-fill { fill: #111; }
.field-svg.thumb .dash-group,
.field-svg.thumb .grid-dash,
.field-svg.thumb .spot-dash,
.field-svg.thumb .spot-tick,
.field-svg.thumb .label-fill,
.field-svg.thumb .logo-fill { display: none; }

/* tweak: hide grid labels + helper dashes */
.stage.no-grid .dash-group,
.stage.no-grid .label-fill,
.stage.no-grid .grid-dash { display: none; }
.stage-logo {
  position: absolute; top: 12px; left: 12px;
  width: 34px; height: 34px; border-radius: 5px;
  background: #111; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; letter-spacing: -0.06em;
  z-index: 5;
}
.stage-watermark {
  position: absolute; bottom: 8px; right: 14px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.25em;
  color: var(--ink-3);
  z-index: 5;
}
.stage-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-x pan-y; }
.stage-svg.is-drawing { touch-action: none; }
.stage-svg.cursor-draw { cursor: crosshair; }
.stage-svg.cursor-erase { cursor: not-allowed; }
.stage-svg.cursor-edit  { cursor: grab; }
.stage-svg.cursor-edit:active { cursor: grabbing; }

/* panel */
.panel-head {
  padding: 14px 18px 10px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #D6D1C8;
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.panel-head .panel-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.panel-section {
  padding: 16px 18px;
  border-bottom: 1px solid #D6D1C8;
}
.panel-section.grow { flex: 1; overflow-y: auto; }
.panel-section h4 {
  margin: 0 0 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3);
}
.panel-section .sub-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.panel-section .sub-head .sub-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.reset-btn {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid transparent; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
}
.reset-btn:hover { background: var(--hover); color: var(--ink); }

/* tool grid */
.tool-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(4, 1fr);
}
.tool-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tool-tile {
  aspect-ratio: 1;
  background: var(--paper);
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: background .1s, border-color .1s, transform .1s;
}
.tool-tile:hover { background: #fff; border-color: #D6D1C8; }
.tool-tile.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tool-tile.active .tile-icon-img,
.tool-tile.obj-tile.active svg { filter: invert(1); }
.tool-tile svg { width: 24px; height: 24px; }
.tool-tile.player-tile svg { width: 36px; height: 36px; }
.tool-tile.player-tile { color: var(--ink); }
.tool-tile.player-tile.active { color: #fff; }
.tool-tile.player-tile.active svg { filter: none; }
.tool-tile.obj-tile svg { width: 52px; height: 52px; }
.tool-tile .tile-icon-img { width: 48px; height: 48px; display:block; }

/* color row */
.color-row {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.color-row + .color-row { margin-top: 8px; }
.swatch {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1.5px solid transparent;
  position: relative;
  transition: transform .1s, box-shadow .1s;
}
.swatch:hover { transform: translateY(-1px); }
.swatch.active { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper) inset; }
.swatch.outline {
  background: var(--paper) !important;
  border-width: 3px;
}

/* slider */
.slider-row {
  display: flex; align-items: center; gap: 12px;
}
.slider-row .val {
  min-width: 32px; text-align: right;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-2);
}
.slider-row input[type="range"] {
  flex: 1; accent-color: var(--ink);
}

/* number / text input */
.t-input {
  width: 100%; height: 34px;
  padding: 0 10px;
  background: var(--paper);
  border: 1px solid #D6D1C8;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}
.t-input:focus { border-color: var(--ink); }

/* preview box */
.preview {
  background: var(--paper);
  border: 1px solid #D6D1C8;
  border-radius: 8px;
  height: 90px;
  display: flex; align-items: center; justify-content: center;
}

/* toolbar */
.toolbar-inner {
  height: 58px;
  display: flex; align-items: center;
  padding: 0 14px;
  gap: 4px;
}
.tb-btn {
  width: 40px; height: 40px; border-radius: 8px;
  background: transparent; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  position: relative;
}
.tb-btn:hover { background: var(--hover); color: var(--ink); }
.tb-btn.active { background: var(--ink); color: #fff; }
.tb-btn[disabled] { opacity: .4; cursor: not-allowed; }
.tb-sep { width: 1px; height: 22px; background: #D6D1C8; margin: 0 6px; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; }
.tb-right .tb-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

/* tooltip */
.tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: #111; color: #fff;
  padding: 7px 10px; border-radius: 6px;
  font-size: 11px; white-space: nowrap; line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease .35s;
  box-shadow: 0 8px 24px -10px rgba(0,0,0,.4);
  z-index: 30;
}
.tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: #111;
}
.tooltip .tt-name { font-weight: 600; letter-spacing: 0.02em; }
.tooltip .tt-desc { color: rgba(255,255,255,0.7); font-weight: 400; margin-top: 2px; font-size: 10.5px; }
.tooltip .tt-kbd { font-family: var(--font-mono); font-size: 10px; color: rgba(255,255,255,0.55); margin-left: 6px; }
.tb-btn:hover .tooltip { opacity: 1; }

/* tool tile tooltip */
.tool-tile { position: relative; }
.tool-tile .tooltip { bottom: auto; top: calc(100% + 8px); z-index: 100; }
.tool-tile .tooltip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #111; }
.tool-tile:hover .tooltip { opacity: 1; }
.swatch { position: relative; }
.swatch .tooltip { bottom: auto; top: calc(100% + 8px); padding: 4px 8px; font-size: 10px; text-transform: capitalize; }
.swatch .tooltip::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #111; }
.swatch:hover .tooltip { opacity: 1; }

/* dialog */
.modal-bg {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(20,20,20,0.35);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
}
.modal {
  width: min(460px, 90vw);
  background: var(--paper);
  border-radius: 14px;
  border: 1px solid #D6D1C8;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.modal header {
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #EEE8DD;
}
.modal header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal header .close {
  width: 28px; height: 28px; border-radius: 6px; border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-3);
}
.modal header .close:hover { background: var(--hover); color: var(--ink); }
.modal .body { padding: 20px; }
.modal .path {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #F3EFE6;
  border-radius: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-2);
  margin-bottom: 16px;
}
.modal .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.modal .field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.modal .field select.t-input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236f6c64' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.modal footer {
  padding: 14px 20px;
  background: #F3EFE6;
  border-top: 1px solid #EEE8DD;
  display: flex; justify-content: flex-end; gap: 8px;
}
.btn.sm { height: 34px; padding: 0 14px; font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 500; border-radius: 7px; }

/* tweaks */
.tweaks {
  position: absolute; right: 16px; bottom: 76px; z-index: 40;
  width: 260px;
  background: var(--paper);
  border: 1px solid #D6D1C8;
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.tweaks header {
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #EEE8DD;
}
.tweaks header h4 { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.tweaks .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.tweaks .tr { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.tweaks .tr select { height: 28px; border-radius: 6px; border: 1px solid #D6D1C8; background: #fff; padding: 0 6px; font-size: 12px; }
.switch { width: 34px; height: 20px; background: #D6D1C8; border-radius: 999px; position: relative; cursor: pointer; border: none; padding: 0; flex-shrink: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch.on { background: var(--ink); }
.switch.on::after { transform: translateX(14px); }

/* selection handles */
.selected-halo {
  fill: none; stroke: #111; stroke-width: 1; stroke-dasharray: 3 3;
  pointer-events: none;
}

/* hide scrollbar niceties */
.panel-section.grow::-webkit-scrollbar { width: 0; height: 0; }
.panel-section.grow::-webkit-scrollbar-thumb { background: transparent; }
.panel-section.grow::-webkit-scrollbar-track { background: transparent; }
.panel-section.grow { scrollbar-width: none; -ms-overflow-style: none; }

/* small helpers */
.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-3); }

/* dark field variant (tweak) */
.stage.dark {
  background: #1C2620;
}
.stage.dark .stage-watermark { color: rgba(255,255,255,0.5); }
.stage.dark .stage-logo { background: #fff; color: #111; }
