/* The setup plan (public/aufbau.js), in the app and on the website: both define the colours used here (--card, --line, --ink, --muted, --brand). */
.ab { display: grid; gap: 10px; }
.ab p, .ab h3 { margin: 0; }
.ab-bar, .ab-modes, .ab-sel-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ab-mode.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.ab-sel-tools .btn.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.ab-sel-tools .btn[hidden] { display: none; }
.ab-field { display: flex; align-items: center; gap: 6px; }
.ab-field select { min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); font: inherit; }
/* the equipment to add, in groups: a picture and the name; the cones' colours as swatches */
.ab-palette { display: grid; gap: 10px; align-content: start; }
/* one group at a time: the groups as tabs that scroll sideways */
.ab-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.ab-tab { flex: none; min-height: 34px; box-shadow: none; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink); font: inherit; font-size: .85rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.ab-tab.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.ab-group[hidden] { display: none; }
.ab-group h3 { display: none; } /* the tab names it */
.ab-save { white-space: nowrap; }
/* ⋯: save as a template, rename, delete – used less, so out of the way */
.ab-more { position: relative; }
.ab-more > summary { list-style: none; cursor: pointer; min-width: 40px; text-align: center; }
.ab-more > summary::-webkit-details-marker { display: none; }
.ab-more-menu { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; display: grid; gap: 6px; min-width: 210px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); box-shadow: 0 10px 30px rgba(0,0,0,.15); }
.ab-more-menu .btn { justify-content: flex-start; }
.ab-fieldbtns { display: inline-flex; flex: none; align-items: center; gap: 4px; padding-left: 6px; border-left: 1px solid var(--line); }
.ab-fieldbtns > span { font-size: .85rem; font-weight: 600; white-space: nowrap; padding-right: 2px; }
.ab-fieldbtns .btn { min-width: 36px; padding-left: 10px; padding-right: 10px; }
/* narrow (a phone): the equipment of a group as one row to swipe through, so the hall stays near */
@container (max-width: 859px) {
  .ab:not(:is(:fullscreen, .big-view)) .ab-pieces { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; padding-bottom: 4px; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-piece { flex: none; width: 84px; min-height: 0; }
  .ab:not(:is(:fullscreen, .big-view)):not(.ab-has-sel) .ab-sel-tools { display: none; }
  .ab:not(:is(:fullscreen, .big-view)) :is(.ab-tools, .ab-sel-tools) { flex-wrap: nowrap; overflow-x: auto; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-tools { flex-wrap: wrap; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-sel-tools { flex-basis: 100%; padding-bottom: 2px; }
  .ab:not(:is(:fullscreen, .big-view)) :is(.ab-tools, .ab-sel-tools) .btn { flex: none; }
}
/* room for it (a laptop, a tablet sideways): the equipment beside the hall, everything on one screen */
.ab-root { container-type: inline-size; }
@container (min-width: 860px) {
  .ab:not(:is(:fullscreen, .big-view)) { grid-template-columns: 300px minmax(0, 1fr); grid-template-areas: "plans plans" "palette tools" "palette stage" "palette hint" "palette list" "palette settings" "palette note"; column-gap: 16px; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-plans { grid-area: plans; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-palette { grid-area: palette; position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: hidden auto; overscroll-behavior: contain; padding-right: 4px; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-tabs { flex-wrap: wrap; overflow: visible; gap: 4px; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-tab { min-height: 28px; padding: 4px 9px; font-size: .76rem; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-pieces { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ab:not(:is(:fullscreen, .big-view)) .ab-tools { grid-area: tools; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-stage { grid-area: stage; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-svg { max-height: calc(100vh - 230px); }
  .ab:not(:is(:fullscreen, .big-view)) > .ab-hint { grid-area: hint; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-list { grid-area: list; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-settings { grid-area: settings; }
  .ab:not(:is(:fullscreen, .big-view)) .ab-note { grid-area: note; }
}
.ab-group { display: grid; gap: 6px; }
.ab-group h3 { font-size: .85rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ab-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.ab-colours { display: flex; flex-wrap: wrap; gap: 8px; }
.ab-swatch { width: 36px; height: 36px; border: 2px solid var(--line); border-radius: 50%; cursor: pointer; }
.ab-swatch.on { outline: 3px solid var(--brand); outline-offset: 2px; }
.ab-piece { grid-template-columns: minmax(0, 1fr); }
.ab-piece span { white-space: normal; min-width: 0; max-width: 100%; text-align: center; overflow-wrap: anywhere; hyphens: auto; } /* long names (Tischtennisschläger) wrap inside the tile */
.ab-piece { display: grid; justify-items: center; align-content: start; gap: 4px; min-height: 84px; padding: 6px 4px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-size: .82rem; font-weight: 600; line-height: 1.15; cursor: pointer; }
.ab-piece svg { width: 52px; height: 44px; }
.ab-piece:active { border-color: var(--brand); }
.ab-stage { border-radius: 14px; overflow: hidden; background: #4a4f55; }
/* no scrolling or zooming while a finger moves a piece or draws */
.ab-svg { display: block; width: 100%; height: auto; max-height: 78vh; touch-action: none; user-select: none; -webkit-user-select: none; }
.ab-item { cursor: grab; }
.ab-drawing .ab-svg, .ab-drawing .ab-item { cursor: crosshair; }
.ab-hint, .ab-note { color: var(--muted); font-size: .9rem; }
.ab-list h3 { font-size: 1rem; margin-bottom: 4px; }
.ab-list ul { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; }
/* "Groß anzeigen": the hall as large as the screen allows, under it the row to move and turn, and under that the
   equipment as one strip of small pictures to scroll through, so pieces can still be added */
.ab:is(:fullscreen, .big-view) { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #2b2f33; overflow: hidden; }
.ab:is(:fullscreen, .big-view) :is(.ab-plans, .ab-settings, .ab-hint, .ab-list, .ab-note) { display: none; }
.ab:is(:fullscreen, .big-view) .ab-stage { flex: 1 1 auto; min-height: 0; display: flex; border-radius: 0; background: none; }
.ab:is(:fullscreen, .big-view) .ab-svg { width: 100%; height: 100%; max-height: none; }
.ab:is(:fullscreen, .big-view) .ab-tools { order: 2; justify-content: center; }
.ab:is(:fullscreen, .big-view) .ab-palette { order: 3; flex: none; display: flex; gap: 14px; overflow: auto hidden; overscroll-behavior: contain; padding-bottom: 4px; }
.ab:is(:fullscreen, .big-view) :is(.ab-group, .ab-pieces) { display: flex; flex: none; align-items: center; gap: 6px; }
.ab:is(:fullscreen, .big-view) .ab-group h3, .ab:is(:fullscreen, .big-view) .ab-tabs { display: none; }
.ab:is(:fullscreen, .big-view) .ab-group[hidden] { display: flex; }
.ab:is(:fullscreen, .big-view) .ab-colours { display: grid; flex: none; grid-template-columns: repeat(3, 26px); gap: 4px; }
.ab:is(:fullscreen, .big-view) .ab-swatch { width: 26px; height: 26px; }
.ab:is(:fullscreen, .big-view) .ab-piece { flex: none; width: 70px; min-height: 0; padding: 4px 2px; font-size: .68rem; overflow-wrap: anywhere; hyphens: auto; }
.ab:is(:fullscreen, .big-view) .ab-piece svg { width: 40px; height: 32px; }
/* a phone held sideways: the row goes beside the hall and the equipment in a column on the other side, so the hall
   gets the whole height */
@media (orientation: landscape) and (max-height: 600px) {
  .ab:is(:fullscreen, .big-view) { flex-direction: row; align-items: stretch; }
  .big-view.ab { padding-top: max(12px, env(safe-area-inset-top)) !important; padding-right: calc(120px + env(safe-area-inset-right)) !important; }
  .ab:is(:fullscreen, .big-view) :is(.ab-tools, .ab-modes, .ab-sel-tools) { flex-direction: column; flex-wrap: nowrap; justify-content: center; }
  .ab:is(:fullscreen, .big-view) .ab-palette { order: -1; flex-direction: column; width: 152px; overflow: hidden auto; padding: 0 4px 0 0; }
  .ab:is(:fullscreen, .big-view) .ab-group { flex-direction: column; }
  .ab:is(:fullscreen, .big-view) .ab-pieces { display: grid; grid-template-columns: repeat(2, 70px); }
}
@media print { .ab-plans, .ab-palette, .ab-bar, .ab-hint, .ab-note { display: none !important; } }
/* one plan that belongs to a lesson's phase: no plan list, the hall can still be changed */
.ab-single .ab-plans .ab-field:first-child, .ab-single [data-act="newPlan"], .ab-single [data-act="rename"], .ab-single [data-act="delPlan"], .ab-single [data-act="tplParkour"] { display: none; }
.ab-rot { cursor: grab; } .ab-rot:active { cursor: grabbing; }
/* the new-plan / template menu: an empty hall, the teacher's templates, the Parkour course */
.ab-newmenu { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(47, 111, 214, .08); }
.ab-newmenu[hidden] { display: none; }
.ab-newmenu p { margin: 0; font-weight: 600; }
.ab-newmenu small { flex-basis: 100%; color: #666; }
.ab-tpl { display: inline-flex; gap: 2px; }

/* students: shirts each their own ("bunt"), girls / boys / mixed */
.ab-swatch.bunt { background: conic-gradient(#d64545, #f2c230, #2e9e4f, #0ea5e9, #8b5cf6, #e8558f, #d64545); }
.ab-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 12px 0 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.ab-fields > span { font-weight: 600; font-size: .9rem; }
.ab-fields button { min-width: 40px; padding: 6px 12px; border: 1px solid var(--brand); border-radius: 99px; background: var(--card, #fff); color: var(--brand); font: inherit; font-weight: 700; cursor: pointer; }
.ab-fields button:hover { background: var(--brand); color: #fff; }
.ab-fields small { flex-basis: 100%; color: var(--muted); font-size: .8rem; }
.ab-gender { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.ab-gender button { padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--card, #fff); color: inherit; font: inherit; font-size: .85rem; cursor: pointer; }
.ab-gender button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
