/* ==========================================================================
   MOTIONSTOP - ULTRA SIMPLE NEO-BRUTALIST THEME FOR KIDS (5+ YEARS OLD)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700;800&family=Nunito:wght@700;800;900&display=swap');

:root {
  /* Neo-brutalist Colors */
  --nb-bg: #fdfbf7;
  --nb-yellow: #ffde59;
  --nb-yellow-hover: #ffd229;
  --nb-pink: #ff66c4;
  --nb-pink-hover: #ff47b5;
  --nb-cyan: #5ce1e6;
  --nb-cyan-hover: #38d6dc;
  --nb-green: #7ed957;
  --nb-green-hover: #6bc942;
  --nb-purple: #8c52ff;
  --nb-purple-hover: #7534f5;
  --nb-red: #ff5757;
  --nb-red-hover: #ff3333;
  --nb-orange: #ff914d;
  
  --nb-white: #ffffff;
  --nb-card: #ffffff;
  --nb-black: #121212;

  /* Brutalist Shadows & Borders */
  --nb-border: 3.5px solid #121212;
  --nb-border-thin: 2.5px solid #121212;
  --nb-shadow: 4px 4px 0px #121212;
  --nb-shadow-lg: 6px 6px 0px #121212;
  --nb-shadow-sm: 3px 3px 0px #121212;
  --nb-shadow-pressed: 1px 1px 0px #121212;

  /* Roundedness */
  --nb-radius: 18px;
  --nb-radius-sm: 12px;
  --nb-radius-full: 9999px;
}

/* Reset & iPad/Mobile Touch Protection */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

html, body {
  height: 100%;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: fixed;
}

body {
  font-family: 'Fredoka', 'Nunito', system-ui, sans-serif;
  background-color: var(--nb-bg);
  color: var(--nb-black);
  display: flex;
  flex-direction: column;
}

/* ==================== TOP BAR (COMPACT & NON-OVERFLOWING) ==================== */
.nb-header {
  height: 62px;
  background: var(--nb-yellow);
  border-bottom: var(--nb-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  flex-shrink: 0;
  z-index: 20;
  gap: 8px;
  overflow: hidden;
}

.nb-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nb-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--nb-white);
  padding: 5px 10px;
  border-radius: var(--nb-radius-full);
  border: var(--nb-border-thin);
  box-shadow: var(--nb-shadow-sm);
  font-size: 1rem;
  font-weight: 800;
  white-space: nowrap;
}

/* Mode Switcher: 🎬 Film vs 📖 BD Comics */
.nb-mode-switcher {
  display: flex;
  background: var(--nb-white);
  border: var(--nb-border-thin);
  border-radius: var(--nb-radius-full);
  padding: 2px;
  box-shadow: var(--nb-shadow-sm);
  gap: 2px;
  flex-shrink: 0;
}

.nb-mode-pill {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: var(--nb-radius-full);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.1s ease;
  outline: none;
  white-space: nowrap;
}

.nb-mode-pill.active {
  background: var(--nb-black);
  color: var(--nb-yellow);
  box-shadow: 1px 1px 0px rgba(0,0,0,0.2);
}

.nb-header-center {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 1;
  overflow-x: auto;
}

.nb-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nb-btn-black {
  background: var(--nb-black);
  color: var(--nb-white);
}

/* Keep the top bar calm: these actions remain available from the Menu modal. */
.nb-header-right > #btn-reset-project,
.nb-header-right > #btn-undo,
.nb-header-right > #btn-redo,
.nb-header-right > #btn-save-project,
.nb-header-right > #btn-load-project,
.nb-header-right > #btn-export-video {
  display: none;
}

/* ==================== 3-COLUMN MAIN AREA ==================== */
.nb-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  background: #f0ede6;
}

/* Left & Right Side Panels */
.nb-panel {
  background: var(--nb-bg);
  border: var(--nb-border);
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
  z-index: 10;
  flex-shrink: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nb-left-panel {
  width: 175px;
  border-top: none;
  border-bottom: none;
  border-left: none;
}

.nb-right-panel {
  width: 215px;
  border-top: none;
  border-bottom: none;
  border-right: none;
}

#comic-tools-panel {
  overflow-y: auto;
  padding-bottom: 4px;
}

@media (max-height: 780px) {
  .nb-header { height: 56px; }
  .nb-timeline-deck { height: 148px; }
  .nb-panel { padding-block: 7px; }
}

@media (max-width: 900px) {
  .nb-audio-status { display: none; }
  .nb-comic-title-control { min-width: 170px; }
}

/* Center Stage Area */
.nb-stage-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 12px;
  background: #eae6de;
  touch-action: none;
}

/* CANVAS: 100% PURE WHITE BOX WITH BOLD BORDER */
.nb-canvas-frame {
  position: relative;
  width: min(100%, 1280px);
  aspect-ratio: 16 / 9;
  max-width: 100%;
  max-height: 100%;
  background: #ffffff !important;
  border: 4px solid #121212;
  border-radius: 18px;
  box-shadow: var(--nb-shadow-lg);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

#main-canvas,
#comic-canvas {
  display: block;
  background: #ffffff !important;
  cursor: grab;
  touch-action: none;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

#main-canvas:active {
  cursor: grabbing;
}

/* ==================== BOTTOM TIMELINE DECK ==================== */
.nb-timeline-deck {
  height: 180px;
  background: var(--nb-white);
  border-top: var(--nb-border);
  display: flex;
  flex-direction: column;
  z-index: 20;
  flex-shrink: 0;
}

/* Filmstrip Row */
.nb-filmstrip-row {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  gap: 10px;
  background: #f7f4ed;
  -webkit-overflow-scrolling: touch;
}

.nb-filmstrip-row::-webkit-scrollbar {
  height: 8px;
}

.nb-filmstrip-row::-webkit-scrollbar-thumb {
  background: #121212;
  border-radius: 4px;
}

/* Bottom Controls Row */
.nb-timeline-controls {
  height: 54px;
  background: var(--nb-yellow);
  border-top: var(--nb-border-thin);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  gap: 6px;
  overflow-x: auto;
}

.nb-playback-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nb-frame-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ==================== RESPONSIVE: IPAD & MOBILE ==================== */
@media (max-width: 1024px) {
  .nb-left-panel {
    width: 145px;
    padding: 6px;
  }
  .nb-right-panel {
    width: 180px;
    padding: 6px;
  }
  .nb-header {
    height: 56px;
    padding: 0 8px;
  }
  .nb-timeline-deck {
    height: 160px;
  }
}

@media (max-width: 768px) {
  .nb-header {
    height: 50px;
    padding: 0 4px;
  }
  .nb-logo span:last-child {
    display: none;
  }
  .nb-left-panel {
    width: 105px;
    padding: 4px;
  }
  .nb-right-panel {
    width: 125px;
    padding: 4px;
  }
  .nb-timeline-deck {
    height: 145px;
  }
  .nb-timeline-controls {
    height: 46px;
    padding: 0 6px;
  }
}
