/* imagine — rain-glass aesthetic */
:root {
  --bg-0: #05080d;
  --bg-1: #0a1420;
  --bg-2: #122336;
  --ink: oklch(0.96 0.01 230);
  --ink-dim: oklch(0.78 0.02 230);
  --ink-faint: oklch(0.55 0.02 230);
  --glass: rgba(20, 36, 56, 0.32);
  --glass-strong: rgba(22, 40, 64, 0.55);
  --glass-border: rgba(180, 215, 255, 0.18);
  --glass-border-bright: rgba(200, 230, 255, 0.32);
  --glass-hi: rgba(255, 255, 255, 0.08);
  --accent: oklch(0.78 0.10 220);
  --danger: oklch(0.72 0.13 25);
  --radius: 18px;
  --radius-sm: 10px;
  --shadow-glass: 0 30px 60px -20px rgba(0, 0, 0, 0.6),
                  0 8px 24px -8px rgba(0, 0, 0, 0.4),
                  inset 0 1px 0 0 rgba(255, 255, 255, 0.08),
                  inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background:
    radial-gradient(ellipse 120% 80% at 50% -10%, oklch(0.32 0.06 230) 0%, transparent 60%),
    radial-gradient(ellipse 100% 60% at 50% 110%, oklch(0.22 0.04 240) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* fine grain noise overlay */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0.7  0 0 0 0 0.85  0 0 0 0 1  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: screen;
  opacity: 0.55;
}

#rain-canvas {
  position: fixed; inset: 0;
  z-index: 1;
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 2;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 28px 64px;
  min-height: 100vh;
}

/* --------- header --------- */
.hdr {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: radial-gradient(circle at 35% 30%, #a8d5ff 0%, #4e8fc4 45%, #1c3a5e 100%);
  box-shadow:
    inset 0 -6px 8px -4px rgba(0, 30, 60, 0.6),
    inset 0 4px 4px -2px rgba(255, 255, 255, 0.5),
    0 6px 18px -4px rgba(60, 120, 200, 0.5);
  position: relative;
  overflow: hidden;
}
.brand-mark::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 35% at 35% 25%, rgba(255,255,255,0.7), transparent 60%);
}
.brand-mark::after {
  content: '';
  position: absolute; bottom: 6px; right: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  filter: blur(0.5px);
}
.brand-text h1 {
  font-family: 'Instrument Serif', 'Times New Roman', serif;
  font-weight: 400;
  font-size: 38px;
  line-height: 1;
  margin: 0;
  letter-spacing: -0.01em;
  font-style: italic;
}
.brand-text p {
  margin: 4px 0 0;
  color: var(--ink-dim);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.hdr-actions { display: flex; gap: 8px; align-items: center; }
.tag {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 6px 10px;
  border-radius: 100px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(10px);
}

/* --------- glass panel --------- */
.glass {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-glass);
  overflow: hidden;
}
.glass::before {
  /* top highlight */
  content: '';
  position: absolute; left: 0; right: 0; top: 0; height: 50%;
  background: linear-gradient(180deg,
    rgba(255, 255, 255, 0.08) 0%,
    rgba(255, 255, 255, 0.02) 40%,
    transparent 100%);
  pointer-events: none;
}
.glass::after {
  /* edge sheen */
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.12) 0%,
    transparent 30%,
    transparent 70%,
    rgba(255, 255, 255, 0.05) 100%);
  mix-blend-mode: overlay;
  pointer-events: none;
}

/* --------- layout --------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 22px;
}
@media (max-width: 920px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  padding: 22px;
}
.panel-h {
  display: flex; justify-content: space-between; align-items: center;
  margin: 0 0 14px;
}
.panel-h h2 {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
  font-weight: 500;
}
.panel-h .count {
  font-size: 11px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* --------- dropzone --------- */
.dropzone {
  border: 1.5px dashed var(--glass-border-bright);
  border-radius: 14px;
  padding: 28px 22px;
  text-align: center;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s;
  background: rgba(180, 215, 255, 0.025);
  position: relative;
  overflow: hidden;
}
.dropzone:hover, .dropzone.over {
  background: rgba(180, 215, 255, 0.07);
  border-color: rgba(200, 230, 255, 0.6);
}
.dropzone.over { transform: scale(0.985); }
.dropzone svg { display: block; margin: 0 auto 10px; opacity: 0.85; }
.dropzone .big {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 22px;
  margin-bottom: 4px;
}
.dropzone .small {
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.02em;
}
.dropzone input { display: none; }

