/* RingoCut v0.16.0-dp · espacio de trabajo táctil y timeline protagonista.
   Esta hoja concentra únicamente la composición, navegación e interacción del editor. */

:root {
  --topbar-h: 64px;
  --timeline-h: clamp(220px, 29vh, 300px);
  --panel-w: clamp(300px, 28vw, 390px);
  --workspace-gap: 8px;
  --workspace-radius: 16px;
  --touch-target: 44px;
}

.app-shell,
.app-shell[data-panel="tool-editor"] {
  width: 100vw !important;
  height: 100dvh !important;
  min-height: 100dvh !important;
  padding: calc(6px + var(--safe-top)) calc(6px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(6px + var(--safe-left)) !important;
  display: grid !important;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--resizer-size, 8px) var(--timeline-h) !important;
  gap: var(--workspace-gap) !important;
  overflow: hidden !important;
}

.app-shell[data-panel="tool-editor"] .topbar,
.app-shell[data-panel="tool-editor"] .timeline-zone,
.app-shell[data-panel="tool-editor"] .viewer-head {
  display: grid !important;
}

.app-shell[data-panel="tool-editor"] #timelineHeightHandle,
.app-shell[data-panel="tool-editor"] #panelWidthHandle {
  display: block !important;
}

.topbar {
  height: 100% !important;
  min-height: var(--topbar-h) !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 6px 8px !important;
  border-radius: var(--workspace-radius) !important;
  background: rgba(8, 13, 22, 0.96) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.28) !important;
}

.topbar-leading,
.topbar-identity,
.topbar-commands,
.workspace-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbar-leading { gap: 8px; }
.topbar-identity { gap: 8px; }
.topbar-identity .brand-icon { width: 34px !important; height: 34px !important; border-radius: 9px !important; }
.topbar-identity .brand-copy strong { font-size: 0.98rem; }
.topbar-identity .brand-copy span { font-size: 0.68rem; }

.main-menu { position: relative; }
.main-menu-button {
  width: var(--touch-target) !important;
  min-width: var(--touch-target) !important;
  height: var(--touch-target) !important;
  min-height: var(--touch-target) !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 11px !important;
}
.main-menu-button strong { display: none; }
.menu-panel {
  top: calc(100% + 8px) !important;
  left: 0 !important;
  width: min(330px, calc(100vw - 24px)) !important;
  max-height: min(72dvh, 620px) !important;
  padding: 12px !important;
  border-radius: 16px !important;
  background: rgba(8, 13, 22, 0.98) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5) !important;
}

.workspace-toolbar {
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.workspace-toolbar::-webkit-scrollbar { display: none; }

.workspace-tool,
.command-button,
.export-shortcut {
  flex: 0 0 auto;
  min-height: var(--touch-target);
  border-radius: 11px;
}

.workspace-tool {
  min-width: 66px;
  padding: 4px 9px;
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  gap: 1px;
  border-color: transparent;
  background: transparent;
}
.workspace-tool span { font-size: 1.04rem; line-height: 1; }
.workspace-tool strong { font-size: 0.68rem; line-height: 1; }
.workspace-tool.is-active,
.workspace-tool[aria-pressed="true"] {
  color: #f4fffc;
  border-color: rgba(110, 231, 200, 0.42);
  background: rgba(110, 231, 200, 0.13);
}

.topbar-commands { justify-content: flex-end; gap: 5px; }
.command-button { width: var(--touch-target); min-width: var(--touch-target); padding: 0; font-size: 1.25rem; }
.export-shortcut { padding: 0 13px; font-weight: 800; color: #effffb; background: rgba(110, 231, 200, 0.14); border-color: rgba(110, 231, 200, 0.42); }
.export-shortcut span { margin-right: 5px; }

.workspace,
.app-shell[data-panel="tool-editor"] .workspace {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) var(--resizer-size, 8px) var(--panel-w) !important;
  grid-template-rows: minmax(0, 1fr) !important;
  gap: var(--workspace-gap) !important;
  overflow: hidden !important;
}

.viewer-zone,
.app-shell[data-panel="tool-editor"] .viewer-zone {
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 8px !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 6px !important;
  border-radius: var(--workspace-radius) !important;
  overflow: hidden !important;
  background: rgba(8, 13, 22, 0.94) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.3) !important;
}

.viewer-head,
.app-shell[data-panel="tool-editor"] .viewer-head {
  min-height: 34px;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}
.viewer-head .eyebrow { display: none; }
.viewer-head h1 { max-width: min(64vw, 720px); font-size: 0.94rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-badges span { padding: 5px 9px; color: var(--accent); background: rgba(110, 231, 200, 0.08); }

.viewer-frame,
.app-shell[data-panel="tool-editor"] .viewer-frame {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  border-radius: 12px !important;
  border-color: rgba(183, 198, 226, 0.18) !important;
  background: #020408 !important;
  touch-action: none;
}

.context-panel,
.app-shell[data-panel="tool-editor"] .context-panel {
  grid-column: 3 !important;
  grid-row: 1 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: 100% !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  border-radius: var(--workspace-radius) !important;
  border-color: rgba(183, 198, 226, 0.18) !important;
  background: rgba(8, 13, 22, 0.96) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.3) !important;
}

