/* BACKUP: base.css pre-patch saved by Codex on 2026-01-13
/*
Acceptance checklist
[ ] Dark mode page background is NOT flat: includes subtle radial bloom behind app frame.
[ ] Glass effect appears on app/topbar/sidebar/content/footer cards, but text/icons remain crisp.
[ ] Glow is controlled (app edge + topbar hairline + active nav ring only).
[ ] Active nav item has a clear neon ring and accent tint.
[ ] No unintended blur on buttons, links, headings, icons.
[ ] No layout/scroll regressions (sidebar scroll + tool scroll still behave).
[ ] No new files added; only allowed files modified.
[ ] No console errors introduced.
*/

:root {
  --page-bg: radial-gradient(1200px 760px at 50% 0%, #f4f7fb 0%, #eef2f8 45%, #e8edf4 100%);
  --page-bloom: transparent;
  --app-bg: rgba(249, 251, 255, 0.94);
  --card-bg: rgba(255, 255, 255, 0.92);
  --rail-bg: rgba(242, 246, 250, 0.92);
  --text: #1b212b;
  --muted: #5f6b7a;
  --border: rgba(196, 207, 220, 0.7);
  --shadow: 0 20px 40px rgba(18, 24, 33, 0.12);
  --glow: 0 0 0 rgba(0, 0, 0, 0);
  --card-shadow: 0 12px 28px rgba(19, 28, 40, 0.08);
  --glass-shadow: 0 16px 32px rgba(19, 28, 40, 0.1);
  --frame-shadow: 0 18px 36px rgba(19, 28, 40, 0.12);
  --topbar-hairline: inset 0 1px 0 rgba(255, 255, 255, 0.35);
  --accent: #21c7c6;
  --accent-soft: rgba(33, 199, 198, 0.2);
  --accent-glow: rgba(33, 199, 198, 0.3);
  --focus: #2e86d7;
  --toggle-bg: rgba(230, 236, 246, 0.9);
  --drawer-peek: 56px;
  --mobile-nav-height: 72px;
}

html[data-theme="light"] {
  --page-bg: radial-gradient(1200px 760px at 50% 0%, #f7fbff 0%, #eef3fb 45%, #e7eef7 100%);
  --page-bloom: radial-gradient(800px 420px at 20% 10%, rgba(33, 199, 198, 0.12), transparent 60%),
    radial-gradient(900px 600px at 80% 90%, rgba(74, 120, 200, 0.08), transparent 70%);
  --app-bg: rgba(255, 255, 255, 0.78);
  --card-bg: rgba(255, 255, 255, 0.72);
  --rail-bg: rgba(248, 250, 255, 0.72);
  --text: #1b212b;
  --muted: #5f6b7a;
  --border: rgba(210, 219, 230, 0.6);
  --shadow: 0 18px 36px rgba(20, 30, 45, 0.08);
  --glow: 0 0 0 rgba(0, 0, 0, 0);
  --card-shadow: 0 10px 24px rgba(20, 30, 45, 0.06);
  --glass-shadow: 0 12px 28px rgba(20, 30, 45, 0.08);
  --frame-shadow: 0 16px 32px rgba(20, 30, 45, 0.1);
  --topbar-hairline: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  --accent: #21c7c6;
  --accent-soft: rgba(33, 199, 198, 0.14);
  --accent-glow: rgba(33, 199, 198, 0.25);
  --focus: #2e86d7;
  --toggle-bg: rgba(236, 242, 250, 0.9);
}

html[data-theme="dark"] {
  --page-bg: #050608;
  --page-bloom: radial-gradient(700px 380px at 50% 8%, rgba(0, 242, 255, 0.18), transparent 60%),
    radial-gradient(900px 620px at 20% 90%, rgba(84, 108, 200, 0.16), transparent 70%);
  --app-bg: rgba(16, 20, 30, 0.52);
  --card-bg: rgba(20, 26, 38, 0.52);
  --rail-bg: rgba(14, 18, 28, 0.6);
  --text: #f7fbff;
  --muted: #a1aac0;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 20px 40px rgba(3, 6, 12, 0.65);
  --glow: 0 0 18px rgba(0, 242, 255, 0.18);
  --card-shadow: 0 16px 32px rgba(4, 8, 16, 0.6);
  --glass-shadow: 0 16px 34px rgba(4, 8, 16, 0.6);
  --frame-shadow: 0 20px 44px rgba(4, 8, 16, 0.7);
  --topbar-hairline: inset 0 1px 0 rgba(0, 242, 255, 0.15);
  --accent: #00f2ff;
  --accent-soft: rgba(0, 242, 255, 0.14);
  --accent-glow: rgba(0, 242, 255, 0.35);
  --focus: #7ed3ff;
  --toggle-bg: rgba(18, 24, 36, 0.8);
}

/*
Acceptance checklist
[ ] Light theme looks airy + clean (soft glass, subtle borders, gentle shadows)
[ ] Dark theme visuals unchanged
[ ] No layout changes (grid/flex/widths/breakpoints untouched)
[ ] Scroll behavior unchanged (sidebar/tool scroll still correct)
[ ] No new !important unless documented
[ ] No console errors introduced (CSS only)
*/

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--page-bloom), var(--page-bg);
  color: var(--text);
}

