/* ═══════════════════════════════════════════════
   SceneScan — Styles
   ═══════════════════════════════════════════════ */

/* ─── RESET & VARIABLES ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-card-hover: #1c2a4a;
  --bg-input: #1e1e36;
  --bg-surface: #252542;
  --bg-modal: #171729;

  --text-primary: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b85;
  --text-accent: #7c5cfc;

  --accent: #7c5cfc;
  --accent-hover: #6a48e8;
  --accent-glow: rgba(124, 92, 252, 0.25);
  --accent-subtle: rgba(124, 92, 252, 0.12);

  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --danger-hover: #e05a5a;

  --border: #2a2a45;
  --border-focus: #7c5cfc;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --action-bar-height: 132px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-bottom: calc(var(--action-bar-height) + var(--safe-bottom) + 20px);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

body:not(.listing-mode) {
  padding-bottom: calc(20px + var(--safe-bottom));
}

body.scenescan-locked {
  overflow: hidden;
}

.access-lock {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(124, 92, 252, 0.22), transparent 34%),
    var(--bg-primary);
}

.access-lock.hidden {
  display: none;
}

.access-lock-card {
  width: min(100%, 360px);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-modal);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.access-lock-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #9a7cff 100%);
  font-size: 2rem;
  box-shadow: 0 10px 34px rgba(124, 92, 252, 0.35);
}

.access-lock-card h1 {
  margin-bottom: 6px;
  font-size: 1.5rem;
  letter-spacing: 0;
}

.access-lock-card p {
  margin-bottom: 18px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.access-lock-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: 1.1rem;
  text-align: center;
  letter-spacing: 0.12em;
  outline: none;
}

.access-lock-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.access-lock-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.access-lock-submit:hover,
.access-lock-submit:focus-visible {
  background: var(--accent-hover);
  outline: none;
}

.access-lock-error {
  display: none;
  margin-top: 12px;
  color: var(--danger);
  font-size: 0.9rem;
}

.access-lock-error.active {
  display: block;
}

.app-main {
  padding-bottom: 8px;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ─── HEADER ─── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, var(--bg-primary) 60%, transparent);
  padding: 20px 20px 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 600px;
  margin: 0 auto;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0;
  background: linear-gradient(135deg, #e8e8f0 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.scene-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 4px auto 0;
  padding: 0 2px;
}

/* ─── QUICK HOME ─── */
.home-panel {
  max-width: 600px;
  margin: 0 auto;
  padding: 76px 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home-icon-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.home-icon,
.home-icon-row .previous-menu,
.home-icon-row .discord-home {
  width: 78px;
  height: 78px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, #9a7cff 100%);
  box-shadow: 0 10px 34px rgba(124, 92, 252, 0.35), 0 0 0 8px rgba(124, 92, 252, 0.1);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition), box-shadow var(--transition);
}

.home-icon:hover,
.home-icon:focus-visible,
.home-icon-row .previous-menu:hover,
.home-icon-row .previous-menu:focus-visible,
.home-icon-row .discord-home:hover,
.home-icon-row .discord-home:focus-visible {
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 13px 38px rgba(124, 92, 252, 0.42), 0 0 0 8px rgba(124, 92, 252, 0.14);
}

.home-icon:active,
.home-icon-row .previous-menu:active,
.home-icon-row .discord-home:active {
  transform: scale(0.96);
}

.home-title {
  margin-top: 22px;
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--text-primary);
}

.home-count {
  margin-top: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.home-search {
  width: 100%;
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 4px 14px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.home-search:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
}

.home-search:focus-within .search-icon {
  color: var(--accent);
}

.home-search-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
}

.home-search-input::placeholder {
  color: var(--text-muted);
}

.home-search-input::-webkit-search-decoration,
.home-search-input::-webkit-search-cancel-button,
.home-search-input::-webkit-search-results-button,
.home-search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

.home-search-results {
  width: 100%;
  display: none;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  text-align: left;
}

.home-search-results.show {
  display: block;
}

