* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #1f2937;
  color: #f3f4f6;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: row;
  height: 100vh;
  height: 100dvh;
}

#toolbar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem 0.75rem;
  background: #111827;
  border-right: 1px solid #374151;
  min-width: 72px;
}

.tool-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#toolbar button {
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
  background: #1f2937;
  color: #f3f4f6;
  border: 1px solid #374151;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

#toolbar button:hover { background: #374151; }
#toolbar button:active { transform: scale(0.95); }

#toolbar button.tool.active {
  background: #2563eb;
  border-color: #3b82f6;
}

.color-picker {
  width: 48px;
  height: 48px;
  border: 1px solid #374151;
  border-radius: 8px;
  background: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  cursor: pointer;
  box-sizing: border-box;
}
.color-picker input[type="color"] {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.color-picker input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-picker input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }

#stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  min-width: 0;
  min-height: 0;
}

#board {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: #0f1a14;
  border-radius: 6px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

/* Field markings */
.field-oob { fill: #1a3422; }          /* Out-of-bounds / sideline area */
.field-bg { fill: #2d7a3e; }
.field-stripe { fill: #2a6f39; }
.field-line { fill: none; stroke: #ffffff; stroke-width: 2.5; }

/* Tokens */
.token { cursor: grab; }
.token.dragging { cursor: grabbing; }
.token .token-body {
  stroke: #ffffff;
  stroke-width: 2;
}
.token .token-label {
  fill: #ffffff;
  font-weight: 700;
  font-size: 16px;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.token[data-color="red"] .token-body { fill: #dc2626; }
.token[data-color="blue"] .token-body { fill: #2563eb; }
.token[data-color="green"] .token-body { fill: #16a34a; }
.token[data-kind="ball"] .token-body { fill: #ffffff; stroke: #111; }

/* Training props (cones, hurdles, poles, mini-goal) */
.prop { cursor: grab; }
.prop.dragging { cursor: grabbing; }
.prop[data-prop="cone"] polygon {
  fill: #f97316;
  stroke: #7c2d12;
  stroke-width: 1.5;
}
.prop[data-prop="hurdle"] rect,
.prop[data-prop="hurdle"] line {
  fill: #fbbf24;
  stroke: #fbbf24;
  stroke-width: 2.5;
}
.prop[data-prop="pole"] rect {
  fill: #f87171;
  stroke: #111;
  stroke-width: 0.8;
}
.prop[data-prop="minigoal"] rect {
  fill: #e5e7eb;
  stroke: #111;
  stroke-width: 0.8;
}

/* Drawings — stroke/fill are set inline by tools (currentColor) so we only
   keep shape-shape properties here. */
.drawing-arrow {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}
.drawing-freehand {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.drawing-zone {
  stroke-width: 3;
  stroke-linejoin: round;
}
.drawing-rect,
.drawing-circle {
  stroke-width: 3;
}

/* Selection */
.selected {
  filter: drop-shadow(0 0 5px rgba(251, 146, 60, 1)) drop-shadow(0 0 2px rgba(251, 146, 60, 1));
}
.selected.drawing-arrow,
.selected.drawing-freehand,
.selected.drawing-zone,
.selected.drawing-rect,
.selected.drawing-circle {
  stroke-width: 5 !important;
}

/* iPad / Tablet — Toolbar oben */
@media (max-width: 900px), (orientation: portrait) {
  body { flex-direction: column; }
  #toolbar {
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid #374151;
    overflow-x: auto;
    padding: 0.5rem;
    gap: 1rem;
    min-width: 0;
  }
  .tool-group {
    flex-direction: row;
  }
  #toolbar button {
    width: 52px;
    height: 52px;
  }
}