.context-panel::before { display: none !important; content: none !important; }
.inspector-titlebar {
  flex: 0 0 auto;
  min-height: 50px;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}
.inspector-titlebar div { min-width: 0; display: grid; gap: 1px; }
.inspector-titlebar span { color: var(--muted); font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; }
.inspector-titlebar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.inspector-more-button { min-height: 38px; padding: 0 11px; border-radius: 10px; font-size: 0.76rem; font-weight: 800; color: var(--accent); }

.context-panel > .panel-card,
.app-shell[data-panel="tool-editor"] .context-panel > .panel-card {
  display: none !important;
  flex: 1 1 auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 12px !important;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
}
.context-panel > .panel-card.is-visible,
.app-shell[data-panel="tool-editor"] .context-panel > .tool-editor-panel.is-visible {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

.app-shell[data-panel="tool-editor"] .tool-editor-shell {
  height: auto !important;
  min-height: 100% !important;
  display: block !important;
  overflow: visible !important;
}
.app-shell[data-panel="tool-editor"] .tool-editor-head {
  position: static !important;
  padding: 0 0 10px !important;
  margin: 0 0 10px !important;
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  gap: 8px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  border-radius: 0 !important;
  background: transparent !important;
}
.app-shell[data-panel="tool-editor"] .tool-editor-back {
  width: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}
.app-shell[data-panel="tool-editor"] .tool-editor-back strong { display: none; }
.app-shell[data-panel="tool-editor"] .tool-editor-floating-back { display: none !important; }
.app-shell[data-panel="tool-editor"] #objectEditor.is-dedicated,
.app-shell[data-panel="tool-editor"] #objectEditor.is-dedicated.is-visible {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  padding: 0 0 30px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 8px !important;
  overflow: visible !important;
}
.app-shell[data-panel="tool-editor"] .tool-editor-section { padding: 10px !important; border-radius: 12px !important; }

.app-shell[data-inspector-mode="quick"] #objectLayersSection,
.app-shell[data-inspector-mode="quick"] #toolEditorTimingControls,
.app-shell[data-inspector-mode="quick"] .keyframe-editor,
.app-shell[data-inspector-mode="quick"] #objectEditor > .editor-actions {
  display: none !important;
}
.app-shell[data-inspector-mode="quick"] .tool-editor-summary { padding: 8px 10px !important; }
.app-shell[data-inspector-mode="quick"] .tool-editor-summary h3 { display: none; }
.app-shell[data-inspector-mode="quick"] .tool-editor-head #toolEditorSubtitle { display: none; }

.timeline-zone,
.app-shell[data-panel="tool-editor"] .timeline-zone {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 7px 8px 8px !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 6px !important;
  overflow: hidden !important;
  border-radius: var(--workspace-radius) !important;
  background: rgba(8, 13, 22, 0.97) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.3) !important;
}