.home-search-result {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.home-search-result:last-child {
  border-bottom: none;
}

.home-search-result:hover,
.home-search-result:focus-visible {
  background: var(--accent-subtle);
  outline: none;
}

.home-search-result-tags {
  max-width: 100%;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.home-search-result-main {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-search-result-text {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 5px;
}

.home-search-copy {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.24);
}

.home-search-copy-link {
  color: var(--accent);
  background: var(--accent-subtle);
  border-color: rgba(124, 92, 252, 0.3);
}

.home-search-result-meta,
.home-search-empty {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
}

.home-search-empty {
  padding: 14px;
  text-align: center;
}

.home-actions {
  width: 100%;
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.home-primary,
.home-secondary,
.listing-back,
.action-icon-btn {
  border: none;
  font-family: var(--font);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.home-primary,
.home-secondary {
  min-height: 52px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.home-primary {
  color: white;
  background: var(--accent);
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.3);
}

.home-secondary {
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.home-primary:active,
.home-secondary:active {
  transform: scale(0.98);
}

.listing-header {
  max-width: 600px;
  margin: 0 auto;
  padding: 4px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
}

.listing-back,
.action-icon-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card-hover) 100%);
  border: none;
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.24), 0 0 0 4px rgba(124, 92, 252, 0.08);
  transition: all var(--transition);
}

.action-icon-btn {
  color: var(--text-secondary);
}

.action-icon-btn.active {
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, #35c2a1 100%);
  box-shadow: 0 4px 20px rgba(53, 194, 161, 0.28), 0 0 0 4px rgba(53, 194, 161, 0.12);
}

.action-icon-btn .icon-all-scenes {
  display: none;
}

.action-icon-btn.active .icon-no-link {
  display: none;
}

.action-icon-btn.active .icon-all-scenes {
  display: block;
}

.listing-back:active,
.action-icon-btn:active {
  transform: scale(0.93);
}

/* ─── EMPTY STATE ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  max-width: 320px;
  margin: 0 auto;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.6;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.empty-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 8px;
}

.empty-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─── SCENE LIST ─── */
.scene-list {
  max-width: 600px;
  margin: 0 auto;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scene-list:empty {
  display: none;
}

/* ─── SCENE CARD ─── */
.scene-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px 14px;
  position: relative;
  animation: cardIn 0.3s ease-out;
  transition: all var(--transition);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
}

.scene-card:active {
  transform: scale(0.99);
}

.scene-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(124, 92, 252, 0.3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.scene-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: all var(--transition);
  z-index: 2;
}

.scene-card:hover .scene-card-actions,
.scene-card:focus-within .scene-card-actions {
  opacity: 1;
}

@media (hover: none) {
  .scene-card-actions {
    opacity: 1;
  }
}

.scene-card-action {
  width: 34px;
  height: 34px;
  background: rgba(37, 37, 66, 0.86);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.scene-card-edit:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

.scene-card-copy:hover {
  color: var(--success);
  background: rgba(74, 222, 128, 0.12);
}

.scene-card-copy-link:hover {
  color: var(--accent);
  background: var(--accent-subtle);
}

.scene-card-delete:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ─── SCENE CARD MEDIA (videobox on the right) ─── */
.scene-card.has-media {
  --media-width: 160px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--media-width);
  align-items: center;
  column-gap: 16px;
  padding-right: 14px;
}

.scene-card-content {
  min-width: 0;
}

.scene-card.has-media .scene-card-actions {
  top: 10px;
  right: 14px;
}

.scene-card-media {
  position: relative;
  width: var(--media-width);
  aspect-ratio: 16 / 9;
  margin-top: 36px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-input);
  border: 1px solid var(--border);
  align-self: center;
  z-index: 1;
}

.scene-card-media-element {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg-input);
  pointer-events: none;
}

.scene-card-media-play {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.55));
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 3;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.scene-card-media-play:hover {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.7));
}

.scene-card-media-play:active {
  transform: scale(0.95);
}

.scene-card-media-play svg {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.scene-card-media.is-playing .scene-card-media-play {
  opacity: 0;
  pointer-events: none;
}

.scene-card-media.is-playing:hover .scene-card-media-play {
  opacity: 1;
  pointer-events: auto;
}

.scene-card-media-play .icon-pause {
  display: none;
}

.scene-card-media.is-playing .scene-card-media-play .icon-play {
  display: none;
}

.scene-card-media.is-playing .scene-card-media-play .icon-pause {
  display: block;
}

.scene-card-media.is-ended .scene-card-media-play {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.6));
}

/* Scene card without any saved media link: keeps the same media slot
   dimensions as a real video but replaces the play button with a "barred 0"
   sign at the same centered position. */
