:root {
  color-scheme: dark;
  --bg: #040b12;
  --panel: #09121d;
  --panel-strong: #111b2b;
  --panel-border: #142033;
  --panel-border-strong: #1f2b3e;
  --field: #050b11;
  --text: #e5edf8;
  --text-muted: #b8c6de;
  --text-accent: #8fe3ff;
  --accent: #00c3ff;
  --accent-strong: #1f314d;
  --accent-soft: rgba(0, 195, 255, 0.08);
  --danger: #f3c3d3;
  --danger-text: #2b141c;
  --shadow: 0 14px 34px rgba(1, 6, 12, 0.45);
  --splitter-size: 6px;
  --filmstrip-thumb-height: 92px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(0, 195, 255, 0.08), transparent 45%),
    radial-gradient(circle at 80% 10%, rgba(18, 40, 80, 0.35), transparent 48%),
    linear-gradient(135deg, rgba(6, 16, 28, 0.92), rgba(4, 10, 18, 0.98));
  color: var(--text);
  font-family: "Segoe UI", "Segoe UI Variable", "Bahnschrift", sans-serif;
  letter-spacing: 0.1px;
  overflow: hidden;
}

.app-shell {
  min-height: 100vh;
  height: 100vh;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow: hidden;
}

.corner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
  width: 100%;
}

.corner-left,
.corner-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-split,
.flash-view {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.flash-view {
  min-height: 0;
}

.flash-split {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) var(--splitter-size) minmax(320px, 0.8fr);
  gap: 0;
  align-items: stretch;
  min-height: 0;
  height: 100%;
}

.flash-preview {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.flash-preview-actions {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.flash-preview-canvas {
  flex: 1;
  min-height: 0;
}

.flash-filmstrip {
  background: var(--field);
  border: 1px solid #1a2739;
  border-radius: 6px;
  padding: 8px 10px;
  min-height: 110px;
  flex: 0 0 auto;
}

.flash-filmstrip .filmstrip-strip {
  min-height: var(--filmstrip-thumb-height, 92px);
}

.flash-control-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  flex: 1;
  overflow: auto;
}

.flash-load-panel {
  padding: 10px 12px;
}

.flash-load-row {
  width: 100%;
}

.flash-luminosity-btn {
  margin-left: auto;
}

.flash-sliders-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash-sliders-panel .slider-row {
  grid-template-columns: 120px 1fr 52px;
}

.flash-set-all-btn {
  align-self: flex-start;
}

.flash-grid-panel {
  padding: 12px;
  flex: 1;
  display: flex;
  min-height: 0;
}

.flash-grid {
  --flash-grid-gap: 8px;
  flex: 1;
  min-height: 0;
  border-radius: 6px;
  border: 1px solid #1a2739;
  background: var(--field);
  display: block;
  position: relative;
  padding: 6px;
  color: #7d8aa3;
  font-size: 0.85rem;
  overflow: hidden;
}

.flash-grid.is-empty {
  display: grid;
  place-items: center;
}

.flash-grid-placeholder {
  text-align: center;
}

.flash-thumb {
  position: absolute;
  border-radius: 4px;
  border: 1px solid var(--panel-border-strong);
  background: #111b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--text-accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.flash-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.main-split {
  display: grid;
  grid-template-columns: minmax(720px, 1.4fr) var(--splitter-size) minmax(200px, 0.35fr);
  gap: 0;
  align-items: stretch;
  min-height: 0;
  height: 100%;
  align-content: stretch;
}

.left-pane {
  display: grid;
  grid-template-columns: minmax(420px, 2.2fr) var(--splitter-size) minmax(320px, 1fr);
  gap: 0;
  min-height: 0;
  min-width: 0;
  height: 100%;
  align-items: stretch;
  align-content: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  animation: panel-rise 0.65s ease both;
}

.panel[data-active="true"] {
  border-color: var(--accent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none;
}

.preview-stack,
.control-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  min-width: 0;
  height: 100%;
}

.control-stack {
  overflow: auto;
}

.splitter {
  background: transparent;
  cursor: col-resize;
  position: relative;
}

.splitter.horizontal {
  cursor: row-resize;
  height: var(--splitter-size);
  width: 100%;
}

.splitter::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: var(--accent-strong);
  opacity: 0.35;
}

