.topbar { grid-template-columns: auto 1fr auto; gap: 12px; }
.top-actions { flex-wrap: wrap; }
.play-name { font-size: 14px; font-weight: 400; }
.editor-button,.player-picker select { min-height: 40px; padding: 8px 12px; font: inherit; font-size: 14px; color: #eef5ef; border: 1px solid #405547; border-radius: 8px; background: #17291f; }
.editor-button { cursor: pointer; font-weight: 650; }
.editor-button:hover:not(:disabled) { background: #294534; }
button:disabled { opacity: .45; cursor: not-allowed; }
.danger { color: #ffc6b9; }
.board-actions { display: flex; flex-wrap: wrap; gap: 8px; position: relative; z-index: 16; }
.attack-add { background: #153960; border-color: #418ad2; }
.defence-add { background: #552b23; border-color: #b26550; }
.player-picker { flex: 1; min-width: 175px; max-width: 260px; }
.player-picker select { width: 100%; }
.editor-help { position: relative; color: #b5c8bb; font-size: 14px; margin: 0 0 4px; }
.view-controls { padding-top: 12px; border-top: 1px solid #ffffff18; }
.view-hint { font-size: 14px; color: #d7ff93; }
.roster-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.roster-player { min-width: 34px; height: 34px; border-radius: 50%; border: 1px solid #6ca2e0; color: white; background: #245487; cursor: pointer; font: inherit; font-size: 14px; }
.roster-player.defence { background: #813d30; border-color: #d98671; }
.roster-player[aria-pressed="true"] { outline: 2px solid var(--lime); outline-offset: 2px; }
.tip { font-size: 14px; line-height: 1.7; }
.tip b { font-size: 14px; }
.phase-editor { display: grid; gap: 6px; padding: 14px; border-bottom: 1px solid var(--line); }
.phase-editor label { font-size: 14px; color: #b9cebf; }
.phase-editor input,.phase-editor textarea { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid #405547; border-radius: 8px; color: #f3f7ef; background: #09170f; font: inherit; font-size: 14px; }
.phase-editor textarea { resize: vertical; min-height: 64px; max-height: 150px; }
.phase-row { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #ffffff03; }
.phase-row.active { border-color: #b2d336; background: #d7ff3f09; }
.phase-card { border: 0; border-radius: 0; background: transparent; }
.phase-card b { font-size: 14px; overflow-wrap: anywhere; }
.phase-card span:not(.phase-num) { font-size: 13px; overflow-wrap: anywhere; }
.phase-card .phase-num { margin: 0; }
.phase-row.active .phase-num { background: var(--lime); color: #101e0f; }
.phase-actions { display: flex; gap: 6px; padding: 0 10px 10px; }
.phase-action { border: 1px solid #ffffff20; border-radius: 6px; background: #14251b; color: #c9ddce; font: inherit; font-size: 14px; min-width: 36px; min-height: 32px; cursor: pointer; }
.phase-action:last-child { margin-left: auto; padding: 3px 10px; color: #ffc5b7; }
.phase-list { gap: 10px; padding: 12px; }
.add-phase { flex-shrink: 0; margin-bottom: 8px; border-style: solid; background: var(--lime); color: #101c09; border-color: var(--lime); font-size: 14px; }
.add-phase:hover { background: #e4ff78; color: #101c09; }
.phase-tip { margin: 0 14px 14px; color: #b2c7b9; font-size: 13px; }
.right-head p { font-size: 14px; }
.transport { flex-shrink: 0; }
.play-control.primary { width: 82px; border-radius: 10px; font-size: 14px; font-weight: 700; }
.pitch-toolbar .tool-btn { font-size: 14px; min-height: 40px; }
.pitch .player-label { max-width: 160px; }
.ball-token.selected { outline: 3px solid var(--lime); outline-offset: 3px; }
.toast { max-width: calc(100vw - 32px); width: max-content; font-size: 14px; text-align: center; }
dialog { width: min(440px,calc(100vw - 32px)); padding: 24px; border: 1px solid #46614d; border-radius: 14px; background: #102218; color: #f3f7ef; box-shadow: 0 30px 100px #000a; }
dialog::backdrop { background: #0009; }
dialog h2 { margin-top: 0; font-size: 22px; }
dialog p { font-size: 16px; line-height: 1.6; }
dialog form { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
@media (min-width: 821px) { .workspace { grid-template-columns: 280px minmax(0,1fr) 270px; } .stage { gap: 8px; } }
@media (min-width: 821px) and (max-height: 800px) { body { overflow: auto; } .app { min-height: 860px; height: auto; } .workspace { min-height: 796px; } }
@media (max-width: 1180px) and (min-width: 821px) { .workspace { grid-template-columns: minmax(0,1fr) 270px; } }
@media (max-width: 820px) {
  .app { grid-template-rows: auto auto; }
  .topbar { grid-template-columns: 1fr; gap: 8px; padding: 10px 12px; }
  .brand { display: none; }
  .top-actions { justify-content: space-between; gap: 6px; }
  .top-actions button { font-size: 14px; padding-inline: 10px; }
  .stage { height: max(850px,110svh); padding-top: 14px; }
  .player-picker { max-width: none; }
  .editor-help { font-size: 13px; }
  .phase-list { max-height: none; }
  .right { min-height: 650px; }
}
.workspace > .left { display: block; min-width: 0; padding: 20px; overflow-x: hidden; overflow-y: auto; overflow-wrap: anywhere; }
.left h1 { font-size: 22px; line-height: 1.25; margin: 0 0 8px; }
.left h2 { font-size: 17px; margin: 0 0 8px; }
.left .divider { margin: 22px 0; }
.sidebar-heading { display: flex; gap: 12px; justify-content: space-between; align-items: center; }
.sidebar-heading .eyebrow { margin: 0 0 12px; }
.saved-section { margin: 24px 0 0; }
.storage-note { color: #aac1b2; font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.saved-list { display: grid; gap: 8px; min-width: 0; }
.saved-move { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; border: 1px solid #354b3d; border-radius: 9px; padding: 4px; }
.saved-move.current { border-color: #b6d648; background: #b6d64808; }
.saved-open { flex: 1 1 145px; min-width: 0; width: 100%; padding: 8px; text-align: left; border: 0; border-radius: 5px; background: transparent; cursor: pointer; font: inherit; }
.saved-open:hover { background: #ffffff0a; }
.saved-open strong { display: block; font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; white-space: normal; }
.saved-open span { display: block; margin-top: 4px; color: #adc5b5; font-size: 12px; }
.saved-delete { color: #ffc5b7; background: transparent; border: 0; padding: 8px; min-height: 36px; font: inherit; font-size: 13px; cursor: pointer; }
.library-empty { margin: 0; padding: 14px; border: 1px dashed #4a614f; border-radius: 8px; color: #c0d2c5; font-size: 14px; line-height: 1.6; }
.library-error { color: #ffbda8; font-size: 14px; overflow-wrap: anywhere; }
.blank-hint { position: absolute; z-index: 10; top: 12px; left: 50%; transform: translateX(-50%); width: min(360px,90%); padding: 14px 18px; border: 1px solid #66816a; border-radius: 10px; background: #112b1fee; text-align: center; pointer-events: none; }
.blank-hint strong { display: block; font-size: 16px; margin-bottom: 5px; }
.blank-hint span { color: #c2d4c5; font-size: 14px; line-height: 1.5; }
[hidden] { display: none !important; }
.library-toggle,.sidebar-close { display: none; }
#saveMoveForm { display: grid; gap: 12px; }
#saveMoveForm label { font-size: 14px; }
#saveMoveName { width: 100%; min-width: 0; padding: 10px; border: 1px solid #6f8b73; border-radius: 7px; background: #07170e; color: #f3f7ef; font: inherit; font-size: 16px; }
.dialog-actions { display: flex; gap: 10px; justify-content: end; }
@media (max-width: 1180px) {
  .workspace > .left { display: none; }
  .workspace > .left.expanded { display: block; grid-column: 1 / -1; max-height: 430px; border-bottom: 1px solid var(--line); }
  .library-toggle,.sidebar-close { display: inline-block; }
  .workspace:has(.left.expanded) { overflow-y: auto; }
}
@media (max-width: 820px) {
  .play-name { display: block; font-size: 13px; grid-row: 2; justify-self: start; }
  .top-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .top-actions button { font-size: 14px; padding: 8px 6px; }
  .top-actions .share-btn { height: auto; min-height: 40px; }
  .stage { min-width: 0; }
}