.scene-card-media-empty {
  border-style: dashed;
  border-color: rgba(42, 42, 69, 0.85);
  background:
    repeating-linear-gradient(45deg, transparent 0 8px, rgba(255, 255, 255, 0.022) 8px 16px),
    var(--bg-input);
}

.scene-card-media-no-video {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55));
  transition: color var(--transition), transform var(--transition);
}

.scene-card:hover .scene-card-media-no-video {
  color: var(--text-secondary);
  transform: scale(1.04);
}

.scene-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scene-tag {
  max-width: 100%;
  color: var(--text-primary);
  background: rgba(124, 92, 252, 0.22);
  border: 1px solid rgba(154, 124, 255, 0.52);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.28;
  overflow-wrap: anywhere;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.scene-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  min-width: 0;
}

.scene-title {
  flex: 0 1 auto;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 0;
  overflow-wrap: anywhere;
}

.scene-badge {
  flex: 0 0 auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.scene-badge-film {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.scene-badge-series {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.scene-badge-warning {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.42);
  white-space: normal;
}

.scene-detail-line {
  margin-top: 6px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.scene-timeago {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ─── ACTION BAR (bouton + centré + barre de recherche) ─── */
.action-bar {
  max-width: 600px;
  margin: 0 auto;
  padding: 12px max(16px, var(--safe-right)) calc(12px + var(--safe-bottom)) max(16px, var(--safe-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  width: 100%;
  transform: translateX(-50%);
  z-index: 15;
  background: linear-gradient(180deg, rgba(15, 15, 26, 0), var(--bg-primary) 18%, var(--bg-primary));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(42, 42, 69, 0.75);
}

body:not(.listing-mode) .action-bar {
  display: none;
}

.action-buttons {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.action-buttons .listing-back {
  flex: 0 0 54px;
}

.action-buttons .action-icon-btn {
  flex: 0 0 54px;
}

.action-buttons .fab-center {
  flex: 0 0 54px;
}

.fab-center {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #9a7cff 100%);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124, 92, 252, 0.45), 0 0 0 4px rgba(124, 92, 252, 0.12);
  transition: all var(--transition);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  margin-top: 0;
}

.fab-center::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(124, 92, 252, 0.15);
  animation: fabPulse 2.5s ease-in-out infinite;
}

@keyframes fabPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 0.2; }
}

.fab-center:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(124, 92, 252, 0.55), 0 0 0 4px rgba(124, 92, 252, 0.2);
}

.listing-back:hover,
.action-icon-btn:hover {
  transform: scale(1.08);
  background: linear-gradient(135deg, var(--bg-card-hover) 0%, #31285f 100%);
  box-shadow: 0 6px 28px rgba(124, 92, 252, 0.32), 0 0 0 4px rgba(124, 92, 252, 0.14);
}

.action-icon-btn.active:hover {
  background: linear-gradient(135deg, var(--accent) 0%, #35c2a1 100%);
}

.fab-center:active {
  transform: scale(0.93);
}

/* ─── SEARCH BAR ─── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 0;
  width: 100%;
  min-width: 0;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 16px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-bar:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-sm);
}

.search-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color var(--transition);
}

.search-bar:focus-within .search-icon {
  color: var(--accent);
}

.search-input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font);
  padding: 10px 10px;
  min-height: 44px;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input::-webkit-search-decoration,
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-results-button,
.search-input::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}

.search-clear {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  touch-action: manipulation;
}

.search-clear.visible {
  display: flex;
}

.search-clear:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.search-clear:active {
  transform: scale(0.9);
}

/* ─── MODAL ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: overlayIn 0.2s ease-out;
}

@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-modal);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 500px;
  max-height: min(92vh, calc(100dvh - 10px));
  max-height: min(92dvh, calc(100dvh - 10px));
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 0 0 calc(var(--safe-bottom) + 16px);
  animation: modalSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

@keyframes modalSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (min-width: 540px) {
  .modal-overlay {
    align-items: center;
  }
  .modal {
    border-radius: var(--radius-xl);
    max-height: 85vh;
    max-height: 85dvh;
    animation: modalFadeIn 0.3s ease-out;
  }
  @keyframes modalFadeIn {
    from {
      opacity: 0;
      transform: scale(0.95) translateY(20px);
    }
    to {
      opacity: 1;
      transform: scale(1) translateY(0);
    }
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 4px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-modal);
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.modal-delete {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #f87171;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.modal-delete:hover {
  background: rgba(239, 68, 68, 0.14);
  color: #ef4444;
}

.modal-delete:active { transform: scale(0.92); }

.modal-delete.hidden { display: none; }

.modal-body {
  padding: 12px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.delete-modal {
  max-width: 430px;
}

.delete-modal-body {
  align-items: center;
  text-align: center;
  gap: 14px;
}

.delete-warning-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.14);
  border: 2px solid rgba(239, 68, 68, 0.55);
  color: #f87171;
  font-size: 1.7rem;
  font-weight: 800;
}

.btn-danger {
  flex: 1;
  min-height: 46px;
  border: 0;
  border-radius: var(--radius-md);
  background: #dc2626;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition);
}

.btn-danger:hover { filter: brightness(1.12); }
.btn-danger:active { transform: scale(0.98); }

/* Keep the add/edit form fully visible instead of scrolling inside the modal. */
#modal {
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}

@media (min-width: 540px) {
  #modal {
    max-height: calc(100dvh - 32px);
  }
}

#modal .modal-header {
  padding-top: clamp(8px, 2dvh, 20px);
}

#modal .modal-body {
  gap: clamp(6px, 1.65dvh, 18px);
  padding-top: clamp(6px, 1.2dvh, 12px);
  padding-bottom: clamp(8px, 1.5dvh, 16px);
}

@media (max-height: 760px) {
  #modal .form-group {
    gap: 4px;
  }

  #modal .form-label {
    font-size: 0.68rem;
  }

  #modal .form-input,
  #modal .toggle-btn {
    min-height: 38px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  #modal .tag-editor {
    min-height: 40px;
    padding: 5px 8px;
  }

  #modal .stepper-btn {
    width: 34px;
    height: 34px;
  }

  #modal .timestamp-display {
    min-height: 38px;
    padding: 6px 10px;
  }

  #modal .time-steppers {
    margin-top: 3px;
    gap: 5px;
  }

  #modal .time-stepper {
    gap: 3px;
  }

  #modal .time-stepper .stepper-btn {
    width: 30px;
  }

  #modal #submitBtn {
    min-height: 40px;
    padding: 9px;
  }
}