.splitter.horizontal::after {
  top: 50%;
  bottom: auto;
  left: 20%;
  right: 20%;
  width: auto;
  height: 2px;
  transform: translateY(-50%);
}

.splitter:hover::after {
  opacity: 0.7;
}

body.is-resizing {
  cursor: col-resize;
  user-select: none;
}

body.is-resizing-vertical {
  cursor: row-resize;
  user-select: none;
}

.preview-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.preview-canvas {
  flex: 1;
  position: relative;
  border-radius: 6px;
  border: 1px solid #555;
  background:
    linear-gradient(120deg, rgba(15, 30, 48, 0.8), rgba(5, 7, 10, 0.95)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02) 10px, transparent 10px, transparent 20px);
  overflow: hidden;
}

.preview-canvas img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.preview-canvas .preview-source-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.preview-canvas.show-source .preview-source-image {
  opacity: 1;
}

.preview-canvas.show-source #preview-image {
  opacity: 0;
}

.preview-canvas.show-source .preview-blend-canvas {
  display: none;
}

.preview-blend-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: none;
  z-index: 2;
  pointer-events: none;
}

.preview-blend-canvas.is-active {
  display: block;
}

.preview-canvas[data-empty="true"] img {
  opacity: 0;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  color: #c1c9d6;
  font-size: 0.95rem;
  z-index: 3;
}

.preview-canvas[data-empty="false"] .preview-placeholder {
  display: none;
}

.preview-title {
  font-weight: 600;
}

.preview-subtitle {
  font-size: 0.8rem;
  color: #92a2bd;
}

.preview-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #f0f0f0;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.center-toast {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 10, 16, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 120;
}

.center-toast.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.center-toast-card {
  background: rgba(10, 16, 26, 0.95);
  border: 1px solid #233247;
  border-radius: 10px;
  padding: 18px 22px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  text-align: center;
  max-width: 360px;
}

.center-toast-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.center-toast-message {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.center-toast-card .subscribe-btn {
  margin-top: 12px;
  background: var(--accent);
  color: #081018;
  border-color: var(--accent);
  font-weight: 700;
}

.center-toast-card .subscribe-btn:hover {
  background: #2dd0ff;
}

.filmstrip-panel {
  padding: 10px 12px;
  min-height: 0;
  flex: 0 0 auto;
}

.filmstrip-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  align-items: flex-start;
}

.filmstrip-empty {
  color: #7d8aa3;
  font-size: 0.8rem;
  padding: 8px;
}

