/* PlaySketch UI overhaul v240 */

:root {
  --ds-sidebar-width: 300px;
}

/* ── Welcome hero cards ── */
.welcome-hero-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 20px;
}

.welcome-hero-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px 14px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.welcome-hero-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(255, 255, 255, 0.1);
}

.welcome-hero-icon { font-size: 24px; line-height: 1; }
.welcome-hero-title { font-size: 16px; font-weight: 800; }
.welcome-hero-desc { font-size: 12px; opacity: 0.78; line-height: 1.35; }

@media (max-width: 640px) {
  .welcome-hero-cards { grid-template-columns: 1fr; max-width: 320px; }
}

/* ── Designer grid: 3 columns ── */
#screen-designer .ds-body {
  grid-template-columns: 248px minmax(0, 1fr) var(--ds-sidebar-width);
}

/* ── Top bar ── */
.ds-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--od-border);
  border-radius: 8px;
  background: var(--od-surface);
  color: var(--od-text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ds-icon-btn:hover { background: var(--od-designer-tool-hover); }

.ds-topbar-menu-wrap { position: relative; }

.ds-menu-trigger {
  min-width: 42px;
  font-size: 22px;
  line-height: 1;
  padding: 0 10px;
}

.ds-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--od-border);
  background: var(--od-surface);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  z-index: 200;
}

.ds-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--od-text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ds-dropdown-item:hover { background: var(--od-designer-tool-hover); }

/* ── Sidebar panel (frames + animation + stats) ── */
.ds-sidebar-panel {
  background: var(--od-designer-panel);
  border-left: 1px solid var(--od-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.ds-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--od-border);
  background: var(--od-designer-panel-head);
  flex-shrink: 0;
}

.ds-sidebar-tab {
  flex: 1;
  padding: 11px 8px;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.ds-sidebar-tab:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

.ds-sidebar-tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 -3px 0 #3b82f6;
}

.ds-sidebar-tab-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: none;
}

.ds-sidebar-tab-pane.is-active { display: block; }

.ds-sidebar-tab-pane#sidebar-tab-anim,
.ds-sidebar-tab-pane#sidebar-tab-stats {
  padding: 14px 12px;
}

#sidebar-tab-frames .ds-thumb-list-vertical {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Frame thumbnails ── */
#frames-container .frame-item {
  position: relative;
  transform: scale(1);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

#frames-container .frame-item.active {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.18);
}

.frame-num-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #1e293b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

#frames-container .frame-item.active .frame-num-badge {
  background: #2563eb;
}

/* ── Frame actions row ── */
.ds-frame-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ── Collapsible coaching notes ── */
.ds-notes-collapsible {
  border-top: 1px solid var(--od-border);
  margin-top: 4px;
}

.ds-notes-collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  background: var(--od-surface-2);
  color: var(--od-text);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.ds-notes-collapse-toggle:hover { background: var(--od-designer-tool-hover); }

.ds-notes-collapsible.is-collapsed .ds-notes-collapse-body { display: none; }
.ds-notes-collapsible.is-collapsed .ds-notes-collapse-chevron { transform: rotate(-90deg); }

.ds-notes-collapse-body { padding: 0 0 8px; }

/* ── Court float zoom (reuse .ds-court-zoom base) ── */
#ds-court-float-bar {
  top: 10px;
  right: 10px;
}

.ds-court-mode-switch {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
}

.ds-court-mode-btn {
  border: none;
  border-radius: 6px;
  padding: 0 10px;
  min-height: 30px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--od-text-muted);
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
}

.ds-court-mode-btn:hover {
  background: var(--od-designer-tool-hover);
  color: var(--od-text);
}

.ds-court-mode-btn.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.35);
}

.ds-court-float-sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 2px;
  background: var(--od-border);
  opacity: 0.7;
}

[data-theme="dark"] .ds-court-mode-switch {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .ds-court-mode-btn.active {
  background: #3b82f6;
}

/* ── Snippets (Building Blocks lite) ── */
.snippets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  margin: 8px 0 4px;
}

.snippets-empty {
  padding: 18px 14px;
  border: 1px dashed var(--od-border);
  border-radius: 10px;
  color: var(--od-text-muted);
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.snippet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--od-border);
  border-radius: 10px;
  background: var(--od-surface);
}

.snippet-row-thumb {
  width: 52px;
  height: 34px;
  flex-shrink: 0;
  object-fit: contain;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--od-border);
}

.snippet-row-thumb.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.snippet-row-main {
  flex: 1;
  min-width: 0;
}

.snippet-row-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--od-text);
}

.snippet-row-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--od-text-muted);
}

.snippet-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.snippet-btn {
  border: 1px solid var(--od-border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: var(--od-surface);
  color: var(--od-text);
}

.snippet-btn-insert {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

.snippet-btn-insert:hover {
  background: #1d4ed8;
}

.snippet-btn-delete {
  width: 32px;
  padding: 6px 0;
  color: #b91c1c;
}

.snippet-btn-delete:hover {
  background: #fef2f2;
}

.org-filter-snippets {
  border-color: #c4b5fd;
  color: #5b21b6;
}

.snippets-overlay .snippets-delete-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  font-size: 13px;
}

.snippets-overlay #snippets-replace-btn {
  width: 100%;
  margin-top: 8px;
}

.snippets-item-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  border-bottom: 1px solid var(--od-border, #e5e7eb);
}