/* ─── DETAILS MODAL ─── */
.details-body {
  padding: 14px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.details-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.details-tags .scene-tag {
  font-size: 1rem;
}

.details-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.details-media {
  display: grid;
  gap: 8px;
}

.details-media img,
.details-media video {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.details-media-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.details-media-copy {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(124, 92, 252, 0.35);
  border-radius: var(--radius-sm);
  background: var(--accent-subtle);
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}

.details-media-copy-link {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.12);
  color: var(--success);
}

.details-media-copy:active {
  transform: scale(0.98);
}

.details-fields {
  display: grid;
  gap: 10px;
}

.details-fields div {
  display: grid;
  gap: 3px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.details-fields dt {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.details-fields dd {
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.details-actions {
  padding: 0 20px calc(var(--safe-bottom) + 16px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.media-fallback-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

.media-download-link {
  text-decoration: none;
}

/* ─── FORM ELEMENTS ─── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: all var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.media-url-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 42px;
  gap: 8px;
  align-items: center;
}

.media-url-paste,
.media-url-clear {
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.media-url-paste {
  padding: 0 12px;
  font-size: 0.85rem;
}

.media-url-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  font-size: 1.25rem;
}

.media-url-paste:active,
.media-url-clear:active {
  transform: scale(0.96);
}

/* ─── TAG EDITOR ─── */
.tag-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 8px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: text;
}

.tag-editor:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.tag-list {
  display: contents;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 34px;
  padding: 6px 8px 6px 10px;
  background: var(--accent-subtle);
  border: 1px solid rgba(124, 92, 252, 0.28);
  border-radius: 999px;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.tag-chip span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tag-chip svg {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.tag-input {
  flex: 1 1 150px;
  min-width: 110px;
  min-height: 34px;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
}

.tag-input::placeholder {
  color: var(--text-muted);
}

/* ─── TOGGLE GROUP ─── */
.toggle-group {
  display: flex;
  gap: 0;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  overflow: hidden;
}

.toggle-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  min-height: 44px;
  min-width: 0;
  white-space: nowrap;
}

.toggle-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.toggle-btn:not(.active):hover {
  color: var(--text-secondary);
  background: var(--bg-surface);
}

/* ─── AUTOCOMPLETE ─── */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
  display: none;
  box-shadow: var(--shadow-md);
}

.autocomplete-list.show {
  display: block;
}

.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: background var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background: var(--accent-subtle);
}

.autocomplete-item .ac-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.7;
}

/* ─── STEPPER ─── */
.form-row {
  display: flex;
  gap: 12px;
}

.form-row .half {
  flex: 1;
}

.stepper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}

.stepper:focus-within {
  border-color: var(--border-focus);
}

.stepper-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.stepper-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.stepper-btn:active {
  background: var(--accent-subtle);
  color: var(--accent);
}

.stepper-value {
  flex: 1;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 8px;
  min-width: 36px;
  font-variant-numeric: tabular-nums;
}

/* ─── TIMESTAMP ─── */
.timestamp-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  min-height: 48px;
}

.timestamp-display:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.timestamp-placeholder,
.timestamp-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  font-family: var(--font);
}