.filmstrip-thumb {
  flex: 0 0 auto;
  height: auto;
  width: auto;
  border-radius: 4px;
  border: 1px solid var(--panel-border-strong);
  background: linear-gradient(160deg, #111b2b 20%, #0c1119 85%);
  color: #d5dff0;
  font-size: 0.7rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filmstrip-thumb:hover {
  background: #18253a;
}

.filmstrip-thumb.active {
  border: 2px solid var(--accent);
}

.filmstrip-thumb.selected {
  outline: 2px solid rgba(143, 227, 255, 0.7);
  outline-offset: 2px;
}

.filmstrip-thumb.tiff {
  display: flex;
  color: var(--text-accent);
  font-weight: 700;
  letter-spacing: 0.6px;
}

.filmstrip-thumb img {
  height: auto;
  width: auto;
  max-height: var(--filmstrip-thumb-height, 92px);
  display: block;
}

.top-controls {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-row {
  justify-content: flex-start;
}

.brush-row input[type="range"] {
  flex: 1;
}

.tile-status {
  color: var(--text-accent);
  font-weight: 600;
  margin-top: 2px;
}

.tile-grid {
  position: relative;
  border-radius: 6px;
  border: 1px solid #1a2739;
  background-color: var(--field);
  overflow: hidden;
  animation: panel-rise 0.65s ease both;
  flex: 1;
  min-height: 0;
}

.tile-grid canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.tile-grid-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  color: #7d8aa3;
  font-size: 0.85rem;
  background: rgba(5, 11, 17, 0.65);
  pointer-events: none;
}

.tile-grid.has-image .tile-grid-empty {
  display: none;
}

.tile-selection {
  position: absolute;
  width: calc(100% / var(--grid-cells));
  height: calc(100% / var(--grid-cells));
  left: calc(var(--x) * (100% / var(--grid-cells)));
  top: calc(var(--y) * (100% / var(--grid-cells)));
  background: rgba(0, 195, 255, 0.35);
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px rgba(0, 195, 255, 0.25);
  animation: pulse 1.6s ease-in-out infinite;
}

.tile-selection.faded {
  background: rgba(0, 195, 255, 0.15);
  border-color: rgba(0, 195, 255, 0.6);
  animation: none;
}

.slider-row {
  display: grid;
  grid-template-columns: 110px 1fr 50px;
  align-items: center;
  gap: 8px;
}

.slider-row.small-label {
  grid-template-columns: 60px 1fr 50px;
}

.slider-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.slider-value {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-accent);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: #171f30;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -5px;
  box-shadow: 0 0 0 1px rgba(0, 195, 255, 0.4);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: #171f30;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 195, 255, 0.4);
}

input[type="range"]:disabled::-webkit-slider-thumb,
input[type="range"]:disabled::-moz-range-thumb {
  background: #2a3a4e;
  box-shadow: none;
}

.btn {
  background: var(--panel-strong);
  border: 1px solid var(--panel-border-strong);
  color: var(--text);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border 0.2s ease;
}

.btn:hover {
  background: #18253a;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.is-preparing {
  animation: preparing-blink 0.9s steps(2, start) infinite;
}

.btn.toggle[aria-pressed="true"] {
  background: var(--accent);
  color: #081018;
  border-color: var(--accent);
  font-weight: 700;
}

@keyframes preparing-blink {
  50% {
    opacity: 0.35;
  }
}

.btn.mini {
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.btn.muted {
  background: var(--danger);
  color: var(--danger-text);
  border: 2px solid #f8dbe4;
  font-weight: 700;
}

.btn.danger {
  background: var(--danger);
  border-color: #f8dbe4;
  color: var(--danger-text);
  cursor: pointer;
  font-weight: 700;
}

.btn.danger:hover {
  background: #f5b9cd;
  border-color: #fde8ee;
}

.btn.danger:disabled {
  background: #141b26;
  border-color: #2c3b52;
  color: #6f7d95;
  cursor: not-allowed;
}

.wb-rgb {
  padding: 8px 10px;
}

.wb-rgb-row {
  display: flex;
  gap: 16px;
  font-size: 0.85rem;
}

.wb-info {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.process-group {
  padding: 8px 10px 10px;
  border-radius: 6px;
  background: rgba(5, 11, 17, 0.5);
  border: 1px solid rgba(20, 32, 51, 0.6);
  animation: panel-rise 0.65s ease both;
}

.process-group.is-flash-disabled .process-header,
.process-group.is-flash-disabled .bi-slider {
  color: #6b7382;
}

.process-group.is-flash-disabled .group-title,
.process-group.is-flash-disabled .bi-title,
.process-group.is-flash-disabled .bi-row,
.process-group.is-flash-disabled .bi-label {
  color: #6b7382;
}

.process-group.is-flash-disabled .status-dot {
  border-color: rgba(120, 128, 140, 0.6);
  background: rgba(120, 128, 140, 0.25);
  box-shadow: none;
}

.process-group.is-flash-disabled .process-indicator {
  border-color: rgba(120, 128, 140, 0.6);
  background: rgba(120, 128, 140, 0.35);
  box-shadow: none;
}

.process-group.is-flash-disabled .bi-slider input[type="range"] {
  opacity: 0.45;
}

.process-group.is-flash-disabled .bi-slider input[type="range"]::-webkit-slider-runnable-track,
.process-group.is-flash-disabled .bi-slider input[type="range"]::-moz-range-track {
  background: #141b28;
}

.process-group.is-flash-disabled .bi-slider input[type="range"]:disabled::-webkit-slider-thumb,
.process-group.is-flash-disabled .bi-slider input[type="range"]:disabled::-moz-range-thumb {
  background: #1b2330;
}

.process-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.process-indicator {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 1px solid rgba(220, 90, 90, 0.9);
  background: rgba(220, 90, 90, 0.75);
  box-shadow: 0 0 8px rgba(220, 90, 90, 0.5);
}

.process-indicator.is-ready {
  border-color: rgba(70, 210, 130, 0.9);
  background: rgba(70, 210, 130, 0.85);
  box-shadow: 0 0 10px rgba(70, 210, 130, 0.5);
}

.group-title {
  font-size: 0.85rem;
  color: var(--text-accent);
}

.bi-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.bi-slider:last-child {
  margin-bottom: 0;
}

.bi-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(0, 195, 255, 0.6);
  background: rgba(0, 195, 255, 0.25);
}

.status-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(0, 195, 255, 0.5);
}

.bi-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.layering-section {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layering-title {
  font-size: 0.8rem;
  color: var(--text-accent);
}

.layer-stack {
  display: grid;
  gap: 6px;
}

.layer-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(9, 18, 29, 0.7);
  border: 1px solid rgba(20, 32, 51, 0.8);
  font-size: 0.8rem;
  cursor: grab;
}

.layer-tile:active {
  cursor: grabbing;
}

.layer-tile.is-dragging {
  opacity: 0.55;
}

.layer-tile.is-drop-target {
  border-color: rgba(0, 195, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(0, 195, 255, 0.5) inset;
}

.layer-name {
  font-weight: 600;
  color: var(--text);
}

.layer-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.layer-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(200px, 3fr);
  align-items: center;
  gap: 8px;
}

.layer-opacity {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.layer-opacity .slider-value {
  min-width: 42px;
  text-align: right;
}

.panel-title {
  font-weight: 600;
  color: var(--text-accent);
  margin-bottom: 6px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.right-pane {
  min-width: 200px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.mask-panel {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.select {
  background: var(--panel-strong);
  border: 1px solid var(--panel-border-strong);
  color: var(--text);
  border-radius: 4px;
  padding: 6px;
}

.color-box {
  display: grid;
  gap: 6px;
}

.color-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: center;
  gap: 8px;
}

.color-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.color-input {
  background: var(--field);
  border: 1px solid #1a2739;
  border-radius: 4px;
  color: var(--text);
  padding: 6px 8px;
  font-size: 0.85rem;
}

.color-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.mask-list {
  background: var(--field);
  border: 1px solid #1a2739;
  border-radius: 4px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 220px;
  overflow-y: auto;
  flex: 1;
}

.swatch-item {
  border: 1px solid var(--panel-border-strong);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: transparent;
  animation: list-rise 0.5s ease both;
}

.swatch-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.swatch-item.locked {
  opacity: 0.75;
}

.swatch-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.swatch-bottom {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.color-chip {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--panel-border-strong);
  background: var(--chip-color, #05070a);
  color: var(--text-accent);
  font-weight: 700;
  font-size: 0.65rem;
  display: grid;
  place-items: center;
}

.swatch-name {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
}

.swatch-name:focus {
  outline: 1px solid var(--accent);
}

.mode-toggle {
  min-width: 44px;
  font-weight: 700;
}

.mode-toggle[aria-pressed="true"] {
  background: var(--accent);
  color: #081018;
  border-color: var(--accent);
}

.triangle-toggle {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid #2c3b52;
  background: #111b2b;
  position: relative;
  cursor: pointer;
}

.triangle-toggle::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 6px;
  width: 12px;
  height: 10px;
  background: #2c3b52;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.triangle-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
}

.triangle-toggle[aria-pressed="true"]::before {
  background: #081018;
}

.swatch-placeholder {
  color: #7d8aa3;
  font-size: 0.8rem;
  text-align: center;
  padding: 8px 0;
}

.export-row {
  display: flex;
  gap: 8px;
}

.control-stack > *:nth-child(1) {
  animation-delay: 0.05s;
}

.control-stack > *:nth-child(2) {
  animation-delay: 0.1s;
}

.control-stack > *:nth-child(3) {
  animation-delay: 0.15s;
}

.control-stack > *:nth-child(4) {
  animation-delay: 0.2s;
}

.control-stack > *:nth-child(5) {
  animation-delay: 0.25s;
}

.control-stack > *:nth-child(6) {
  animation-delay: 0.3s;
}

.control-stack > *:nth-child(7) {
  animation-delay: 0.35s;
}

.mask-list .swatch-item:nth-child(1) {
  animation-delay: 0.1s;
}

.mask-list .swatch-item:nth-child(2) {
  animation-delay: 0.18s;
}

.mask-list .swatch-item:nth-child(3) {
  animation-delay: 0.26s;
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes list-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(0, 195, 255, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 195, 255, 0.5);
  }
}

@media (max-width: 1500px) {
  .main-split {
    grid-template-columns: minmax(640px, 1fr) var(--splitter-size) minmax(200px, 320px);
    grid-auto-flow: row;
  }
}

@media (max-width: 1200px) {
  .main-split {
    grid-template-columns: 1fr;
  }

  .flash-split {
    grid-template-columns: 1fr;
  }

  .left-pane {
    grid-template-columns: 1fr;
  }

  .right-pane {
    min-width: 0;
  }

  .splitter {
    display: none;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .preview-panel {
    min-height: 0;
  }

  .flash-preview-canvas {
    min-height: 0;
  }

  .slider-row,
  .slider-row.small-label {
    grid-template-columns: 70px 1fr 40px;
  }
}

body.projects-body {
  overflow: auto;
}

.projects-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

.projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.projects-title {
  font-size: 1.6rem;
  font-weight: 600;
}

.projects-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.projects-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.projects-actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.projects-sort-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.download-quota {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.download-count {
  color: var(--text);
  font-weight: 600;
}

.text-input {
  background: var(--field);
  border: 1px solid var(--panel-border);
  color: var(--text);
  border-radius: 4px;
  padding: 8px 12px;
  min-width: 220px;
  font-size: 0.9rem;
}

.text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 195, 255, 0.3);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.project-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.project-name {
  font-weight: 600;
  font-size: 1rem;
}

.project-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

.project-actions .btn {
  width: 100%;
  text-align: center;
  padding: 4px 10px;
  font-size: 0.75rem;
}

.projects-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 18px;
  border: 1px dashed var(--panel-border-strong);
  border-radius: 6px;
  text-align: center;
}

.projects-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 18px;
}

.projects-status.is-error {
  color: var(--danger);
}

.logout-form {
  margin: 0;
  display: inline-flex;
}

body.account-body {
  overflow: auto;
}

body.auth-body {
  overflow: auto;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 92vw);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-title {
  font-size: 1.7rem;
  font-weight: 600;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.auth-error {
  color: var(--danger);
  font-size: 0.85rem;
}

.auth-message {
  color: var(--text-accent);
  font-size: 0.85rem;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.85rem;
}

.auth-link {
  color: var(--text-accent);
  text-decoration: none;
}

.auth-link:hover {
  text-decoration: underline;
}

.auth-helper {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.auth-link-box {
  background: var(--field);
  border: 1px solid var(--panel-border-strong);
  border-radius: 4px;
  padding: 8px 10px;
  word-break: break-all;
}

.account-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100vh;
}

.account-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  align-items: center;
}

.account-label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.account-value {
  font-size: 0.95rem;
}

.account-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.account-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 18px;
}

.account-status.is-error {
  color: var(--danger);
}

@media (max-width: 720px) {
  .projects-shell {
    padding: 16px;
  }

  .projects-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .projects-actions {
    width: 100%;
  }

  .text-input {
    flex: 1;
    min-width: 0;
  }

  .account-shell {
    padding: 16px;
  }

  .account-row {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .project-actions {
    grid-template-columns: 1fr;
  }
}
