/* ===== Library ===== */
.search { position: relative; margin: 0 14px 10px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 40px; padding-left: 36px; }
.library .seg { margin: 0 14px 10px; display: flex; min-width: 0; }
.library .seg button { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding-left: 6px; padding-right: 6px; }
.side-filter button[data-side="offense"].active, .team-show button[data-show="offense"].active { color: var(--orange-2); box-shadow: inset 0 0 0 1px var(--orange); }
.side-filter button[data-side="defense"].active, .team-show button[data-show="defense"].active { color: var(--blue-2); box-shadow: inset 0 0 0 1px var(--blue); }
.ss-cols.single { grid-template-columns: 1fr; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.chip {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text-2);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.chip:hover { border-color: var(--line-2); color: var(--text); }
.chip.active { background: var(--panel-3); border-color: var(--c, var(--blue)); color: var(--text); }
.chip .n { color: var(--muted); font-weight: 500; }

.play-list { overflow-y: auto; padding: 2px 10px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.play-card {
  display: grid; grid-template-columns: 74px 1fr; gap: 10px;
  padding: 8px; border-radius: 11px;
  background: var(--bg-2); border: 1px solid var(--line);
  cursor: pointer; position: relative;
  transition: border-color .15s, background .15s, transform .08s;
}
.play-card:hover { border-color: var(--line-2); background: #0f2040; }
.play-card:active { transform: scale(.995); }
.play-card.active { border-color: var(--orange); box-shadow: inset 3px 0 0 var(--orange); background: #172443; }
.play-card .thumb { width: 74px; height: 70px; border-radius: 7px; overflow: hidden; background: #0f2140; }
.play-card .thumb svg { width: 100%; height: 100%; display: block; }
.play-card .meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-right: 54px; }
.play-card .name { font: 700 17px/1.1 var(--font-display); letter-spacing: .02em; }
.play-card .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.play-card .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.tag { font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--panel-3); color: var(--text-2); letter-spacing: .02em; }
.tag.cat { background: color-mix(in srgb, var(--c) 20%, transparent); color: var(--c); }
.tag.custom { background: rgba(255, 194, 61, .16); color: var(--warn); }
.play-card .actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 2px; }
.mini-btn { width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.mini-btn svg { width: 16px; height: 16px; }
.mini-btn:hover { background: var(--panel-3); color: var(--text); }
.mini-btn.fav.on { color: var(--warn); }
.empty { color: var(--muted); text-align: center; padding: 30px 16px; font-size: 13px; }

/* ===== Board ===== */
.board-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.tb-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.scheme { display: flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; height: 34px; padding: 0 4px 0 10px; }
.scheme span { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.scheme.off span { color: var(--orange); }
.scheme.def span { color: var(--blue-2); }
.scheme select { background: transparent; border: 0; height: 32px; font-weight: 600; outline: none; max-width: 150px; box-shadow: none; }
.overlay-toggles { display: flex; gap: 6px; flex-wrap: wrap; }

.play-header { display: flex; align-items: center; gap: 10px; padding: 8px 14px; min-height: 48px; border-bottom: 1px solid var(--line); }
.ph-empty { color: var(--muted); font-size: 13px; }
.ph-title { font: 700 22px/1 var(--font-display); letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ph-meta { display: flex; gap: 6px; align-items: center; min-width: 0; }
.ph-actions { margin-left: auto; display: flex; gap: 6px; }

.court-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
.court { flex: 1; min-width: 0; min-height: 0; padding: 10px 10px 6px 64px; }
.court > svg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }

.tool-palette {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%); z-index: 3;
  display: flex; flex-direction: column; gap: 4px; padding: 5px;
  background: rgba(10, 21, 41, .88); border: 1px solid var(--line); border-radius: 12px;
  backdrop-filter: blur(6px);
}
.tool-palette button { width: 40px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.tool-palette button svg { width: 20px; height: 20px; }
.tool-palette button:hover { background: var(--panel-3); color: var(--text); }
.tool-palette button.active { background: var(--orange); color: #1b0d02; }
.tool-palette button.rec { color: var(--danger); }
.tool-palette button.rec.on { background: var(--danger); color: #fff; animation: pulse 1.4s infinite; }
.tool-palette hr { width: 70%; border: 0; border-top: 1px solid var(--line); margin: 3px auto; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 77, 94, .2); } }

.record-bar {
  position: absolute; left: 64px; right: 10px; bottom: 8px; z-index: 4;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 10px; border-radius: 12px;
  background: rgba(30, 10, 16, .94); border: 1px solid rgba(255, 77, 94, .5);
  box-shadow: var(--shadow);
}
.record-bar .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1.4s infinite; }
.record-bar .rec-title { font: 700 16px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: #ffb3bb; }
.record-bar input { flex: 1; min-width: 140px; height: 34px; }
.record-bar .steps-n { font-size: 12px; color: var(--text-2); white-space: nowrap; }

.playback { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); }
.playback.disabled .icon-btn, .playback.disabled .chip-btn, .playback.disabled .timeline { opacity: .4; pointer-events: none; }
.chip-btn { height: 32px; min-width: 44px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); font-weight: 700; font-size: 12.5px; color: var(--text-2); }
.timeline { position: relative; flex: 1; height: 38px; cursor: pointer; touch-action: none; margin: 0 6px; }
.tl-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; transform: translateY(-50%); background: var(--bg-2); border-radius: 6px; border: 1px solid var(--line); overflow: hidden; }
.tl-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--orange), var(--orange-2)); }
.tl-ticks { position: absolute; inset: 0; pointer-events: none; }
.tl-tick { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--panel-3); border: 2px solid var(--line-2); transform: translate(-50%, -50%); }
.tl-tick.done { background: var(--orange); border-color: var(--orange); }
.tl-tick span { position: absolute; top: 13px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); font-weight: 700; }
.tl-knob { position: absolute; top: 50%; left: 0; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--orange); transform: translate(-50%, -50%); box-shadow: 0 2px 8px rgba(0, 0, 0, .4); pointer-events: none; }