/* --------- thumb strip --------- */
.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  min-height: 4px;
}
.thumb {
  position: relative;
  width: 86px; height: 64px;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 10px -4px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.05);
  cursor: grab;
  transition: transform .12s;
}
.thumb.dragging { opacity: 0.4; }
.thumb:hover { transform: translateY(-2px); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .idx {
  position: absolute; top: 4px; left: 5px;
  font-size: 10px; font-weight: 600;
  background: rgba(0,0,0,0.6);
  padding: 1px 5px;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.thumb .rm {
  position: absolute; top: 4px; right: 4px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  border: none;
  color: white;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  opacity: 0;
  transition: opacity .15s;
}
.thumb:hover .rm { opacity: 1; }
.thumb .rm:hover { background: var(--danger); }

/* --------- effect picker --------- */
.effects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.fx {
  position: relative;
  padding: 14px 10px 10px;
  border-radius: 11px;
  background: rgba(15, 28, 44, 0.5);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font-family: inherit;
  font-size: 11.5px;
  letter-spacing: 0.01em;
  transition: background .15s, border-color .15s, transform .12s;
  overflow: hidden;
}
.fx:hover { background: rgba(30, 56, 88, 0.6); }
.fx.active {
  background: rgba(180, 215, 255, 0.12);
  border-color: rgba(200, 230, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(200, 230, 255, 0.15), 0 0 0 1px rgba(180, 215, 255, 0.1);
}
.fx .fx-name { font-weight: 500; }
.fx .fx-glyph {
  width: 100%; height: 38px;
  display: block;
  margin-bottom: 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1d3a5c, #0d1d33);
  overflow: hidden;
  position: relative;
}

/* --------- controls / sliders --------- */
.field {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}
.field-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field-row .val {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-transform: none;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, rgba(180,215,255,0.4) var(--p,50%), rgba(180,215,255,0.1) var(--p,50%));
  border-radius: 100px;
  outline: none;
  border: 1px solid rgba(180,215,255,0.15);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6f1ff, #6a9ec9 70%, #2c5d8a);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.6);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e6f1ff, #6a9ec9 70%, #2c5d8a);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  cursor: pointer;
}

/* --------- preview --------- */
.preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stage {
  position: relative;
  background: #03060a;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.06),
    inset 0 0 80px rgba(0,0,0,0.6);
}
.stage canvas {
  display: block;
  width: 100%; height: 100%;
}
.stage .empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--ink-faint);
  text-align: center;
  pointer-events: none;
}
.stage .empty .big {
  font-family: 'Instrument Serif', serif;
  font-style: italic;
  font-size: 28px;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.stage .empty .small {
  font-size: 12px;
  letter-spacing: 0.03em;
}

.transport {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s;
  padding: 0;
  flex-shrink: 0;
}
.btn-icon:hover { background: rgba(40, 70, 110, 0.5); }
.btn-icon:active { transform: scale(0.94); }
.btn-icon svg { width: 16px; height: 16px; }
.scrubber {
  flex: 1;
  height: 8px;
  background: rgba(0,0,0,0.5);
  border-radius: 100px;
  position: relative;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
}
.scrubber-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: linear-gradient(90deg, rgba(140, 180, 220, 0.3), rgba(200, 230, 255, 0.7));
  border-radius: 100px;
  width: 0;
}
.scrubber-knob {
  position: absolute; top: 50%;
  width: 14px; height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 35% 30%, #e6f1ff, #6a9ec9 70%, #2c5d8a);
  border: 1px solid rgba(255,255,255,0.4);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  pointer-events: none;
}
.time {
  font-size: 11px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  min-width: 70px;
  text-align: right;
}

/* --------- export bar --------- */
.export-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background .15s, transform .12s, border-color .15s;
}
.btn:hover { background: rgba(40, 70, 110, 0.6); border-color: var(--glass-border-bright); }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(180deg, rgba(140, 200, 255, 0.35), rgba(60, 130, 200, 0.45));
  border-color: rgba(200, 230, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 4px 14px -4px rgba(60, 130, 200, 0.5);
}
.btn.primary:hover {
  background: linear-gradient(180deg, rgba(160, 210, 255, 0.45), rgba(80, 150, 220, 0.55));
}

