.app { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px clamp(16px, 3vw, 32px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}
.app-header.is-collapsed { padding-top: 10px; padding-bottom: 10px; }
.app-header.is-collapsed .toolbar { display: none; }
.app-header.is-collapsed .brand p { display: none; }

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; }
.brand h1 { font-size: 1.12rem; line-height: 1.1; }
.brand p { margin-top: 3px; color: var(--muted); font-size: 0.82rem; }

.header-lead { display: flex; align-items: center; gap: 12px; min-width: 0; }

.header-toggle {
  flex: none;
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e7eee9;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.toolbar[hidden] { display: none !important; }

.toolbar-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.toolbar-stack .draw-toolbar { flex: 0 0 auto; }
.toolbar-stack .toolbar { flex: 1 1 auto; justify-content: flex-end; min-width: 320px; }

@media (max-width: 900px) {
  .toolbar-stack .toolbar { flex-basis: 100%; justify-content: flex-start; }
}

.draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  min-width: 0;
}
.tool-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tool-button {
  min-height: 30px;
  border-radius: 7px;
  padding: 5px 10px;
  background: #e7eee9;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}
.tool-button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.tool-button--icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 5px 8px;
}
.tool-button--icon .tool-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tool-button--icon .kbd-hint {
  position: absolute;
  right: 2px;
  bottom: 1px;
  margin-left: 0;
  padding: 0 3px;
  font-size: 0.58rem;
  line-height: 1.4;
  opacity: 0.5;
}
.tool-button--icon[aria-pressed="true"] .kbd-hint { opacity: 0.75; }

.color-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(23, 33, 27, 0.18);
}
.color-swatch.yellow { background: #f5d90a; }
.color-swatch.red { background: #ef4444; }
.color-swatch.blue { background: #3b82f6; }
.color-swatch.white { background: #ffffff; }
.color-swatch[aria-pressed="true"] { outline: 3px solid var(--gold); outline-offset: 1px; }

@media (max-width: 520px) {
  .draw-toolbar { gap: 8px 12px; }
  .tool-group { flex-wrap: nowrap; }
  .draw-toolbar .tool-group:first-child { flex-basis: 100%; }
  .tool-button--icon { min-width: 34px; padding: 5px 6px; }
}
@media (max-width: 420px) {
  .tool-button--icon .kbd-hint { display: none; }
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(14px, 3vw, 32px) 28px;
}

.board-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-inline: auto;
  padding-bottom: 76px;
}

.field-shell {
  background: none;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.board-hint {
  margin: 0.5rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.score-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}
.score-strip > div { display: inline-flex; align-items: center; gap: 8px; }
.team-dot { width: 10px; height: 10px; display: inline-block; border-radius: 999px; }
.home-dot { background: var(--home); }
.away-dot { background: var(--away); }

/* ---------------------------------------------------------------
   Kompakteres Layout, damit alles ohne Scrollen sichtbar ist
   --------------------------------------------------------------- */

/* Kein horizontales Scrollen */
html, body { overflow-x: hidden; }
.layout { overflow-x: hidden; }

/* Board-Bereich: Abstand unten reicht für den schwarzen Button */
.board-area { padding-bottom: 56px; }

/* Seitenpanels: auf schmalen Displays nicht über den Viewport hinaus */
.side-panel { width: min(360px, 92vw); }

/* Seitliche Toggles: etwas schmaler, damit sie nicht überlappen */
.panel-toggle {
  min-width: 34px;
  min-height: 84px;
  padding: 10px 6px;
  letter-spacing: 1.5px;
  font-size: 0.85rem;
}

/* Auf Smartphones noch kompakter */
@media (max-width: 640px) {
  .app-header { padding: 8px 12px; }
  .board-area { padding-bottom: 44px; }
  .panel-toggle { min-width: 30px; min-height: 72px; padding: 8px 4px; font-size: 0.78rem; }
  .side-panel { width: min(320px, 94vw); }

  .plays-row,
  .frames-row {
    gap: 6px 8px;
    font-size: 0.85rem;
  }
  .frames-row .frame-label { min-width: 72px; }
  .plays-select select { min-width: 120px; }
  .speed-control select { min-width: 60px; }
  .danger-button-inline { padding: 4px 8px; font-size: 0.78rem; }
  .icon-button { min-width: 26px; min-height: 26px; padding: 2px; }
}