.step-strip { border-top: 1px solid var(--line); padding: 10px 14px 12px; min-height: 92px; display: flex; flex-direction: column; gap: 8px; }
.ss-head { display: flex; align-items: baseline; gap: 10px; }
.ss-num { font: 700 13px var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.ss-title { font: 700 19px/1.1 var(--font-display); letter-spacing: .02em; }
.ss-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ss-col { border-radius: 9px; padding: 8px 10px; font-size: 13px; color: var(--text-2); border: 1px solid var(--line); }
.ss-col b { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 2px; }
.ss-col.off { background: var(--orange-soft); border-color: rgba(255, 122, 26, .3); }
.ss-col.off b { color: var(--orange-2); }
.ss-col.def { background: var(--blue-soft); border-color: rgba(61, 139, 255, .3); }
.ss-col.def b { color: var(--blue-2); }
.ss-hint { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.ss-hint kbd, .kbd { font: 600 11px var(--font); background: var(--panel-3); border: 1px solid var(--line-2); border-bottom-width: 2px; padding: 1px 6px; border-radius: 5px; color: var(--text-2); }

@media (max-width: 1180px) {
  .toggle span { display: none; }
  .toggle { padding: 0 8px; }
}
@media (max-width: 860px), (max-height: 600px) {
  /* short or narrow screens: keep the court usable and let the board panel scroll instead */
  .board { overflow-y: auto; }
  .court-wrap { min-height: 300px; }
}
@media (max-width: 860px) {
  .court { padding: 6px 6px 4px 58px; }
  .tool-palette button { width: 36px; height: 36px; }
  .ss-cols { grid-template-columns: 1fr; }
  .record-bar { left: 58px; }
  .board-toolbar { padding: 8px; }
}
@media (max-width: 560px) {
  .court-wrap { flex-direction: column; }
  .tool-palette { position: static; transform: none; flex-direction: row; justify-content: space-between; margin: 6px 6px 0; overflow-x: auto; scrollbar-width: none; }
  .tool-palette button { width: 34px; height: 34px; flex: none; }
  .tool-palette hr { width: 0; height: 22px; border: 0; border-left: 1px solid var(--line); margin: auto 2px; }
  .court { padding: 6px; }
  .record-bar { left: 6px; right: 6px; }
  .play-header { flex-wrap: wrap; }
  .ph-actions .btn span { display: none; }
}
@media (max-height: 760px) and (min-width: 861px) {
  .step-strip { min-height: 0; padding: 8px 14px; }
  .ss-col { padding: 6px 9px; font-size: 12.5px; }
}