.timeline-header,
.app-shell[data-panel="tool-editor"] .timeline-header {
  min-height: 48px;
  display: grid !important;
  grid-template-columns: minmax(110px, auto) minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
}
.timeline-heading .eyebrow { display: none; }
.timeline-heading h2 { font-size: 0.9rem !important; white-space: nowrap; }
.timeline-command-bar { min-width: 0; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.transport,
.app-shell[data-panel="tool-editor"] .transport {
  position: static !important;
  left: auto !important;
  bottom: auto !important;
  z-index: auto !important;
  transform: none !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: var(--touch-target) !important;
  padding: 0 !important;
  display: flex !important;
  flex: 1 1 auto;
  justify-content: center;
  gap: 4px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 1 !important;
}
.transport-button,
.app-shell[data-panel="tool-editor"] .transport-button {
  min-width: var(--touch-target) !important;
  width: var(--touch-target) !important;
  height: var(--touch-target) !important;
  min-height: var(--touch-target) !important;
  padding: 0 !important;
  border-radius: 10px !important;
}
.transport-button.primary { color: #04100d; background: var(--accent); border-color: var(--accent); }
.step-button { font-size: 0.74rem !important; }
.timecode,
.app-shell[data-panel="tool-editor"] .timecode { margin: 0 4px !important; min-width: 132px !important; font-size: 0.74rem !important; text-align: center; }
.timeline-controls { flex: 0 0 auto; flex-wrap: nowrap !important; }
.timeline-button { min-width: 38px; min-height: 38px; border-radius: 9px; }
.timeline-meta { min-height: 38px; padding: 0 9px; border-radius: 9px; }

.timeline-scroll { border-top: 1px solid rgba(183, 198, 226, 0.1); padding-top: 4px; }
.timeline-content { touch-action: none; user-select: none; }
.timeline-ruler {
  cursor: ew-resize;
  touch-action: none;
  border-radius: 8px;
}
.timeline-ruler:focus-visible,
.playhead:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.track { min-height: 34px; grid-template-columns: 72px minmax(0, 1fr) !important; gap: 6px; }
.track strong { font-size: 0.74rem; }
.track-lane { min-height: 34px; border-radius: 8px; cursor: ew-resize; touch-action: none; }
.timeline-scrubber { pointer-events: none; z-index: 0; }
.track-lane > span { pointer-events: none; }

.clip-block {
  min-height: 0;
  padding: 0;
  cursor: pointer;
  touch-action: none;
}
.clip-block:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.video-lane.is-selected .clip-block,
.video-lane:focus-within .clip-block { border-color: #fff; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.38); }

.playhead {
  width: 3px;
  pointer-events: auto !important;
  cursor: ew-resize;
  touch-action: none;
}
.playhead::after {
  content: "";
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: 50%;
  width: 30px;
  transform: translateX(-50%);
}
.playhead span { width: 15px; height: 15px; top: -8px; }
.timeline-content.is-scrubbing .playhead { box-shadow: 0 0 0 4px rgba(110, 231, 200, 0.15), 0 0 20px rgba(110, 231, 200, 0.8); }

.canvas-transform-frame {
  border: 2px solid rgba(110, 231, 200, 0.94) !important;
  outline: 1px solid rgba(3, 7, 18, 0.72) !important;
  outline-offset: 2px !important;
  border-radius: 6px !important;
  background: transparent !important;
  pointer-events: auto !important;
}
.canvas-transform-frame .resize-handle {
  width: 30px !important;
  height: 30px !important;
  right: -15px !important;
  bottom: -15px !important;
  border: 3px solid #03100d !important;
  border-radius: 50% !important;
  background: var(--accent) !important;
  pointer-events: auto !important;
}

@media (max-width: 1180px), (max-height: 720px) {
  :root { --topbar-h: 58px; --timeline-h: clamp(200px, 28vh, 250px); --panel-w: clamp(286px, 30vw, 350px); }
  .topbar-identity .brand-copy { display: none; }
  .workspace-tool { min-width: 58px; padding-inline: 7px; }
  .timeline-heading { display: none; }
  .timeline-header { grid-template-columns: minmax(0, 1fr) !important; }
  .timeline-command-bar { justify-content: space-between; }
  .timecode { min-width: 116px !important; }
}

@media (max-width: 900px) {
  :root { --panel-w: clamp(270px, 36vw, 320px); }
  .export-shortcut strong { display: none; }
  .export-shortcut { width: var(--touch-target); padding: 0; }
  .workspace-tool strong { font-size: 0.64rem; }
  .timeline-controls #zoomLabel { display: none; }
}

@media (max-width: 700px) {
  :root { --topbar-h: 56px; --timeline-h: 210px; }
  .app-shell,
  .app-shell[data-panel="tool-editor"] { grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--resizer-size, 8px) var(--timeline-h) !important; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto !important; }
  .topbar-identity { display: none; }
  .workspace,
  .app-shell[data-panel="tool-editor"] .workspace { grid-template-columns: minmax(0, 1fr) !important; }
  #panelWidthHandle { display: none !important; }
  .context-panel,
  .app-shell[data-panel="tool-editor"] .context-panel {
    position: fixed !important;
    z-index: 130 !important;
    right: calc(6px + var(--safe-right)) !important;
    top: calc(var(--topbar-h) + 14px + var(--safe-top)) !important;
    bottom: calc(var(--timeline-h) + 14px + var(--safe-bottom)) !important;
    width: min(88vw, 360px) !important;
    height: auto !important;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62) !important;
  }
  .app-shell[data-panel="project"] .context-panel { display: none !important; }
  .viewer-zone,
  .app-shell[data-panel="tool-editor"] .viewer-zone { grid-column: 1 !important; }
  .workspace-tool { min-width: 54px; }
  .timeline-command-bar { gap: 4px; }
  .timeline-controls { display: none; }
  .transport { justify-content: space-between; }
  .timecode { min-width: 108px !important; font-size: 0.68rem !important; }
  .track { grid-template-columns: 58px minmax(0, 1fr); }
  .timeline-ruler { padding-left: 64px !important; }
}

@media (pointer: coarse) {
  button,
  .track-lane,
  .timeline-ruler { -webkit-tap-highlight-color: transparent; }
  .resize-handle { min-width: 30px; min-height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .workspace-tool,
  .command-button,
  .transport-button,
  .playhead { transition: none !important; }
}