body {
  font-family: "Trebuchet MS", "Lucida Sans", "Lucida Grande", sans-serif;
}

.app {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: transparent !important;
  color: var(--text);
  border-radius: 18px;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
}

@media (min-width: 1200px) {
  .app {
    max-width: 1200px;
  }
}

@media (min-width: 1440px) {
  .app {
    max-width: 1360px;
  }
}

@media (min-width: 1680px) {
  .app {
    max-width: 1520px;
  }
}

@media (min-width: 1920px) {
  .app {
    max-width: 1680px;
  }
}

@media (min-width: 721px) {
  body {
    padding: 16px 0;
  }

  .app {
    min-height: calc(100vh - 32px);
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: rgba(10, 15, 25, 0.45) !important;
  border: 1px solid rgba(0, 242, 255, 0.3) !important;
  border-radius: 16px;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  margin: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #00f2ff 0%, #00d4ff 100%);
  color: #000;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.08em;
}

.brand-name {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-tagline {
  font-size: 0.85rem;
  color: var(--muted);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--toggle-bg);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.theme-toggle-icon {
  font-size: 1rem;
}

.app-body {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: rgba(10, 15, 25, 0.45) !important;
  border: 1px solid rgba(0, 242, 255, 0.3) !important;
  border-radius: 16px;
  padding: 12px;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  margin: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
  height: 100%;
}

.sidebar-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding-right: 6px;
}

.sidebar-fixed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
}

.content-card {
  flex: 1;
  min-height: 0;
  background: rgba(10, 15, 25, 0.45) !important;
  border-radius: 16px;
  border: 1px solid rgba(0, 242, 255, 0.3) !important;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  margin: 8px;
}

.tool-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.tool-scroll h1 {
  background: linear-gradient(165deg, #00f2ff 20%, #ffffff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 800;
}

.content-footer {
  background: rgba(10, 15, 25, 0.45) !important;
  border-radius: 16px;
  border: 1px solid rgba(0, 242, 255, 0.3) !important;
  padding: 16px 18px;
  box-shadow: 0 0 15px rgba(0, 242, 255, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.1) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  margin: 8px;
}

.footer-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.footer-columns h2 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.footer-columns a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  margin: 4px 0;
  font-size: 0.9rem;
}