.timestamp-placeholder {
  color: var(--text-muted);
  display: block;
}

.timestamp-value {
  color: var(--text-primary);
  display: none;
}

.timestamp-display.has-value .timestamp-placeholder {
  display: none;
}

.timestamp-display.has-value .timestamp-value {
  display: block;
}

.timestamp-clear {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: none;
  transition: all var(--transition);
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.timestamp-display.has-value .timestamp-clear {
  display: flex;
}

.timestamp-clear:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

/* ─── TIME STEPPERS ─── */
.time-steppers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.time-stepper {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-unit {
  align-self: center;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
}

.time-stepper .stepper-btn {
  width: 38px;
}

.time-stepper .stepper-value {
  min-width: 24px;
  padding: 0 2px;
}

/* ─── SUBMIT BUTTON ─── */
.btn-primary,
.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font);
  margin-top: 6px;
  touch-action: manipulation;
  min-height: 50px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(124, 92, 252, 0.35);
  transform: translateY(-1px);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.98);
}

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  bottom: calc(var(--action-bar-height) + var(--safe-bottom) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  background: #181a24;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  animation: toastIn 0.3s ease-out;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.toast-out {
  animation: toastOut 0.25s ease-in forwards;
}

.toast-success {
  border-color: #5ee28a;
  background: #166534;
  color: #ffffff;
}

.toast-error {
  border-color: #ff8a8a;
  background: #991b1b;
  color: #ffffff;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 540px) {
  :root {
    --action-bar-height: 148px;
  }

  .scene-card-actions {
    right: 10px;
    top: 10px;
    opacity: 1;
  }

  .scene-card-action {
    width: 36px;
    height: 36px;
  }

  .scene-title-row {
    align-items: center;
    gap: 7px;
  }

  .scene-title {
    flex: 0 1 auto;
  }

  .scene-detail-line {
    font-size: 0.84rem;
  }

  .modal {
    width: 100%;
    max-height: calc(100dvh - 8px);
  }

  .modal-body {
    gap: 12px;
  }

  .form-input,
  .search-input {
    font-size: 16px;
  }

  .autocomplete-list {
    max-height: 150px;
  }

  .action-bar {
    gap: 10px;
    padding-top: 14px;
  }

  .fab-center {
    width: 56px;
    height: 56px;
    flex: 0 0 56px;
  }

  .listing-back,
  .action-icon-btn {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
  }

  .scene-card.has-media {
    --media-width: 132px;
    column-gap: 10px;
  }

  .scene-card.has-media .scene-card-actions {
    right: 14px;
  }
}

