/* ═══════════════════════════════════════════════════════════════════════════
   WaveAI :: Theme
   Deep-sea palette. The background is alive, so every surface that carries text
   sits on a frosted slab with a real opaque floor underneath it — readability is
   never left to a blur alone.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Water column, surface to trench */
  --abyss-0:   #01040a;
  --abyss-1:   #03080f;
  --abyss-2:   #061320;
  --abyss-3:   #0a1e31;
  --abyss-4:   #0f2c44;
  --deep-5:    #14405f;

  /* Light in the water */
  --foam:      #EAF6FF;
  --spray:     #CFE6F7;
  --mist:      #9FBDD4;
  --deep-mist: #6C8CA6;

  /* Accents */
  --cyan:      #35E5F2;
  --cyan-soft: #6FF0FA;
  --aqua:      #21B6E8;
  --teal:      #14C8B8;
  --lagoon:    #2B8CFF;
  --kelp:      #3DDC97;
  --coral:     #FF6B81;
  --amber:     #FFC24B;
  --violet:    #8A6BFF;

  /* Text — contrast first */
  --ink:       #EDF7FF;   /* body   : ~15:1 on the glass floor */
  --ink-2:     #B9D3E6;   /* meta   */
  --ink-3:     #7E9DB5;   /* faint  */
  --ink-code:  #DCEEFF;

  /* Surfaces */
  --glass:        rgba(7, 22, 38, 0.72);
  --glass-strong: rgba(5, 17, 30, 0.88);
  --glass-hi:     rgba(18, 46, 72, 0.70);
  --line:         rgba(90, 175, 220, 0.16);
  --line-hi:      rgba(110, 215, 255, 0.34);

  /* Message slabs sit on a moving, sometimes bright shader, so each one carries
     its own near-opaque floor. The ocean stays fully visible in the margins,
     the gaps between messages and behind the sidebar — never behind body text. */
  --user-bubble:  linear-gradient(135deg, rgba(43,140,255,.30), rgba(53,229,242,.20)),
                  linear-gradient(0deg, rgba(4,16,29,.90), rgba(4,16,29,.90));
  --user-border:  rgba(93, 190, 255, .48);
  --ai-bubble:    rgba(5, 17, 30, .93);
  --ai-border:    rgba(80, 170, 215, .24);

  --radius:    16px;
  --radius-sm: 10px;
  --radius-lg: 22px;

  --shadow-1: 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-2: 0 10px 34px rgba(0, 0, 0, .46);
  --shadow-glow: 0 0 30px rgba(53, 229, 242, .20);

  --titlebar-h: 54px;
  --sidebar-w: 290px;

  --font: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", ui-monospace, monospace;

  --ease-wave: cubic-bezier(.22, .61, .36, 1);
  --ease-swell: cubic-bezier(.34, 1.36, .64, 1);
  --fs: 15px;
}

/* Flatter, higher-contrast variant */
body.reduce-glow {
  --glass:        rgba(4, 16, 28, 0.94);
  --glass-strong: rgba(3, 12, 22, 0.97);
  --ai-bubble:    rgba(3, 12, 22, .985);
  --user-bubble:  linear-gradient(135deg, rgba(43,140,255,.24), rgba(53,229,242,.14)),
                  linear-gradient(0deg, rgba(3,12,22,.97), rgba(3,12,22,.97));
  --shadow-glow:  none;
  --ink:          #F4FAFF;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Several components set an explicit `display`, which would otherwise beat the
   `hidden` attribute's user-agent rule and leave dialogs and popovers stuck
   open. This keeps `hidden` authoritative everywhere. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--abyss-1);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
}

::selection { background: rgba(53, 229, 242, .30); color: #fff; }

/* Scrollbars as light shafts */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(53,229,242,.30), rgba(43,140,255,.22));
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(53,229,242,.58), rgba(43,140,255,.42));
  background-clip: content-box;
}

/* ── Background layers ───────────────────────────────────────────────────── */

#ocean, #bubbles, #caustics, #vignette {
  position: fixed; inset: 0; pointer-events: none;
}
#ocean   { z-index: 0; }
#bubbles { z-index: 1; }

#caustics {
  z-index: 2;
  opacity: .30;
  mix-blend-mode: screen;
  background:
    radial-gradient(1100px 620px at 14% -12%, rgba(53,229,242,.22), transparent 62%),
    radial-gradient(900px 520px at 88% -6%, rgba(43,140,255,.20), transparent 60%),
    radial-gradient(760px 480px at 50% 108%, rgba(138,107,255,.14), transparent 64%);
  animation: causticDrift 26s var(--ease-wave) infinite alternate;
}

#vignette {
  z-index: 3;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 42%, rgba(1,4,10,.62) 100%),
    linear-gradient(180deg, rgba(1,4,10,.42) 0%, transparent 22%, transparent 74%, rgba(1,4,10,.56) 100%);
}

/* ── Shared atoms ────────────────────────────────────────────────────────── */

.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
}

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor;
       stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

button { font-family: inherit; font-size: inherit; color: inherit;
         background: none; border: none; cursor: pointer; }

input, textarea, select {
  font-family: inherit; font-size: inherit; color: var(--ink);
  background: rgba(3, 14, 26, .70);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  outline: none;
  user-select: text;
  transition: border-color .22s, box-shadow .22s, background .22s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--line-hi);
  box-shadow: 0 0 0 3px rgba(53, 229, 242, .13);
  background: rgba(5, 20, 34, .84);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }

select.sel {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--mist) 50%),
                    linear-gradient(135deg, var(--mist) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
select.sel option { background: #061320; color: var(--ink); }

.ghost-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 30, 49, .55);
  color: var(--ink-2);
  font-size: 13px; font-weight: 600;
  position: relative; overflow: hidden;
  transition: color .2s, border-color .2s, background .2s, transform .16s var(--ease-swell);
}
.ghost-btn:hover {
  color: var(--foam); border-color: var(--line-hi);
  background: rgba(20, 64, 95, .62);
  transform: translateY(-1px);
}
.ghost-btn:active { transform: translateY(0) scale(.97); }
.ghost-btn.accent {
  color: #02121a;
  background: linear-gradient(135deg, var(--cyan), var(--aqua));
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(53, 229, 242, .30);
}
.ghost-btn.accent:hover { box-shadow: 0 6px 26px rgba(53, 229, 242, .46); }
.ghost-btn.danger:hover { color: var(--coral); border-color: rgba(255, 107, 129, .48); }
.ghost-btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }

.mini-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; color: var(--ink-3);
  transition: color .2s, background .2s;
}
.mini-btn:hover { color: var(--cyan); background: rgba(53, 229, 242, .12); }

h1 { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
h2 { font-size: 15px; font-weight: 700; letter-spacing: .1px; color: var(--foam); }
p  { color: var(--ink-2); }
em { font-style: normal; color: var(--ink-3); font-size: 12px; font-weight: 500; }
