/* ============ Anima — 3D Creation Suite ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #1f1f1f;
  --panel: #2d2d2d;
  --panel-2: #333333;
  --header: #3d3d3d;
  --border: #111111;
  --text: #d9d9d9;
  --text-dim: #8a8a8a;
  --accent: #ff8c1a;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Inter", Roboto, Arial, sans-serif;
  font-size: 13px;
  -webkit-user-select: none;
  user-select: none;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ============ Top bar ============ */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 34px;
  padding: 0 10px;
  background: var(--header);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 7px; }
.brand-name { font-weight: 600; letter-spacing: 0.3px; }
.menu { display: flex; gap: 12px; color: var(--text-dim); }
.menu span:hover { color: var(--text); }
.workspaces { display: flex; gap: 4px; margin-left: 10px; }
.ws {
  padding: 5px 10px;
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
}
.ws.active { background: var(--accent); color: #1a1a1a; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; gap: 6px; }
.chip {
  padding: 3px 9px;
  background: var(--panel-2);
  border: 1px solid #484848;
  border-radius: 3px;
  font-size: 12px;
  color: var(--text);
}

/* ============ Main ============ */
.main { display: flex; flex: 1; min-height: 0; }

/* Tool rail */
.toolbar {
  width: 42px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
  gap: 6px;
  flex-shrink: 0;
}
.toolbar svg {
  width: 22px; height: 22px;
  padding: 3px;
  border-radius: 3px;
  cursor: pointer;
}
.toolbar svg:hover { background: #3a3a3a; }

/* Viewport */
.viewport-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  background: #282828;
  overflow: hidden;
}
.viewport-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  background: rgba(35, 35, 35, 0.92);
  border-bottom: 1px solid var(--border);
  z-index: 5;
  font-size: 12px;
}
.vh-item { color: var(--text-dim); cursor: pointer; }
.vh-item:hover { color: var(--text); }
.vh-spacer { flex: 1; }

#viewport-canvas {
  position: absolute;
  top: 26px; left: 0; right: 0; bottom: 0;
  width: 100%;
  cursor: grab;
}

.gizmo {
  position: absolute;
  top: 36px; right: 14px;
  display: flex;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  z-index: 5;
  pointer-events: none;
}
.gx { color: #e55b5b; }
.gy { color: #7fd87f; }
.gz { color: #6b9bff; }

.outline-label {
  position: absolute;
  left: 12px; bottom: 12px;
  padding: 4px 9px;
  background: rgba(30, 30, 30, 0.85);
  border: 1px solid #4a4a4a;
  border-radius: 3px;
  font-size: 12px;
  z-index: 5;
  color: var(--text-dim);
}
.ol-cube { color: var(--accent); }
.grid-hint {
  position: absolute;
  right: 12px; bottom: 12px;
  font-size: 11px;
  color: #5f5f5f;
  z-index: 5;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 8px;
  overflow-y: auto;
  flex-shrink: 0;
}
.panel {
  background: var(--panel-2);
  border: 1px solid #3e3e3e;
  border-radius: 4px;
  margin-bottom: 8px;
  padding: 6px 8px;
}
.panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.row { display: flex; align-items: center; margin-bottom: 5px; }
.row-label { width: 60px; color: var(--text-dim); font-size: 12px; }
.inputs { display: flex; gap: 3px; flex: 1; }
.inputs input {
  flex: 1;
  width: 100%;
  background: #232323;
  border: 1px solid #4a4a4a;
  border-radius: 3px;
  color: var(--text);
  padding: 3px 5px;
  font-size: 12px;
}
.tree { font-size: 12px; }
.tree-row { padding: 3px 2px; display: flex; align-items: center; gap: 5px; }
.tree-child { margin-left: 14px; color: var(--text-dim); }

/* ============ Timeline ============ */
.timeline {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 0 10px;
  flex-shrink: 0;
}
.transport { display: flex; gap: 4px; font-size: 13px; color: var(--text-dim); }
.transport span { cursor: pointer; padding: 2px 4px; }
.transport .play { color: var(--accent); }
.ruler {
  position: relative;
  flex: 1;
  height: 26px;
  background: #262626;
  border: 1px solid #3e3e3e;
  border-radius: 3px;
  overflow: hidden;
}
.ruler-nums {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  height: 100%;
  padding: 0 6px 3px;
  color: #6f6f6f;
  font-size: 10px;
}
.playhead {
  position: absolute;
  top: 0; left: 2%;
  width: 1px; height: 100%;
  background: var(--accent);
}
.frame-info { font-size: 12px; color: var(--text-dim); white-space: nowrap; }

/* ============ Status bar ============ */
.statusbar {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 26px;
  background: var(--header);
  border-top: 1px solid var(--border);
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.sb-right { margin-left: auto; }

/* ============ Splash ============ */
#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 18, 18, 0.82);
  backdrop-filter: blur(3px);
  cursor: default;
}
#splash.hidden { display: none; }
.splash-card {
  width: 420px;
  max-width: 92vw;
  background: #2b2b2b;
  border: 1px solid #454545;
  border-radius: 12px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
  padding: 34px 36px 26px;
  text-align: center;
}
.splash-logo { margin-bottom: 14px; }
.splash-card h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.splash-sub { color: var(--accent); font-weight: 600; margin: 4px 0 12px; font-size: 14px; }
.splash-tag { color: var(--text-dim); font-size: 13px; line-height: 1.5; margin-bottom: 22px; }
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #1a1a1a;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  padding: 11px 42px;
  cursor: pointer;
  letter-spacing: 0.3px;
}
.btn-primary:hover { background: #ff9a35; }
.splash-links {
  margin-top: 18px;
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
}
.splash-links a { color: #9db8ff; text-decoration: none; }
.splash-links a:hover { text-decoration: underline; }
.splash-foot { margin-top: 14px; font-size: 11px; color: #6a6a6a; }

/* ============ Render layer (the surprise) ============ */
.render-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  background: #000;
  overflow: hidden;
}
.render-layer.shown { display: block; }
#render-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
#render-video::-webkit-media-controls-enclosure { display: none !important; }
#render-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
#render-still.shown { display: block; }

/* Shake + flicker while it's happening */
@keyframes shake {
  0%   { transform: translate(0, 0) scale(1); }
  10%  { transform: translate(-16px, 10px) scale(1.05); }
  20%  { transform: translate(14px, -12px) scale(1.08); }
  30%  { transform: translate(-12px, -8px) scale(1.03); }
  40%  { transform: translate(16px, 12px) scale(1.09); }
  50%  { transform: translate(-14px, 8px) scale(1.04); }
  60%  { transform: translate(12px, -14px) scale(1.1); }
  70%  { transform: translate(-10px, 10px) scale(1.06); }
  80%  { transform: translate(14px, 6px) scale(1.02); }
  90%  { transform: translate(-16px, -10px) scale(1.07); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes flicker {
  0%, 100% { opacity: 1; }
  8%  { opacity: 0.82; }
  16% { opacity: 1; }
  27% { opacity: 0.9; }
  41% { opacity: 1; }
  55% { opacity: 0.85; }
  72% { opacity: 1; }
  86% { opacity: 0.92; }
}
/* red pulse vignette */
@keyframes redpulse {
  0%, 100% { box-shadow: inset 0 0 0 rgba(255, 0, 0, 0); }
  50% { box-shadow: inset 0 0 180px rgba(255, 0, 0, 0.55); }
}
body.scared .render-layer.shown {
  animation: shake 0.16s linear infinite, flicker 0.22s linear infinite, redpulse 0.4s ease-in-out infinite;
}
