:root {
  --bg: #0f1115;
  --bg-soft: #12151c;
  --text: #e6e9ef;
  --text-dim: #9aa3b2;
  --active: #ffffff;
  --muted: #aab0bc;
  --accent: #6da4ff;
  --highlight: #2a3346;
  --ring: rgba(109, 164, 255, 0.22);
  --glass: rgba(19, 22, 30, 0.6);
  --glass-border: rgba(255,255,255,0.08);
  --video-dim: 0.75;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 70% -20%, rgba(109,164,255,0.08), transparent 60%), var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.app__header, .app__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  color: var(--muted);
}

.app__footer a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding-bottom: 2px;
  transition: color 160ms ease, border-color 160ms ease;
}
.app__footer a:hover {
  color: var(--active);
  border-bottom-color: var(--accent);
}

.brand {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.editor-wrap {
  position: relative;
  padding: 48px 0 64px;
}

.bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  z-index: -2;
  opacity: 0;
  transition: opacity 300ms ease;
}

.bg-dim {
  position: fixed;
  inset: 0;
  background: radial-gradient(1200px 800px at 70% -20%, rgba(0,0,0,0.25), transparent 60%), rgb(0 0 0 / var(--video-dim));
  z-index: -1;
  opacity: 0;
  transition: opacity 300ms ease;
}

body.video-on .bg-video { opacity: 1; }
body.video-on .bg-dim { opacity: 1; }

.editor {
  width: min(740px, calc(100% - 48px));
  margin: 0 auto;
  line-height: 1.8;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.2px;
  color: var(--text);
}

.editor:focus { outline: none; }

.editor p { margin: 0 0 1.2em; }

/* Faded surroundings for focus mode */
.lamp-on .editor { color: var(--text-dim); }
.lamp-on .editor .dim { color: var(--text-dim); }
.lamp-on .editor .active-sentence { color: var(--active); }

/* CSS Custom Highlight API (does not alter DOM) */
.lamp-on ::highlight(active-sentence) { color: var(--active); }

/* Selection */
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* Subtle caret glow */
@keyframes caretPulse {
  0%, 100% { text-shadow: 0 0 0 transparent; }
  50% { text-shadow: 0 0 6px rgba(109,164,255,0.35); }
}

.caret-glow { animation: caretPulse 1.6s ease-in-out infinite; }

/* Floating Settings Button */
.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
  backdrop-filter: blur(10px);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0,0,0,0.45); border-color: rgba(255,255,255,0.15); }
.fab:active { transform: translateY(0); }

/* Sliding Glass Panel */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 92vw);
  height: 100vh;
  background: color-mix(in srgb, var(--glass) 100%, transparent);
  backdrop-filter: blur(16px) saturate(120%);
  border-left: 1px solid var(--glass-border);
  box-shadow: -20px 0 60px rgba(0,0,0,0.45);
  transform: translateX(100%);
  transition: transform 260ms ease;
  z-index: 10;
}
.panel.open { transform: translateX(0); }

.panel__content { height: 100%; display: flex; flex-direction: column; }
.panel__header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--glass-border); }
.panel__close { background: transparent; border: 0; color: var(--text); font-size: 18px; cursor: pointer; opacity: 0.7; }
.panel__close:hover { opacity: 1; }

.panel__section { padding: 18px 20px; }
.section__title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; }

.themes { display: flex; flex-wrap: wrap; gap: 10px; }
.theme-pill {
  appearance: none;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}
.theme-pill[aria-selected="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109,164,255,0.18); }
.theme-pill:hover { transform: translateY(-1px); border-color: rgba(255,255,255,0.16); }

/* Toggle switch */
.switch { display: flex; align-items: center; gap: 12px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.25);
  transition: background 160ms ease, border-color 160ms ease;
}
.switch__track::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 4px;
  translate: 0 -50%;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  transition: left 160ms ease, background 160ms ease;
}
.switch input:checked + .switch__track { border-color: var(--accent); box-shadow: inset 0 2px 10px color-mix(in srgb, var(--accent) 25%, transparent); }
.switch input:checked + .switch__track::after { left: 24px; background: var(--active); }
.switch__label { color: var(--muted); font-size: 14px; }