.snippets-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.snippets-item:hover { background: #f8fafc; }
.snippets-item.active { background: #eff6ff; }

.snippets-item-thumb {
  width: 52px;
  height: 40px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
  flex-shrink: 0;
}

.snippets-item-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.snippets-item-name {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.snippets-item-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
}

.snippets-tag-bar .playbank-cat-chip.active {
  background: #ede9fe;
  border-color: #8b5cf6;
  color: #5b21b6;
}

/* ── Contextual properties ── */
.ds-prop-section[hidden] { display: none !important; }

.line-action-type-grid-icons .line-action-type-btn-label {
  font-size: 10px;
}

/* ── Library empty preview CTAs ── */
.org-preview-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.org-preview-empty-btn {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--od-border);
  background: var(--od-surface);
  color: var(--od-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.org-preview-empty-btn.primary {
  background: #2563eb;
  border-color: #1d4ed8;
  color: #fff;
}

/* ── Presentation ── */
.pres-notes-bar {
  flex-shrink: 0;
  background: #0f172a;
  border-top: 1px solid #334155;
}

.pres-notes-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.pres-notes-body {
  max-height: 140px;
  overflow-y: auto;
  padding: 0 16px 12px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.45;
}

.pres-notes-bar.is-collapsed .pres-notes-body { display: none; }
.pres-notes-bar.is-collapsed .pres-notes-chevron { transform: rotate(-90deg); }

.pres-swipe-hint {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
  animation: pres-hint-fade 4s ease forwards;
}

@keyframes pres-hint-fade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

#pres-video-btn {
  background: #dc2626 !important;
  color: #fff !important;
  padding: 8px 14px !important;
  border-radius: 8px !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

#pres-video-btn:not([hidden]) { display: inline-flex !important; align-items: center; }

@media (orientation: landscape) {
  html.tablet-device #presentation-overlay .pres-frame-strip:not([hidden]) {
    display: flex !important;
  }
}

html.tablet-device .ds-court-sheet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  padding: 0 10px;
  min-width: 52px;
}

.ds-court-sheet-btn { display: none; }

html.tablet-device .ds-court-zoom-btn {
  min-width: 44px;
  min-height: 44px;
  font-size: 20px;
}

html.tablet-device .ds-court-mode-btn {
  min-height: 40px;
  padding: 8px 14px;
  font-size: 13px;
}

html.tablet-device .ds-topbar-right .ds-nav-btn {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 14px;
}

html.tablet-device .ds-icon-btn {
  min-width: 44px;
  min-height: 44px;
}

html.tablet-device .ds-frame-actions {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 6px;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

html.tablet-device .ds-frame-actions .ds-frame-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.line-type-float-bar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 16px);
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.12);
}

.line-type-float-bar[hidden] {
  display: none !important;
}

.line-type-float-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  flex-shrink: 0;
  padding-left: 4px;
}

.line-type-float-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.line-type-float-btn {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
  padding: 6px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.line-type-float-btn:hover {
  background: #f1f5f9;
}

.line-type-float-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
}

.line-type-float-btn-icon svg {
  width: 28px;
  height: 20px;
  display: block;
}

.line-type-float-btn-label {
  font-size: 9px;
  font-weight: 700;
  color: #334155;
  line-height: 1.1;
}

html.tablet-device .line-type-float-btn {
  min-width: 56px;
  min-height: 48px;
  padding: 8px 6px;
}

.tablet-court-sheet {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
}

.tablet-court-sheet[hidden] {
  display: none !important;
}

.tablet-court-sheet-panel {
  width: min(100%, 480px);
  max-height: min(70vh, 520px);
  overflow: auto;
  background: var(--od-surface, #fff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
}

.tablet-court-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--od-border, #e2e8f0);
  font-weight: 800;
  font-size: 15px;
}

.tablet-court-sheet-close {
  border: none;
  background: transparent;
  font-size: 20px;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.tablet-court-sheet-body .ds-court-view-panel {
  border-top: none;
}

/* ── Tablet designer ── */
html.tablet-device #screen-designer .ds-body {
  grid-template-columns: minmax(132px, 160px) minmax(0, 1fr) minmax(180px, 220px);
}

html.tablet-device #screen-designer .ds-sidebar-panel {
  display: flex;
}

html.tablet-device .ds-tool-item {
  min-height: 44px;
  padding-top: 11px;
  padding-bottom: 11px;
}

html.tablet-device .ds-frame-btn {
  min-height: 40px;
}

html.tablet-device .toast-stack {
  top: auto;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  align-items: center;
}

/* Hide legacy columns if present */
.ds-frames-column,
.ds-right-panel { display: none !important; }

/* ── Court view (OOB / BLOB) ── */
.ds-court-view-panel {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--od-border);
}

.ds-court-view-heading {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--od-text-muted);
  margin-bottom: 10px;
}

.court-view-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.court-view-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--od-text);
  flex-shrink: 0;
}

.court-view-select {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--od-border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--od-surface);
  color: var(--od-text);
}

.court-view-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--od-text);
  margin-bottom: 8px;
  cursor: pointer;
}

.court-view-templates {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--od-border);
}

.court-view-templates-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--od-text-muted);
  margin-bottom: 8px;
}

.court-view-template-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.court-view-template-btns .ds-frame-btn {
  flex: 1 1 auto;
  min-width: 64px;
  padding: 7px 8px;
  font-size: 12px;
}
