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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --muted: #8b8fa3;
  --accent: #6c63ff;
  --accent-hover: #5a52e0;
  --success: #34d399;
  --warning: #fbbf24;
  --critical: #f87171;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Nav */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo { color: var(--accent); font-weight: 700; font-size: 1.25rem; text-decoration: none; }
nav ul { list-style: none; display: flex; gap: 1.5rem; }
nav a { color: var(--muted); text-decoration: none; transition: color .2s; }
nav a:hover, nav a:focus-visible { color: var(--text); }

/* Main */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 2rem;
  flex: 1;
  width: 100%;
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; margin-bottom: .75rem; color: var(--accent); }
p { margin-bottom: 1rem; color: var(--text); }

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  transition: border-color .2s;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin-bottom: .5rem; }
.card p { font-size: .9rem; color: var(--text); }
.tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: .5rem;
  margin-right: .25rem;
}

/* Notifications */
.notif {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--border);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  margin-bottom: 1rem;
}
.notif.warning  { border-left-color: var(--warning); }
.notif.success  { border-left-color: var(--success); }
.notif.critical { border-left-color: var(--critical); }
.notif h3 { font-size: 1rem; margin-bottom: .25rem; }
.notif p  { font-size: .875rem; margin: 0; }

/* Flash */
.flash {
  padding: .75rem 2.5rem .75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: .9rem;
  position: relative;
}
.flash.error { background: rgba(248,113,113,.15); color: var(--critical); }
.flash-close {
  position: absolute;
  right: .75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: .6;
  padding: 0 .25rem;
}
.flash-close:hover { opacity: 1; }

/* Form */
.login-form {
  max-width: 360px;
  margin: 0 auto;
}
.login-form label {
  display: block;
  margin-bottom: .5rem;
  font-size: .9rem;
}
.login-form input[type="password"] {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  margin-bottom: 1rem;
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: .6rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s;
}
.btn:hover, .btn:focus-visible { background: var(--accent-hover); }

/* About page */
.about-hero { text-align: center; margin-bottom: 2.5rem; }
.about-hero h1 { font-size: 2.5rem; margin-bottom: .25rem; }
.subtitle { color: var(--accent); font-size: 1.1rem; margin-bottom: .25rem; }
.contact-line { font-size: .9rem; color: var(--text); }
.contact-line a { color: var(--accent); text-decoration: none; }

.about-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 768px) {
  .about-layout { grid-template-columns: 1fr; }
  .brain-col { order: -1; }
}

.timeline-col h2 {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.timeline-col h2:first-child { margin-top: 0; }

.timeline-item {
  position: relative;
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: default;
  transition: border-color .25s, box-shadow .25s, transform .2s;
}
.timeline-item:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(108,99,255,.15);
  transform: translateX(4px);
}
.timeline-date {
  display: inline-block;
  font-size: .75rem;
  color: var(--accent);
  margin-bottom: .25rem;
  font-weight: 600;
}
.timeline-item h3 { font-size: .95rem; margin-bottom: .25rem; }
.timeline-item p { font-size: .85rem; margin: 0; color: var(--text); }

/* Brain column */
.brain-col {
  position: sticky;
  top: 80px;
}
#brain-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  max-height: 340px;
  border-radius: 12px;
  overflow: hidden;
}
#brain-canvas { display: block; width: 100%; height: 100%; }

.brain-hint {
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  margin-top: .5rem;
  transition: opacity .3s;
}

.skill-panel {
  margin-top: .75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  transition: opacity .3s, transform .3s;
}
.skill-panel.hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
.skill-panel h3 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: .4rem;
}
.skill-panel p {
  font-size: .85rem;
  margin: 0;
  line-height: 1.5;
}

/* Brain-integrated chat */
#brain-chat {
  margin-top: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

#chat-messages {
  max-height: 220px;
  min-height: 60px;
  overflow-y: auto;
  padding: .6rem .75rem;
}

.chat-msg {
  padding: .5rem .75rem;
  border-radius: 10px;
  margin-bottom: .45rem;
  font-size: .95rem;
  line-height: 1.5;
  max-width: 90%;
  word-wrap: break-word;
}
.chat-bot {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.chat-user {
  background: var(--accent);
  color: #fff;
  margin-left: auto;
}

/* Topic chips */
.chat-topics { padding: .25rem 0; }
.chat-topics-label {
  font-size: .9rem;
  color: var(--text);
  margin-bottom: .5rem;
}
.chat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.chat-chip {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: .35rem .75rem;
  font-size: .85rem;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  white-space: nowrap;
}
.chat-chip:hover {
  border-color: var(--accent);
  background: rgba(108,99,255,.1);
}

.chat-input-row {
  display: flex;
  gap: .4rem;
  padding: .5rem .6rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
#chat-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .45rem .65rem;
  color: var(--text);
  font-size: .95rem;
  outline: none;
}
#chat-input:focus { border-color: var(--accent); }
#chat-send {
  background: var(--accent);
  border: none;
  color: #fff;
  border-radius: 6px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s;
}
#chat-send:hover { background: var(--accent-hover); }

/* Email prompt inside chat */
.chat-email-form {
  display: flex;
  gap: .4rem;
  margin-top: .5rem;
}
.chat-email-input {
  flex: 1;
  padding: .35rem .5rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
}
.chat-email-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: .35rem .7rem;
  font-size: .8rem;
  cursor: pointer;
}
.chat-email-btn:hover { background: var(--accent-hover); }

/* Project tabs */
.project-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
}
.project-tab {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .5rem 1.2rem;
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
}
.project-tab.active, .project-tab:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.project-panel { display: none; }
.project-panel.active { display: block; }