@media (max-width: 400px) {
  :root {
    --action-bar-height: 138px;
  }

  .details-media-actions {
    grid-template-columns: 1fr;
  }

  .app-header {
    padding: 12px 14px 10px;
  }

  .header-content {
    gap: 10px;
  }

  .app-title {
    font-size: 1.18rem;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .scene-count {
    padding: 3px 9px;
    font-size: 0.74rem;
  }

  .app-subtitle {
    font-size: 0.78rem;
  }

  .scene-list {
    padding: 8px 12px;
  }

  .scene-card {
    padding: 14px 12px;
  }

  .scene-card-actions {
    right: 8px;
    top: 8px;
  }

  .scene-card-action {
    width: 36px;
    height: 36px;
  }

  .scene-tag {
    font-size: 0.95rem;
    padding: 6px 9px;
  }

  .scene-title-row {
    gap: 6px;
  }

  .scene-title {
    flex: 0 1 auto;
    font-size: 0.9rem;
  }

  .scene-detail-line {
    font-size: 0.82rem;
  }

  .scene-card.has-media {
    --media-width: 112px;
    column-gap: 10px;
    padding-right: 12px;
  }

  .scene-card.has-media .scene-card-actions {
    right: 12px;
  }

  .scene-card-media-play svg {
    width: 22px;
    height: 22px;
  }

  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding-bottom: max(8px, var(--safe-bottom));
  }

  .modal-header {
    padding: 10px 14px 0;
  }

  .modal-header h2 {
    font-size: 1rem;
  }

  .modal-close {
    min-width: 38px;
    min-height: 38px;
    padding: 4px;
  }

  .modal-body {
    padding: 8px 14px 10px;
    gap: 10px;
  }

  .form-group {
    gap: 4px;
  }

  .form-label {
    font-size: 0.68rem;
  }

  .form-input {
    padding: 9px 12px;
  }

  .tag-editor {
    min-height: 44px;
    gap: 6px;
    padding: 6px;
  }

  .tag-chip {
    min-height: 30px;
    padding: 4px 7px 4px 9px;
    font-size: 0.82rem;
  }

  .tag-input {
    min-height: 30px;
  }

  .toggle-btn {
    min-height: 40px;
    padding: 7px 10px;
  }

  .form-row {
    gap: 8px;
  }

  .media-url-field {
    grid-template-columns: minmax(0, 1fr) 64px 40px;
    gap: 6px;
  }

  .media-url-paste {
    grid-column: auto;
    order: 0;
    padding: 0 8px;
    font-size: 0.78rem;
  }

  .media-url-paste,
  .media-url-clear {
    min-height: 40px;
  }

  .stepper-btn {
    width: 38px;
    height: 38px;
  }

  .stepper-value {
    min-width: 28px;
    padding: 0 4px;
    font-size: 1rem;
  }

  .timestamp-placeholder,
  .timestamp-value {
    font-size: 1.08rem;
  }

  .timestamp-display {
    min-height: 42px;
    padding: 8px 12px;
  }

  .timestamp-clear {
    min-width: 32px;
    min-height: 32px;
  }

  .time-steppers {
    gap: 6px;
    margin-top: 4px;
  }

  .time-stepper {
    gap: 4px;
  }

  .time-stepper .stepper-btn {
    width: 32px;
  }

  .time-stepper .stepper-value {
    min-width: 22px;
    font-size: 0.95rem;
  }

  #submitBtn {
    position: sticky;
    bottom: max(0px, var(--safe-bottom));
    z-index: 3;
    min-height: 44px;
    margin-top: 2px;
    padding: 11px;
    box-shadow: 0 -8px 18px rgba(23, 23, 41, 0.9);
  }

  .fab-center {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .fab-center svg {
    width: 24px;
    height: 24px;
  }

  .action-bar {
    padding: 10px max(12px, var(--safe-right)) calc(10px + var(--safe-bottom)) max(12px, var(--safe-left));
    gap: 8px;
  }

  .action-buttons {
    gap: 12px;
  }

  .listing-back,
  .action-icon-btn {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .search-bar {
    border-radius: var(--radius-md);
    padding-left: 12px;
  }

  .search-input {
    font-size: 16px;
    padding: 8px 8px;
  }

  .toast-container {
    bottom: calc(var(--action-bar-height) + var(--safe-bottom) + 8px);
  }
}

@media (min-width: 768px) {
  :root {
    --action-bar-height: 132px;
  }

  .app-header {
    padding: 28px 32px 20px;
  }

  .action-bar {
    padding: 14px 24px calc(14px + var(--safe-bottom));
    gap: 12px;
  }

  .fab-center {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
  }

  .fab-center svg {
    width: 30px;
    height: 30px;
  }

  .scene-list {
    padding: 12px 24px;
    gap: 12px;
  }

  .scene-card {
    padding: 20px 22px;
    border-radius: var(--radius-lg);
  }
}

/* ─── UTILITY ─── */
.hidden {
  display: none !important;
}