.nav-item {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.nav-item.is-active {
  background: rgba(0, 242, 255, 0.08);
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

.nav-item:focus-visible,
.theme-toggle:focus-visible,
.footer-columns a:focus-visible,
.bottom-nav-center:focus-visible,
.bottom-nav-icon:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.bottom-nav,
.bottom-sheet,
.bottom-nav-overlay {
  display: none;
}

.sidebar-scroll,
.tool-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.sidebar-scroll::-webkit-scrollbar,
.tool-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.sidebar-scroll::-webkit-scrollbar-track,
.tool-scroll::-webkit-scrollbar-track {
  background: rgba(10, 14, 20, 0.5);
  border-radius: 999px;
}

.sidebar-scroll::-webkit-scrollbar-thumb,
.tool-scroll::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 999px;
}

@media (max-width: 720px) {
  body.sheet-open {
    overflow: hidden;
  }

  .app {
    padding: 16px;
    padding-bottom: calc(16px + var(--mobile-nav-height) + env(safe-area-inset-bottom));
    border-radius: 0;
    min-height: 100svh;
  }

  .app-body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .content {
    flex: 1;
    min-height: calc(100svh - 140px - var(--mobile-nav-height) - env(safe-area-inset-bottom));
  }

  .content-card {
    margin: 0;
    border: none !important;
    background: transparent !important;
    border-radius: 0;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    min-height: calc(100svh - 140px - var(--mobile-nav-height) - env(safe-area-inset-bottom));
  }

  .bottom-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    background: color-mix(in srgb, var(--text) 35%, transparent);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 35;
  }

  body.sheet-open .bottom-nav-overlay {
    z-index: 55;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom));
    padding: 0 24px calc(10px + env(safe-area-inset-bottom));
    background: var(--app-bg);
    border-top: 1px solid var(--border);
    box-shadow: var(--glass-shadow);
    z-index: 50;
    transition: transform 0.25s ease, opacity 0.2s ease;
    will-change: transform, opacity;
    transform: translateZ(0);
  }

  .bottom-nav-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
  }

  .bottom-nav-icon-glyph {
    width: 48px;
    height: 48px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.05em;
  }

  .bottom-nav-icon-text {
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .bottom-nav-center {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 58px;
    padding: 0 26px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: var(--toggle-bg);
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    transform: translateY(-24px);
    box-shadow: var(--card-shadow);
  }

  .bottom-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: 12%;
    border-radius: 26px 26px 0 0;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    box-shadow: var(--frame-shadow);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 60;
    pointer-events: none;
    will-change: transform;
    transform: translateY(100%) translateZ(0);
  }

  .bottom-sheet.is-dragging {
    transition: none;
  }

  .bottom-sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px 8px;
    cursor: grab;
    user-select: none;
    touch-action: none !important;
  }

  .bottom-sheet-grip {
    width: 48px;
    height: 5px;
    border-radius: 999px;
    background: var(--border);
  }

  .bottom-sheet-title {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .bottom-sheet-content {
    flex: 1;
    overflow: auto;
    padding: 6px 16px calc(18px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .bottom-sheet-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .sheet-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 6px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text);
  }

  .sheet-tile-icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: var(--rail-bg);
    display: grid;
    place-items: center;
    font-weight: 700;
    letter-spacing: 0.06em;
  }

  .sheet-tile-label {
    font-size: 0.78rem;
    text-align: center;
    color: var(--muted);
  }

  .sheet-tile.is-active .sheet-tile-icon {
    border-color: var(--accent);
    box-shadow: 0 0 10px var(--accent-glow);
    color: var(--accent);
  }

  body.sheet-open .bottom-nav {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }

  body.sheet-open .bottom-nav-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.sheet-open .bottom-sheet {
    transform: translateY(0);
    pointer-events: auto;
  }

  body.sheet-open .content-footer {
    visibility: hidden;
    pointer-events: none;
  }
}

/* Light theme overrides use !important to counter existing !important on glass panels. */
html[data-theme="light"] .topbar,
html[data-theme="light"] .sidebar,
html[data-theme="light"] .content-card,
html[data-theme="light"] .content-footer,
html[data-theme="light"] .bottom-nav,
html[data-theme="light"] .bottom-sheet {
  border: 1px solid var(--border) !important;
  box-shadow: var(--glass-shadow) !important;
  backdrop-filter: blur(14px) saturate(150%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(150%) !important;
}

html[data-theme="light"] .topbar,
html[data-theme="light"] .bottom-nav {
  background: var(--app-bg) !important;
}

html[data-theme="light"] .sidebar,
html[data-theme="light"] .content-card,
html[data-theme="light"] .content-footer,
html[data-theme="light"] .bottom-sheet {
  background: var(--card-bg) !important;
}

html[data-theme="light"] .nav-item.is-active {
  background: rgba(33, 199, 198, 0.1);
  border-color: rgba(33, 199, 198, 0.45);
  box-shadow: 0 0 8px rgba(33, 199, 198, 0.25);
  color: var(--accent);
}

@media (max-width: 720px) {
  html[data-theme="light"] .content-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }
}