.select {
  height: 40px;
  padding: 0 32px 0 14px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%23c8dfff' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

/* --------- toast / progress --------- */
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 28, 44, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px 22px;
  display: flex; flex-direction: column;
  gap: 8px;
  min-width: 280px;
  max-width: 90vw;
  box-shadow: 0 20px 50px -10px rgba(0,0,0,0.7);
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast .label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--ink-dim);
  letter-spacing: 0.04em;
}
.toast .label .pct { color: var(--ink); font-variant-numeric: tabular-nums; }
.toast .bar {
  height: 4px;
  background: rgba(0,0,0,0.5);
  border-radius: 100px;
  overflow: hidden;
}
.toast .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #6a9ec9, #b8dcff);
  width: 0;
  transition: width .15s;
}

/* --------- install hint --------- */
.install-hint {
  font-size: 11px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  margin-top: 22px;
  text-align: center;
  opacity: 0.7;
}

/* --------- effect glyphs (mini previews) --------- */
.glyph-flip::before, .glyph-flip::after {
  content: '';
  position: absolute; inset: 0;
}
.glyph-flip::before {
  background: repeating-linear-gradient(90deg, #6a9ec9 0 6px, transparent 6px 12px);
  opacity: 0.7;
}
.glyph-flip::after {
  background: repeating-linear-gradient(90deg, transparent 0 6px, #e6f1ff 6px 12px);
  opacity: 0.4;
  transform: scaleX(0.5); transform-origin: center;
}
.glyph-dissolve {
  background-image: radial-gradient(rgba(255,255,255,0.6) 1px, transparent 1.5px);
  background-size: 4px 4px;
  background-color: #1d3a5c;
}
.glyph-rain {
  background: linear-gradient(180deg, #1d3a5c 0%, #0d1d33 100%);
}
.glyph-rain::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(180deg, rgba(200,230,255,0.6) 0, transparent 60%),
    linear-gradient(180deg, rgba(200,230,255,0.4) 0, transparent 50%);
  background-size: 6px 100%, 9px 100%;
  background-position: 2px 0, 7px 0;
  background-repeat: repeat-x;
}
.glyph-ripple {
  background:
    radial-gradient(circle at 50% 50%, transparent 30%, rgba(200,230,255,0.5) 32%, transparent 36%),
    radial-gradient(circle at 50% 50%, transparent 18%, rgba(200,230,255,0.3) 20%, transparent 24%),
    #0d1d33;
}
.glyph-shatter {
  background: #0d1d33;
  background-image:
    linear-gradient(45deg, #6a9ec9 25%, transparent 25%),
    linear-gradient(-45deg, #4e8fc4 25%, transparent 25%);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}
.glyph-liquid {
  background: linear-gradient(90deg, #1d3a5c, #4e8fc4);
}
.glyph-liquid::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(ellipse at 25% 50%, rgba(255,255,255,0.4), transparent 60%),
    radial-gradient(ellipse at 75% 50%, rgba(255,255,255,0.4), transparent 60%);
}
.glyph-mosaic {
  background:
    conic-gradient(from 0deg at 25% 25%, #6a9ec9, #1d3a5c, #6a9ec9),
    #0d1d33;
  background-size: 50% 50%;
  background-repeat: repeat;
}
.glyph-drip {
  background: #0d1d33;
}
.glyph-drip::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 6px 12px at 20% 70%, rgba(200,230,255,0.7), transparent 70%),
    radial-gradient(ellipse 8px 14px at 50% 50%, rgba(200,230,255,0.8), transparent 70%),
    radial-gradient(ellipse 5px 10px at 80% 80%, rgba(200,230,255,0.6), transparent 70%);
}
.glyph-sweep {
  background: linear-gradient(135deg, #1d3a5c 0%, #1d3a5c 40%, rgba(200,230,255,0.7) 50%, #6a9ec9 60%, #6a9ec9 100%);
}

/* --------- scrollbar --------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(180, 215, 255, 0.15);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(180, 215, 255, 0.3); background-clip: padding-box; border: 2px solid transparent; }