.panel__videos { display: none; }
body.video-on .panel__videos { display: block; }
.video-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.video-card {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  cursor: pointer;
  overflow: hidden;
}
.video-card__img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(105%) contrast(105%); transform: scale(1.02); transition: transform 220ms ease; }
.video-card:hover .video-card__img { transform: scale(1.06); }
.video-card[aria-selected="true"] { outline: 2px solid var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.video-card__badge { position: absolute; left: 10px; top: 10px; font-size: 12px; color: var(--active); background: color-mix(in srgb, var(--accent) 32%, rgba(0,0,0,0.4)); padding: 4px 8px; border-radius: 999px; border: 1px solid var(--glass-border); }

/* Video dim slider */
.video-dim { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.video-dim__label { color: var(--muted); font-size: 14px; min-width: 110px; }
.video-dim__value { color: var(--text-dim); font-size: 14px; width: 42px; text-align: right; }
.video-dim input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 999px; outline: none;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, transparent), color-mix(in srgb, var(--accent) 20%, transparent));
}
.video-dim input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--active); border: 1px solid var(--glass-border); box-shadow: 0 2px 8px rgba(0,0,0,0.4); cursor: pointer; }
.video-dim input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--active); border: 1px solid var(--glass-border); box-shadow: 0 2px 8px rgba(0,0,0,0.4); cursor: pointer; }

/* Cloud sync row */
.cloud-row { display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; }
.cloud-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--glass-border); background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); cursor: pointer; font-size: 20px; }
.cloud-btn[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.cloud-title { color: var(--text); font-weight: 600; }
.cloud-status { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cloud-help { color: var(--text-dim); font-size: 12px; margin-top: 6px; }

/* Themes – set via data-theme on body */
body[data-theme="theme-1"] {
  --bg: #0f1115;
  --text: #e6e9ef;
  --text-dim: #9aa3b2;
  --active: #ffffff;
  --muted: #aab0bc;
  --accent: #6da4ff;
  --highlight: #2a3346;
}
body[data-theme="theme-2"] {
  --bg: #0b0b10;
  --text: #e4e4eb;
  --text-dim: #9aa0ac;
  --active: #ffffff;
  --muted: #9da3ad;
  --accent: #ff7ab6;
  --highlight: #3a2a37;
}
body[data-theme="theme-3"] {
  --bg: #191512;
  --text: #e9dcc5;
  --text-dim: #c7b9a7;
  --active: #fff5e6;
  --muted: #c3b6a4;
  --accent: #f2a65a;
  --highlight: #3c2b20;
}
body[data-theme="theme-4"] {
  --bg: #f4f6fb;
  --text: #1c2333;
  --text-dim: #4a5670;
  --active: #0c1220;
  --muted: #4a5670;
  --accent: #4b82f0;
  --highlight: #dbe5ff;
}
body[data-theme="theme-5"] {
  --bg: #0a0e17;
  --text: #e2f0ff;
  --text-dim: #9ab0c8;
  --active: #ffffff;
  --muted: #98a7bf;
  --accent: #7ef0d6;
  --highlight: #203a3b;
}

body[data-theme="theme-6"] {
  --bg: #101418;
  --text: #f3efe6;
  --text-dim: #b8b2a8;
  --active: #ffffff;
  --muted: #9ea7b3;
  --accent: #f6c177; /* gold */
  --highlight: #2b2620;
}

body[data-theme="theme-7"] {
  --bg: #0f1412;
  --text: #e6f2ea;
  --text-dim: #a7c1b0;
  --active: #ffffff;
  --muted: #8fb29f;
  --accent: #6ed0b3; /* mint */
  --highlight: #213329;
}

body[data-theme="theme-8"] {
  --bg: #120f18;
  --text: #efe6ff;
  --text-dim: #c9b6ee;
  --active: #ffffff;
  --muted: #b09ddf;
  --accent: #a67cf7; /* violet */
  --highlight: #251f36;
}

body[data-theme="theme-video"] {
  --bg: #0a0d12;
  --text: #e8eef7;
  --text-dim: #a9b4c7;
  --active: #ffffff;
  --muted: #93a0b5;
  --accent: #7bb2ff;
  --highlight: #1d2b44;
}