/* Calculator */
.calc-tabs {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex-shrink: 0;
  width: 105px;
  padding-right: .75rem;
  border-right: 1px solid #3a3d4a;
  margin-right: .75rem;
}
.calc-tab {
  background: linear-gradient(180deg, #2e3142, #252838);
  color: #8b8fa3;
  border: 1px solid #3a3d4a;
  border-radius: 8px;
  padding: .4rem .55rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  box-shadow: 0 2px 4px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.04);
}
.calc-tab:hover { background: linear-gradient(180deg, #363a50, #2e3142); color: #c0c4d6; }
.calc-tab.active {
  background: linear-gradient(180deg, #6c63ff, #5a52e0);
  color: #fff;
  border-color: #7b73ff;
  box-shadow: 0 2px 8px rgba(108,99,255,.35), inset 0 1px 0 rgba(255,255,255,.15);
}
.calc-mode { display: none; }
.calc-mode.active { display: block; flex: 1; }

#panel-calculator {
  margin-top: 2rem;
}
#panel-calculator > .calc-landscape {
  display: flex;
  gap: 0;
  max-width: 960px;
  min-height: 520px;
  background: linear-gradient(145deg, #2a2d3a, #1e2130);
  border: 2px solid #3a3d4a;
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow:
    0 8px 32px rgba(0,0,0,.5),
    0 2px 8px rgba(0,0,0,.3),
    inset 0 1px 0 rgba(255,255,255,.05);
  position: relative;
}
/* Solar panel strip */
#panel-calculator > .calc-landscape::before {
  content: '';
  position: absolute;
  top: 12px;
  right: 20px;
  width: 60px;
  height: 14px;
  background: linear-gradient(90deg, #1a1a2e, #2d2d44, #1a1a2e, #2d2d44);
  border-radius: 3px;
  border: 1px solid #3a3d4a;
  opacity: .6;
}

.calc-container {
  flex: 1;
  max-width: none;
  margin: 0;
  background: none;
  border-radius: 0;
  padding: 0;
  border: none;
}
.calc-container h3 { font-size: .95rem; color: var(--accent); margin-bottom: .75rem; }
.calc-container label { display: block; font-size: .8rem; color: var(--muted); margin: .4rem 0 .2rem; }
.calc-display {
  background: linear-gradient(180deg, #c8d4b8, #b8c4a8);
  color: #1a2a1a;
  font-size: 1.8rem;
  text-align: right;
  padding: .6rem 1rem;
  border-radius: 6px;
  margin-bottom: .75rem;
  overflow: hidden;
  white-space: nowrap;
  font-family: 'SF Mono', 'Courier New', monospace;
  font-weight: 700;
  border: 2px solid #8a9a7a;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.25), inset 0 -1px 0 rgba(255,255,255,.3);
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
}
.calc-sci-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .4rem;
}
.calc-btn {
  background: linear-gradient(180deg, #3a3d50, #2e3142);
  color: #d0d4e0;
  border: 1px solid #4a4d5a;
  border-radius: 8px;
  padding: .6rem;
  font-size: 1rem;
  cursor: pointer;
  transition: all .1s;
  box-shadow: 0 3px 6px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.06);
  font-weight: 500;
}
.calc-btn:hover { background: linear-gradient(180deg, #44475a, #3a3d50); }
.calc-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.04);
}
.calc-fn {
  color: #6c63ff;
  background: linear-gradient(180deg, #2a2d3e, #22253a);
}
.calc-sci {
  background: linear-gradient(180deg, #2a2d3e, #22253a);
  color: #a0a4ff;
  border-color: #3a3d4a;
  font-size: .8rem;
  font-weight: 600;
}
.calc-sci:hover { background: linear-gradient(180deg, #34374a, #2a2d3e); }
.calc-op {
  background: linear-gradient(180deg, #6c63ff, #5a52e0);
  color: #fff;
  border-color: #7b73ff;
  box-shadow: 0 3px 8px rgba(108,99,255,.3), inset 0 1px 0 rgba(255,255,255,.15);
}
.calc-op:hover { background: linear-gradient(180deg, #7b73ff, #6c63ff); }
.calc-eq {
  background: linear-gradient(180deg, #34d399, #2ab882);
  color: #fff;
  border-color: #3ee0a5;
  box-shadow: 0 3px 8px rgba(52,211,153,.3), inset 0 1px 0 rgba(255,255,255,.15);
}
.calc-eq:hover { background: linear-gradient(180deg, #3ee0a5, #34d399); }
.calc-zero { grid-column: span 2; }

.calc-select {
  width: 100%;
  padding: .4rem .5rem;
  border: 1px solid #4a4d5a;
  border-radius: 6px;
  background: #2a2d3a;
  color: #d0d4e0;
  font-size: .85rem;
  margin-bottom: .4rem;
}
.calc-input {
  width: 100%;
  padding: .4rem .6rem;
  border: 1px solid #4a4d5a;
  border-radius: 6px;
  background: #2a2d3a;
  color: #d0d4e0;
  font-size: .9rem;
  margin-bottom: .3rem;
}
.calc-input:focus, .calc-select:focus { border-color: var(--accent); outline: none; }
.calc-hint { font-size: .75rem; color: var(--muted); margin-bottom: .5rem; }
.convert-row { display: flex; gap: .5rem; align-items: center; }
.convert-row input { flex: 1; }
.convert-row select { flex: 1; }
.convert-arrow { text-align: center; font-size: 1.2rem; color: var(--accent); margin: .3rem 0; }

/* Tuner slider */
.tuner-wrapper {
  margin-bottom: .75rem;
  padding: .5rem 0;
}
.tuner-track {
  position: relative;
  background: linear-gradient(180deg, #1a1d28, #22253a);
  border: 1px solid #3a3d4a;
  border-radius: 6px;
  padding: .6rem .75rem .5rem;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.3);
}
.tuner-labels {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-bottom: .4rem;
}
.tuner-label {
  background: none;
  border: none;
  color: #6b6f82;
  font-size: .7rem;
  font-weight: 600;
  cursor: pointer;
  padding: .1rem 0;
  transition: color .2s;
  position: relative;
  z-index: 2;
}
.tuner-label:hover { color: #d0d4e0; }
.tuner-label.active { color: #ff4444; }
/* Tick marks */
.tuner-label::after {
  content: '';
  display: block;
  width: 1px;
  height: 8px;
  background: #4a4d5a;
  margin: .2rem auto 0;
}
.tuner-label.active::after { background: #ff4444; height: 10px; }

.tuner-slider {
  position: relative;
  height: 8px;
  background: linear-gradient(90deg, #2a2d3a, #3a3d4a);
  border-radius: 4px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.3);
  cursor: pointer;
}
.tuner-needle {
  position: absolute;
  top: -6px;
  width: 6px;
  height: 20px;
  background: #ff4444;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255,68,68,.5);
  transition: left .25s ease;
  z-index: 3;
  cursor: grab;
  touch-action: none;
}
.tuner-needle:active { cursor: grabbing; }

.calc-container { overflow: visible; }

/* Solar system strip */
.solar-system { margin-bottom: 1.25rem; }
.solar-label { font-size: .8rem; color: #8b8fa3; margin: .5rem 0 .3rem; font-weight: 600; }
.solar-strip {
  display: flex;
  gap: .4rem;
  flex-wrap: nowrap;
  padding-bottom: .3rem;
  overflow-x: auto;
}

/* Tree-style planet with moons below */
.solar-body-wrap {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.solar-body-wrap.expanded { margin-bottom: .3rem; }

.moon-tree {
  display: flex;
  gap: .2rem;
  margin-top: .2rem;
  position: relative;
  padding-top: .4rem;
}
.moon-tree::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: .4rem;
  background: #4a4d5a;
}
.moon-tree-line {
  position: absolute;
  top: .4rem;
  left: 10%;
  right: 10%;
  height: 1px;
  background: #4a4d5a;
}
.moon-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.moon-branch::before {
  content: '';
  width: 1px;
  height: .3rem;
  background: #4a4d5a;
}
.moon-branch .solar-body {
  min-width: 38px;
  padding: .2rem .3rem;
}
.moon-branch .solar-emoji { font-size: .7rem; }
.moon-branch .solar-name { font-size: .55rem; }
.solar-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  background: linear-gradient(180deg, #2e3142, #252838);
  border: 1px solid #3a3d4a;
  border-radius: 8px;
  padding: .35rem .45rem;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  min-width: 52px;
}
.solar-body:hover { border-color: #5a5d6a; }
.solar-body.active {
  border-color: #6c63ff;
  background: linear-gradient(180deg, #3a3570, #2a2550);
  box-shadow: 0 0 8px rgba(108,99,255,.3);
}
.solar-emoji { font-size: 1.1rem; line-height: 1; }
.solar-name { font-size: .65rem; color: #8b8fa3; white-space: nowrap; }
.solar-body.active .solar-name { color: #d0d4e0; }
.solar-moon { min-width: 36px; }
.solar-moon .solar-emoji { font-size: .7rem; }

.solar-system .convert-body {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #3a3d4a;
}
.moon-toggle {
  font-size: .5rem;
  color: #6c63ff;
  margin-left: .2rem;
}

/* Convert body */
#standard-convert {
  display: flex;
  flex-direction: column;
}
.convert-body {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.planet-mass-unit {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .6rem;
  flex-wrap: wrap;
}
.mass-label { font-size: .8rem; color: #8b8fa3; flex-shrink: 0; }
.convert-side { flex: 1; }
.convert-val { font-size: 1.1rem; text-align: center; margin-bottom: .5rem; }
.convert-result {
  background: linear-gradient(180deg, #c8d4b8, #b8c4a8) !important;
  color: #1a2a1a !important;
  border-color: #8a9a7a !important;
  font-weight: 700;
}
.swap-btn {
  background: linear-gradient(180deg, #6c63ff, #5a52e0);
  color: #fff;
  border: 1px solid #7b73ff;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  margin-top: .3rem;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(108,99,255,.3);
  transition: transform .2s;
}
.swap-btn:hover { transform: rotate(180deg); }

/* Unit drum selectors */
.unit-chips { display: none; }
.convert-drums {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  width: 100%;
}
.drum-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.drum-label { font-size: .8rem; color: #8b8fa3; margin-bottom: .3rem; font-weight: 600; }
.drum-container {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: linear-gradient(180deg, #1a1d28, #22253a);
  border: 1px solid #3a3d4a;
  border-radius: 8px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.3);
}
.drum-container::before, .drum-container::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 50px;
  z-index: 2;
  pointer-events: none;
}
.drum-container::before { top: 0; background: linear-gradient(180deg, #1a1d28, transparent); }
.drum-container::after { bottom: 0; background: linear-gradient(0deg, #1a1d28, transparent); }
.drum-highlight {
  position: absolute;
  top: 50%;
  left: 0; right: 0;
  height: 36px;
  transform: translateY(-50%);
  background: rgba(108,99,255,.12);
  border-top: 1px solid #6c63ff;
  border-bottom: 1px solid #6c63ff;
  z-index: 1;
  pointer-events: none;
}
.drum-scroll {
  position: relative;
  z-index: 1;
  padding: 62px 0;
  transition: transform .2s ease;
}
.drum-item {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  color: #6b6f82;
  cursor: pointer;
  transition: color .15s;
  user-select: none;
}
.drum-item.active { color: #e1e4ed; font-weight: 700; font-size: 1rem; }
.drum-item:hover { color: #a0a4b8; }

/* Output row below drums */
.convert-output-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1rem;
}
.convert-output-row input { flex: 1; font-size: 1.1rem; text-align: center; }
.convert-equals {
  font-size: 1.2rem;
  color: #6c63ff;
  font-weight: 700;
  flex-shrink: 0;
}
.calc-result {
  margin-top: .75rem;
  padding: .6rem .75rem;
  background: linear-gradient(180deg, #c8d4b8, #b8c4a8);
  border-radius: 6px;
  font-size: .85rem;
  color: #1a2a1a;
  border: 1px solid #8a9a7a;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.15);
}
.calc-result strong { color: #0a1a0a; }
.calc-result p { color: #1a2a1a; margin-bottom: .3rem; }

/* Data Viz */
.dataviz-container { max-width: 800px; }
.dataviz-url-section { margin-bottom: 1rem; }
.dataviz-url-section label { display: block; font-size: .9rem; margin-bottom: .4rem; color: var(--text); }
.url-input-row { display: flex; gap: .5rem; }
.url-input-row input {
  flex: 1;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
}
.url-input-row input:focus { border-color: var(--accent); outline: none; }
.crawl-status { font-size: .85rem; color: var(--muted); margin-top: .4rem; }

.source-list { margin-bottom: 1rem; }
.source-list h3 { font-size: .9rem; color: var(--text); margin-bottom: .5rem; }
#source-items { display: flex; flex-direction: column; gap: .35rem; max-height: 250px; overflow-y: auto; }
.source-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .4rem .7rem;
  font-size: .85rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color .2s;
}
.source-item:hover { border-color: var(--accent); }
.source-ext {
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.dataviz-upload {
  text-align: center;
  padding: 2rem;
  border: 2px dashed var(--border);
  border-radius: 12px;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: border-color .2s;
}
.dataviz-upload:hover { border-color: var(--accent); }
.upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.upload-hint { font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.dataviz-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 1.5rem; }
.chart-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}
.dataviz-summary { margin-top: 1rem; font-size: .9rem; color: var(--text); }

/* Data Chat */
.data-chat {
  margin-top: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
}
.data-chat h3 { font-size: .95rem; color: var(--accent); margin-bottom: .5rem; }
.data-chat-messages {
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: .5rem;
}
.data-chat-input-col {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.data-chat-input-col input {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
  outline: none;
}
.data-chat-input-col input:focus { border-color: var(--accent); }
.data-chat-input-col .btn { align-self: flex-start; }

/* Saved datasets */
.saved-datasets { margin-bottom: 1rem; }
.saved-datasets h3 { font-size: .9rem; color: var(--text); margin-bottom: .5rem; }
.saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .7rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: .35rem;
}
.saved-label { font-size: .9rem; color: var(--text); font-weight: 500; }
.saved-meta { display: block; font-size: .75rem; color: var(--muted); }
.saved-actions { display: flex; gap: .3rem; }

/* Save dataset */
.save-dataset { margin-bottom: 1rem; }
.save-row { display: flex; gap: .5rem; }
.save-row input {
  flex: 1;
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
}
.save-row input:focus { border-color: var(--accent); outline: none; }

/* Column mapping */
.column-map-section { margin: 1rem 0; }
.column-map-section h3 { font-size: .9rem; color: var(--text); margin-bottom: .25rem; }
.map-hint { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.schema-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .75rem;
  margin-bottom: .75rem;
  overflow-x: auto;
  display: block;
}
.schema-table th, .schema-table td {
  padding: .25rem .4rem;
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schema-table th { background: var(--surface); font-weight: 600; }
.col-map-form { display: flex; flex-direction: column; gap: .3rem; }
.col-map-row { display: flex; align-items: center; gap: .5rem; }
.col-map-name { font-size: .85rem; color: var(--text); min-width: 140px; }
.col-map-name small { color: var(--muted); }
.col-map-select {
  padding: .25rem .4rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: .8rem;
}
.map-warning {
  color: var(--warning);
  font-size: .85rem;
  margin-bottom: .5rem;
  padding: .4rem .6rem;
  background: rgba(251, 191, 36, 0.1);
  border-radius: 6px;
}

/* Calendar */
.calendar-container { max-width: 700px; }
.calendar-connect { text-align: center; padding: 2rem; }
.calendar-connect p { margin-bottom: 1rem; }
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-weight: 600;
  color: var(--text);
}
.admin-sync {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: .75rem;
}
.sync-status { font-size: .8rem; color: var(--muted); }
.btn-sm {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .3rem .7rem;
  cursor: pointer;
  font-size: .9rem;
}
.btn-sm:hover { border-color: var(--accent); }
.cal-grid { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-row { display: grid; grid-template-columns: 70px repeat(5, 1fr); }
.cal-header-row { background: var(--surface); }
.cal-cell {
  padding: .4rem .3rem;
  text-align: center;
  font-size: .8rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--text);
}
.cal-cell:last-child { border-right: none; }
.cal-time { font-size: .75rem; color: var(--muted); background: var(--surface); }
.cal-day-header { font-weight: 600; font-size: .8rem; }
.cal-slot { min-height: 28px; }
.cal-free { background: rgba(52, 211, 153, 0.15); }
.cal-busy { background: rgba(248, 113, 113, 0.1); }
.cal-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: .75rem;
  font-size: .8rem;
  color: var(--muted);
}
.cal-free-dot, .cal-busy-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: .3rem;
  vertical-align: middle;
}
.cal-free-dot { background: var(--success); }
.cal-busy-dot { background: var(--critical); }

/* Booking form */
.booking-form {
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
}
.booking-form h3 { font-size: 1rem; margin-bottom: .25rem; color: var(--accent); }
.booking-slot { font-size: .9rem; color: var(--text); margin-bottom: .75rem; }
.booking-form input {
  display: block;
  width: 100%;
  padding: .45rem .65rem;
  margin-bottom: .5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .9rem;
}
.booking-form input:focus { border-color: var(--accent); outline: none; }
.booking-actions { display: flex; gap: .5rem; margin-top: .5rem; }
.booking-result { margin-top: .5rem; }
.booking-success { color: var(--success); font-size: .9rem; }
.booking-error { color: var(--critical); font-size: .9rem; }
.cal-free:hover { background: rgba(52, 211, 153, 0.35); }

/* Wizard */
.wizard-container { max-width: 680px; margin: 0 auto; }
.wizard-steps { margin-top: 1.5rem; }
.wizard-step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: .75rem;
  overflow: hidden;
  transition: opacity .3s;
}
.wizard-step:not(.active):not(.completed) {
  opacity: 0.4;
  pointer-events: none;
}
.wizard-step.completed { opacity: 0.6; }
.wizard-step.completed .step-body { display: none; }
.wizard-step.completed .step-num { background: var(--success); }
.step-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-header h2 { font-size: 1rem; margin: 0; color: var(--text); }
.step-body {
  padding: 0 1rem 1rem 3.25rem;
}
.step-instructions {
  list-style: decimal;
  padding-left: 1.2rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  color: var(--text);
  line-height: 1.7;
}
.step-instructions a { color: var(--accent); }
.wizard-code {
  display: inline-block;
  background: var(--bg);
  padding: .2rem .5rem;
  border-radius: 4px;
  font-family: monospace;
  font-size: .85rem;
  color: var(--accent);
  margin: .25rem 0;
  word-break: break-all;
}
.copy-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: .15rem .5rem;
  font-size: .75rem;
  cursor: pointer;
  margin-left: .3rem;
  vertical-align: middle;
}
.upload-form {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: .75rem;
}
.file-name { font-size: .85rem; color: var(--muted); }
.wizard-done {
  text-align: center;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: 10px;
  margin-top: 1rem;
}
.done-check {
  display: inline-block;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 1.5rem;
  line-height: 48px;
  margin-bottom: .75rem;
}
.wizard-done h2 { color: var(--success); margin-bottom: .5rem; }

/* LookingGlass */
.lg-container { max-width: 1200px; margin: 0 auto; }
.lg-header { text-align: center; margin-bottom: 1rem; }
.lg-header h1 { font-size: 2rem; margin-bottom: .25rem; }
.lg-header p { color: var(--muted); font-size: .95rem; }

.lg-search {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.lg-search input {
  flex: 1;
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}
.lg-search input:focus { border-color: var(--accent); outline: none; }

.lg-main {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 768px) { .lg-main { grid-template-columns: 1fr; } }

.lg-map-col { min-width: 0; }
#lg-map {
  width: 100%;
  height: 400px;
  border-radius: 10px;
  border: 1px solid var(--border);
  z-index: 1;
}

.lg-timeline {
  margin-top: .75rem;
  padding: 0 .25rem;
}
#lg-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(90deg, #8b4513, #cd853f, #228b22, #4682b4, #6c63ff);
  border-radius: 3px;
  outline: none;
}
#lg-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
}
.lg-eras {
  display: flex;
  justify-content: space-between;
  margin-top: .3rem;
}
.lg-era-tick {
  font-size: .6rem;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s;
}
.lg-era-tick:hover { color: var(--text); }

.lg-narrative-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  max-height: 500px;
  overflow-y: auto;
}
.lg-era-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: .5rem;
}
.lg-era-desc {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .75rem;
  font-style: italic;
}
.lg-narrative p {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: .75rem;
}
.lg-section-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1rem 0 .4rem;
  padding-bottom: .2rem;
  border-bottom: 1px solid var(--border);
}
.lg-section-title:first-of-type { margin-top: .25rem; }
.lg-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
  transition: opacity .2s;
}
.lg-link:hover { opacity: .8; }
.lg-placeholder { color: var(--muted); font-style: italic; }
.lg-loading { color: var(--accent); }

/* Contact */
.contact-container { max-width: 600px; margin: 0 auto; }
.contact-container h1 { margin-bottom: .25rem; }
.contact-container > p { margin-bottom: 1.5rem; }
.contact-form label {
  display: block;
  font-size: .85rem;
  color: var(--text);
  margin: .75rem 0 .25rem;
}
.contact-form input, .contact-form textarea {
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--accent); outline: none; }
.contact-form textarea { resize: vertical; }
.contact-form .btn { margin-top: 1rem; }
.contact-result { margin-top: .75rem; }
.contact-success { color: var(--success); font-size: .9rem; }
.contact-error { color: var(--critical); font-size: .9rem; }

/* Home / Musings */
.home-hero { text-align: center; margin-bottom: 2rem; }
.home-hero h1 { font-size: 2.2rem; margin-bottom: .5rem; }
.home-tagline { font-size: 1.05rem; color: var(--text); max-width: 600px; margin: 0 auto; line-height: 1.6; }

.musing-compose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.musing-compose textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: .6rem .75rem;
  font-size: .95rem;
  resize: vertical;
  font-family: inherit;
}
.musing-compose textarea:focus { border-color: var(--accent); outline: none; }
.musing-compose-footer {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
  align-items: center;
}
.musing-compose-footer input {
  flex: 1;
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .85rem;
}

.musing-feed { max-width: 700px; margin: 0 auto; }
.musing-empty, .musing-loading { color: var(--muted); text-align: center; font-style: italic; }

.musing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: border-color .2s;
}
.musing-card:hover { border-color: var(--accent); }
.musing-topline {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
  flex-wrap: wrap;
}
.musing-timestamp { font-size: .7rem; color: var(--muted); }
.musing-reply-count { font-size: .7rem; color: var(--accent); }
.musing-content {
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: .6rem;
  white-space: pre-wrap;
}
.musing-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}
.musing-time { font-size: .75rem; color: var(--muted); }
.musing-tag {
  font-size: .7rem;
  background: rgba(108,99,255,.15);
  color: var(--accent);
  padding: .1rem .4rem;
  border-radius: 10px;
}

.musing-reactions {
  display: flex;
  gap: .3rem;
  margin-bottom: .5rem;
}
.reaction-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: .2rem .5rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text);
  transition: border-color .2s;
}
.reaction-btn:hover { border-color: var(--accent); }
.reaction-btn span { font-size: .7rem; color: var(--muted); }

.musing-responses { margin-bottom: .5rem; }
.musing-response {
  padding: .5rem .75rem;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: .3rem;
  font-size: .85rem;
}
.response-author { font-weight: 600; color: var(--text); margin-right: .4rem; }
.response-time { font-size: .7rem; color: var(--muted); }
.musing-response p { margin: .2rem 0 0; color: var(--text); }

.musing-reply-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-size: .8rem;
  cursor: pointer;
  padding: 0;
}
.musing-reply-toggle:hover { text-decoration: underline; }

.musing-admin {
  display: flex;
  gap: .3rem;
  margin-bottom: .4rem;
}
.musing-edit-btn, .musing-delete-btn {
  background: none;
  border: none;
  font-size: .75rem;
  cursor: pointer;
  padding: 0;
}
.musing-edit-btn { color: var(--accent); }
.musing-edit-btn:hover { text-decoration: underline; }
.musing-delete-btn { color: var(--critical); }
.musing-delete-btn:hover { text-decoration: underline; }
.musing-edited { font-size: .7rem; color: var(--muted); font-style: italic; }
.musing-edit-textarea {
  width: 100%;
  min-height: 60px;
  padding: .5rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
  resize: vertical;
  margin-bottom: .4rem;
}
.musing-edit-actions { display: flex; gap: .3rem; }

.musing-reply-form {
  margin-top: .5rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.musing-reply-form input, .musing-reply-form textarea {
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
}
.musing-reply-form input:focus, .musing-reply-form textarea:focus { border-color: var(--accent); outline: none; }
.reply-submit { align-self: flex-start; }

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--muted);
  font-size: .8rem;
  border-top: 1px solid var(--border);
}

/* ========== RESPONSIVE / MOBILE ========== */
@media (max-width: 768px) {
  /* Nav */
  .nav-inner { height: auto; flex-wrap: wrap; padding: .5rem 0; gap: .3rem; }
  nav ul { gap: .75rem; flex-wrap: wrap; }
  nav { padding: 0 1rem; }

  /* Main */
  main { padding: 1.5rem 1rem; }
  h1 { font-size: 1.5rem; }

  /* About page */
  .about-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .brain-col { position: static; order: -1; }
  #brain-container { max-height: 280px; }
  .timeline-item { padding: .75rem 1rem; }
  #brain-chat { margin-top: .5rem; }
  #chat-messages { max-height: 180px; }

  /* Projects tabs */
  .project-tabs { flex-wrap: wrap; gap: .3rem; }
  .project-tab { padding: .4rem .8rem; font-size: .8rem; }

  /* Calculator */
  #panel-calculator > .calc-landscape {
    flex-direction: column;
    max-width: 100%;
    min-height: auto;
    padding: .75rem;
  }
  .calc-tabs {
    flex-direction: row;
    width: 100%;
    flex-wrap: wrap;
    gap: .25rem;
    border-right: none;
    border-bottom: 1px solid #3a3d4a;
    margin-right: 0;
    margin-bottom: .75rem;
    padding-right: 0;
    padding-bottom: .5rem;
  }
  .calc-tab { padding: .3rem .5rem; font-size: .7rem; }
  .calc-sci-grid { grid-template-columns: repeat(4, 1fr); gap: .3rem; }
  .calc-btn { padding: .5rem; font-size: .9rem; }
  .calc-display { font-size: 1.4rem; padding: .5rem .75rem; }
  .convert-drums { flex-direction: column; gap: .5rem; }
  .drum-container { height: 120px; }
  .convert-output-row { flex-direction: column; gap: .3rem; }
  .convert-equals { display: none; }

  /* Solar system */
  .solar-strip { overflow-x: auto; flex-wrap: nowrap; }
  .solar-body { min-width: 44px; padding: .25rem .3rem; }
  .solar-emoji { font-size: .85rem; }
  .solar-name { font-size: .55rem; }

  /* Data Viz */
  .dataviz-container { max-width: 100%; }
  .url-input-row { flex-direction: column; }
  .dataviz-charts { grid-template-columns: 1fr; }
  .data-chat-input-col input { font-size: .85rem; }

  /* Calendar */
  .calendar-container { max-width: 100%; }
  .cal-row { grid-template-columns: 50px repeat(5, 1fr); }
  .cal-cell { padding: .25rem .15rem; font-size: .65rem; }
  .cal-time { font-size: .6rem; }
  .booking-form { padding: .75rem; }
  .booking-form input { font-size: .85rem; }

  /* LookingGlass */
  .lg-main { grid-template-columns: 1fr; }
  #lg-map { height: 280px; }
  .lg-search { flex-direction: column; }
  .lg-narrative-col { max-height: 350px; }
  .lg-eras { gap: 0; }
  .lg-era-tick { font-size: .5rem; }

  /* Musings */
  .musing-compose textarea { font-size: .9rem; }
  .musing-compose-footer { flex-direction: column; }
  .musing-card { padding: 1rem; }
  .musing-content { font-size: .9rem; }
  .musing-reactions { flex-wrap: wrap; }

  /* Wizard */
  .wizard-container { max-width: 100%; }
  .step-body { padding: 0 .75rem .75rem 2rem; }

  /* Saved datasets */
  .saved-item { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .saved-actions { width: 100%; }

  /* Schema table */
  .schema-table { font-size: .65rem; }
  .col-map-row { flex-direction: column; align-items: flex-start; gap: .2rem; }
  .col-map-name { min-width: auto; }
}

@media (max-width: 480px) {
  nav ul { gap: .5rem; font-size: .85rem; }
  .logo { font-size: 1rem; }
  main { padding: 1rem .75rem; }
  h1 { font-size: 1.3rem; }
  .home-tagline { font-size: .9rem; }
  .about-hero h1 { font-size: 1.8rem; }
  #brain-container { max-height: 220px; }
  .calc-sci-grid { grid-template-columns: repeat(4, 1fr); }
  .calc-btn { padding: .4rem; font-size: .8rem; }
  .calc-sci { font-size: .65rem; }
  .tuner-label { font-size: .55rem; }
  .chat-msg { font-size: .85rem; }
  .chat-chip { font-size: .75rem; }
  #lg-map { height: 220px; }
}

/* ===== Email Client ===== */
.email-app {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 0;
  height: calc(100vh - 80px);
  margin: -1rem -1rem 0;
}

.email-panel {
  border-right: 1px solid #333;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.email-panel:last-child { border-right: none; }

.email-list-header, .email-ai-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid #333;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #1a1a2e;
}

.email-list-header h2, .email-ai-header h2 {
  margin: 0;
  font-size: 1rem;
  color: #e0e0e0;
}

.email-list-actions {
  display: flex;
  gap: .4rem;
  align-items: center;
}

.email-list-actions select {
  background: #2a2a3e;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  padding: .2rem .4rem;
  font-size: .75rem;
}

.btn-sm {
  background: #2a2a3e;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  padding: .25rem .5rem;
  font-size: .75rem;
  cursor: pointer;
}

.btn-sm:hover { background: #3a3a4e; }

.btn-primary {
  background: #4a6cf7;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: .4rem 1rem;
  font-size: .85rem;
  cursor: pointer;
}

.btn-primary:hover { background: #5a7cf7; }
.btn-primary:disabled { opacity: .5; cursor: default; }

.email-thread-list { flex: 1; overflow-y: auto; }

.email-thread-item {
  padding: .6rem 1rem;
  border-bottom: 1px solid #2a2a3e;
  cursor: pointer;
  transition: background .15s;
}

.email-thread-item:hover { background: #2a2a3e; }
.email-thread-item.active { background: #2a2a4e; border-left: 3px solid #4a6cf7; }
.email-thread-item.unread .thread-from,
.email-thread-item.unread .thread-subject { font-weight: 700; color: #fff; }

.thread-from {
  font-size: .85rem;
  color: #ccc;
  margin-bottom: .15rem;
}

.thread-subject {
  font-size: .8rem;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-count { color: #4a6cf7; font-size: .75rem; }

.thread-preview {
  font-size: .72rem;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: .15rem;
}

.thread-date {
  font-size: .7rem;
  color: #666;
  margin-top: .15rem;
}

.email-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666;
  font-size: .9rem;
}

.email-view-content {
  flex-direction: column;
  height: 100%;
}

.email-thread-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
  background: #1a1a2e;
}

.email-thread-header h2 {
  margin: 0 0 .25rem;
  font-size: 1rem;
  color: #e0e0e0;
}

.thread-msg-count { font-size: .75rem; color: #888; }

.email-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: .5rem;
}

.email-message {
  border: 1px solid #333;
  border-radius: 6px;
  margin-bottom: .5rem;
  background: #1e1e30;
}

.email-msg-header {
  padding: .5rem .75rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  user-select: none;
}

.email-msg-header:hover { background: #2a2a3e; border-radius: 6px; }

.msg-from { font-size: .85rem; color: #ddd; flex: 1; }
.msg-date { font-size: .72rem; color: #888; }
.msg-attach-icon { font-size: .8rem; }

.email-message.collapsed .email-msg-body { display: none; }
.email-message.expanded .email-msg-body { display: block; }

.email-msg-body { padding: .5rem .75rem; }

.msg-meta {
  font-size: .72rem;
  color: #888;
  margin-bottom: .5rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid #2a2a3e;
}

.msg-meta div { margin-bottom: .15rem; }

.msg-content {
  font-size: .85rem;
  color: #ccc;
  line-height: 1.5;
  word-break: break-word;
  overflow-x: auto;
}

.msg-content img { max-width: 100%; height: auto; }

.msg-attachments {
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid #2a2a3e;
  font-size: .8rem;
}

.attachment-link {
  display: inline-block;
  margin: .2rem .5rem .2rem 0;
  color: #4a6cf7;
  text-decoration: none;
}

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

/* Reply section */
.email-reply-section {
  flex-shrink: 0;
  border-top: 1px solid #333;
  padding: .75rem;
  background: #1a1a2e;
}

.email-reply-section h3 {
  margin: 0 0 .5rem;
  font-size: .9rem;
  color: #ccc;
}

.email-reply-editor {
  min-height: 120px;
  max-height: 250px;
  overflow-y: auto;
  background: #2a2a3e;
  border: 1px solid #444;
  border-radius: 4px;
  padding: .5rem;
  color: #ddd;
  font-size: .85rem;
  line-height: 1.5;
  outline: none;
}

.email-reply-editor:focus { border-color: #4a6cf7; }

.email-reply-toolbar {
  display: flex;
  gap: .25rem;
  margin-top: .4rem;
  flex-wrap: wrap;
}

.toolbar-btn {
  background: #2a2a3e;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 3px;
  padding: .2rem .4rem;
  font-size: .75rem;
  cursor: pointer;
  min-width: 28px;
  text-align: center;
}

.toolbar-btn:hover { background: #3a3a4e; }

.attach-btn { display: inline-flex; align-items: center; gap: .2rem; cursor: pointer; }

.reply-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .3rem;
}

.reply-att-chip {
  background: #2a2a3e;
  border: 1px solid #444;
  border-radius: 12px;
  padding: .15rem .5rem;
  font-size: .72rem;
  color: #ccc;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.reply-att-chip button {
  background: none;
  border: none;
  color: #f66;
  cursor: pointer;
  font-size: .8rem;
  padding: 0;
}

.email-reply-actions {
  display: flex;
  gap: .5rem;
  margin-top: .5rem;
}

/* AI Panel */
.email-ai-content {
  flex: 1;
  overflow-y: auto;
  padding: .75rem;
}

.ai-result { color: #ccc; }

.ai-section {
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid #2a2a3e;
}

.ai-section:last-child { border-bottom: none; }

.ai-section h3 {
  font-size: .85rem;
  color: #4a6cf7;
  margin: 0 0 .4rem;
}

.ai-section p, .ai-section li {
  font-size: .8rem;
  line-height: 1.5;
  color: #bbb;
}

.ai-section ul {
  margin: .3rem 0;
  padding-left: 1.2rem;
}

.ai-suggestion {
  background: #2a2a3e;
  border: 1px solid #444;
  border-radius: 4px;
  padding: .5rem;
  font-size: .8rem;
  color: #ddd;
  line-height: 1.5;
  margin-bottom: .4rem;
  white-space: pre-wrap;
}

.ai-use-btn { margin-top: .3rem; }

.ai-no-response { color: #666; font-style: italic; }

.ai-thinking {
  text-align: center;
  color: #4a6cf7;
  animation: pulse 1.5s ease-in-out infinite;
}

.email-loading {
  padding: 2rem;
  text-align: center;
  color: #666;
  font-size: .85rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .email-app {
    grid-template-columns: 250px 1fr;
  }
  .email-ai-panel { display: none; }
}

@media (max-width: 768px) {
  .email-app {
    grid-template-columns: 1fr;
    height: auto;
  }
  .email-list-panel { max-height: 40vh; }
  .email-view-panel { min-height: 50vh; }
  .email-ai-panel { display: none; }
}

/* ===== Ideas ===== */
.ideas-container { max-width: 700px; margin: 0 auto; }
.ideas-container h1 { margin-bottom: .25rem; }
.ideas-container > p { margin-bottom: 1.5rem; color: var(--text); }

.idea-form label {
  display: block;
  font-size: .85rem;
  color: var(--text);
  margin: .75rem 0 .25rem;
}

.idea-form input, .idea-form textarea, .idea-form select {
  width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  font-family: inherit;
}

.idea-form input:focus, .idea-form textarea:focus { border-color: var(--accent); outline: none; }
.idea-form textarea { resize: vertical; }
.idea-form .btn { margin-top: 1rem; }
.idea-status { margin-top: .75rem; }
.idea-success { color: var(--success); font-size: .9rem; }
.idea-error { color: var(--critical); font-size: .9rem; }

.idea-prototype-section { margin-top: 2rem; }
.idea-proto-note { font-size: .8rem; color: var(--muted); margin-bottom: .75rem; }

.idea-prototype-frame {
  background: #1e1e30;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1rem;
  overflow: auto;
  max-height: 500px;
}

.idea-proto-toggle { margin-top: .5rem; }
.idea-proto-toggle summary {
  cursor: pointer;
  color: var(--accent);
  font-size: .85rem;
}

/* Published ideas */
.ideas-published { margin-top: 3rem; }
.ideas-published h2 { margin-bottom: 1rem; }

.idea-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.idea-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .4rem;
}

.idea-card-title { font-size: 1rem; font-weight: 600; color: var(--text); }
.idea-card-badge {
  background: var(--accent);
  color: #fff;
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 10px;
}

.idea-card-desc { font-size: .85rem; color: var(--muted); margin-bottom: .4rem; }
.idea-card-meta { font-size: .75rem; color: #666; }

/* Admin */
.ideas-admin-container { max-width: 900px; margin: 0 auto; }
.ideas-filter { display: flex; gap: .4rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.idea-admin-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.idea-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .3rem;
}

.idea-admin-title { font-size: 1rem; font-weight: 600; color: var(--text); }

.idea-status-badge {
  font-size: .7rem;
  padding: .15rem .5rem;
  border-radius: 10px;
  text-transform: uppercase;
}

.status-submitted { background: #555; color: #ccc; }
.status-reviewed { background: #4a6cf7; color: #fff; }
.status-published { background: #22c55e; color: #fff; }
.status-rejected { background: #ef4444; color: #fff; }

.idea-admin-meta { font-size: .75rem; color: #888; margin-bottom: .4rem; }
.idea-admin-desc { font-size: .85rem; color: var(--text); margin-bottom: .5rem; }

.idea-admin-actions {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: .5rem;
}

.idea-status-select {
  background: #2a2a3e;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  padding: .25rem .4rem;
  font-size: .75rem;
}

.idea-notes-input {
  flex: 1;
  min-width: 150px;
  background: #2a2a3e;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  padding: .25rem .5rem;
  font-size: .75rem;
}

/* ===== Project Tiles ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.project-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: transform .15s, border-color .15s, box-shadow .15s;
  text-align: center;
}

.project-tile:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(74, 108, 247, .15);
}

.tile-icon { font-size: 2.2rem; margin-bottom: .6rem; }
.tile-title { font-size: 1.05rem; font-weight: 600; color: var(--text); margin-bottom: .35rem; }
.tile-desc { font-size: .8rem; color: var(--muted); line-height: 1.4; }

.projects-back {
  margin: 1rem 0 .5rem;
}

@media (max-width: 480px) {
  .projects-grid { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .project-tile { padding: 1rem; }
  .tile-icon { font-size: 1.6rem; }
  .tile-title { font-size: .9rem; }
  .tile-desc { font-size: .7rem; }
}

.ideas-admin-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; }
.ideas-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Test Results Modal */
.test-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.test-modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.test-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.test-modal-header h3 { margin: 0; font-size: 1rem; color: var(--text); }

.test-detail-output {
  flex: 1;
  overflow: auto;
  padding: 1rem;
  font-family: monospace;
  font-size: .8rem;
  color: #ccc;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.email-iframe {
  width: 100%;
  min-height: 200px;
  border: none;
  background: #fff;
  border-radius: 4px;
}
