:root {
  --bg: #08090c;
  --panel-strong: rgba(16, 19, 23, 0.92);
  --text: #f2f4f7;
  --muted: #a8b0bf;
  --border: rgba(255, 255, 255, 0.13);
  --radius: 16px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 20% 8%, #182034 0%, #0d1016 28%, #07080b 70%);
  color: var(--text);
}

body {
  padding: 12px;
}

.bg-glow {
  position: fixed;
  width: 32vw;
  height: 32vw;
  filter: blur(70px);
  opacity: 0.2;
  z-index: -2;
  border-radius: 50%;
}

.bg-glow-1 { top: -12vw; left: -6vw; background: #4cd9c4; }
.bg-glow-2 { right: -8vw; bottom: -12vw; background: #5f8cff; }

.glass {
  background: linear-gradient(130deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #6aa8ff, #78f0d5);
  color: #08121b;
  font-weight: 800;
}
.brand { font-size: 1.15rem; font-weight: 700; }
.sub-brand { color: var(--muted); font-size: 0.78rem; }
.topbar-center,
.topbar-actions { display: flex; gap: 10px; }
.topbar-actions { justify-self: end; }

button {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--text);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
}
button:hover { border-color: rgba(120, 240, 213, 0.58); }
button.primary {
  background: linear-gradient(130deg, #65a9ff, #78f0d5);
  color: #0a1317;
  border-color: transparent;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: #dce4f0;
  font-size: 0.8rem;
}
.pill.mini { font-size: 0.74rem; }

.app-shell {
  display: grid;
  grid-template-columns: 320px 12px minmax(0, 1fr) 12px 420px;
  gap: 8px;
  min-height: calc(100vh - 116px);
}

.sidebar,
.board,
.inspector { padding: 12px; }


.panel-handle {
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  cursor: col-resize;
  min-height: 100%;
}

.panel-handle:hover {
  border-color: rgba(120, 240, 213, 0.55);
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tree-block { margin-top: 18px; }
.tree-block h3 {
  color: #d6deea;
  font-size: 0.82rem;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
}

.tree { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tree li {
  border-radius: 10px;
  padding: 10px;
  color: var(--muted);
  border: 1px solid transparent;
}
.tree li.active {
  color: var(--text);
  border-color: rgba(120, 240, 213, 0.46);
  background: rgba(120, 240, 213, 0.09);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 22px;
}
.stats div {
  padding: 10px;
  border-radius: 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.stats strong { display: block; font-size: 1.2rem; }
.stats span { color: var(--muted); font-size: 0.75rem; }


.checklist {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.checklist h3 { margin: 0 0 8px; font-size: 0.82rem; color: #d6deea; }
.checklist ul { margin: 0; padding-left: 16px; color: var(--muted); font-size: 0.78rem; display: grid; gap: 4px; }

.dialogue { margin-top: 12px; }
.dialogue-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.dialogue-item { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.muted-line { color: var(--muted); font-size: 0.8rem; }

.shortcuts {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.shortcuts h3 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: #d6deea;
}
.shortcuts ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 0.78rem;
}
.shortcuts li { margin-bottom: 4px; }
kbd {
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.72rem;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}
.board-header h1 { margin: 0; font-size: 1.35rem; }
.board-header p { margin: 8px 0 0; color: var(--muted); }
.board-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#shot-filter {
  min-width: 190px;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.shot-card {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  min-height: 250px;
}
.shot-card.active {
  border-color: rgba(120, 240, 213, 0.8);
  box-shadow: inset 0 0 0 1px rgba(120, 240, 213, 0.4);
}

.thumb {
  height: 145px;
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--border);
}

.shot-content { padding: 12px; }
.shot-topline { display: flex; justify-content: space-between; color: #d5deeb; font-size: 0.78rem; }
.shot-card h3 { margin: 8px 0 10px; font-size: 1rem; }
.meta-row { color: var(--muted); font-size: 0.82rem; }

.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.meta-badges span {
  font-size: 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 4px 8px;
  color: #d0d9e6;
}

.reorder-row { display: flex; gap: 6px; margin-top: 10px; }
.reorder-btn { flex: 1; font-size: 0.72rem; padding: 6px 8px; }

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 10px 0 14px;
}
.tab { font-size: 0.78rem; padding: 8px; }
.tab.active {
  border-color: rgba(120, 240, 213, 0.6);
  background: rgba(120, 240, 213, 0.12);
}

label { display: block; margin-top: 10px; color: #dce5f3; font-size: 0.82rem; }
textarea,
input {
  width: 100%;
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(7, 10, 13, 0.75);
  color: var(--text);
  padding: 10px;
}
textarea { resize: vertical; }

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.inspector-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}
.mini-status { color: var(--muted); font-size: 0.8rem; margin-top: 8px; }
.comment-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 6px;
}
.comment-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #dce5f3;
  max-height: 180px;
  overflow: auto;
}
.comment-list li { margin-bottom: 6px; }

.statusbar {
  margin-top: 14px;
  padding: 10px 16px;
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 0.82rem;
}


#theme-select {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(7, 10, 13, 0.75);
  color: var(--text);
  padding: 8px 10px;
}

#status-items {
  display: inline-flex;
  gap: 18px;
}

@media (min-width: 2560px) {
  body { padding: 24px; }
  .app-shell { grid-template-columns: 420px minmax(0, 1fr) 560px; gap: 20px; }
  .shot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .shot-card { min-height: 300px; }
  .thumb { height: 180px; }
  .board-header h1 { font-size: 1.8rem; }
  .brand { font-size: 1.4rem; }
}

@media (max-width: 1400px) {
  .app-shell { grid-template-columns: 1fr !important; }
  .panel-handle { display: none; }
  .shot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-fields,
  .inspector-actions { grid-template-columns: 1fr; }
}


@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.animate-in {
  animation: fadeSlideIn 240ms ease both;
}

.context-menu {
  position: fixed;
  z-index: 999;
  min-width: 220px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 12, 16, 0.95);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  display: grid;
  gap: 6px;
}

.context-menu .danger {
  border-color: rgba(255, 120, 120, 0.5);
  color: #ffb0b0;
}

.quick-actions-btn {
  margin-left: auto;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}

.context-menu button {
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.context-menu button kbd {
  opacity: 0.8;
}

.toast-container {
  position: fixed;
  right: 20px;
  bottom: 24px;
  display: grid;
  gap: 8px;
  z-index: 1400;
}

.toast {
  border: 1px solid var(--border);
  background: rgba(8, 12, 18, 0.92);
  padding: 10px 12px;
  border-radius: 10px;
  min-width: 180px;
  color: var(--text);
  transform: translateY(8px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-color: rgba(120, 240, 213, 0.6);
}

.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1200;
}

.pulse-wave {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(120, 240, 213, 0.65);
  transform: translate(-50%, -50%);
  animation: pulseWave 520ms ease-out forwards;
}

.pulse-wave.spark {
  border-color: rgba(110, 168, 255, 0.75);
}

.pulse-wave.burst {
  border-color: rgba(255, 186, 112, 0.78);
}

@keyframes pulseWave {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.55); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(4.8); }
}

.dopamine-hud {
  position: fixed;
  top: 82px;
  right: 18px;
  width: 158px;
  padding: 10px;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px;
  align-items: center;
  z-index: 1000;
}

.dopamine-hud svg {
  width: 64px;
  height: 64px;
}

.dopamine-track,
.dopamine-ring {
  fill: none;
  stroke-width: 8;
  transform: rotate(-90deg);
  transform-origin: 46px 46px;
}

.dopamine-track {
  stroke: rgba(255, 255, 255, 0.1);
}

.dopamine-ring {
  stroke: rgba(120, 240, 213, 0.9);
  transition: stroke-dashoffset 280ms ease;
}

.dopamine-copy {
  display: grid;
  gap: 2px;
  font-size: 0.78rem;
  color: var(--muted);
}

.dopamine-copy strong {
  color: var(--text);
  font-size: 0.82rem;
}

.dopamine-copy span {
  color: #9bf5e0;
  font-weight: 700;
}

.dopamine-hud.boost {
  animation: hudBoost 320ms ease;
}

@keyframes hudBoost {
  0% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-2px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

@media (max-width: 1400px) {
  .dopamine-hud { top: 12px; right: 12px; }
}

body.resizing-panels,
body.resizing-panels * {
  cursor: col-resize !important;
  user-select: none;
}

button {
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0) scale(0.99);
}

button.working {
  position: relative;
  pointer-events: none;
  filter: saturate(0.6);
}

button.working::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 10px;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: spinTiny 500ms linear infinite;
}

@keyframes spinTiny {
  to { transform: rotate(360deg); }
}

.app-busy .statusbar {
  border-color: rgba(120, 240, 213, 0.5);
}

.panel-handle:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(120, 240, 213, 0.85);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

.settings-drawer {
  position: fixed;
  top: 74px;
  right: 14px;
  width: 320px;
  max-width: calc(100vw - 28px);
  padding: 12px;
  z-index: 1600;
  display: grid;
  gap: 8px;
}

.settings-drawer label {
  margin-top: 0;
}

.settings-drawer input[type='range'] {
  margin-top: 8px;
}

.density-compact .shot-card {
  min-height: 214px;
}

.density-compact .thumb {
  height: 122px;
}

.density-compact .shot-content {
  padding: 10px;
}

.effects-reduced .animate-in {
  animation: none !important;
}

.effects-reduced .pulse-wave,
.effects-reduced .dopamine-hud {
  display: none;
}
