/* ---- CSS RESET (tiny) ---- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: radial-gradient(1200px 800px at 10% -20%, #2a2a4a33, transparent), radial-gradient(1000px 700px at 110% 0%, #1b6b7a22, transparent), var(--bg); }

/* ---- THEME ---- */
:root {
  --bg: #0f1117;
  --surface: #151826;
  --glass: #14182a99;
  --text: #edf2f7;
  --text-dim: #a0aec0;
  --brand: #7aa2f7;
  --accent: #22d3ee;
  --ok: #4ade80;
  --danger: #fb7185;
  --shadow: 0 10px 30px #0006;
}
:root.light {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --glass: #ffffffcc;
  --text: #0f172a;
  --text-dim: #475569;
  --brand: #3b82f6;
  --accent: #06b6d4;
  --ok: #16a34a;
  --danger: #e11d48;
  --shadow: 0 12px 28px #2c3e5033;
}

/* ---- LAYOUT ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 22px; }
.site-header, .site-footer { display:flex; justify-content:space-between; align-items:center; padding: 16px 22px; position: sticky; top:0; backdrop-filter: blur(8px); background: linear-gradient(180deg, var(--glass), transparent); z-index: 10; }
.site-footer { position: static; border-top: 1px solid #ffffff18; gap: 10px; color: var(--text-dim); }
.site-footer .sep { opacity:.3; }
.brand { display:flex; align-items:center; gap: 12px; }
.brand .logo { width: 36px; height: 36px; display:grid; place-items:center; background: linear-gradient(135deg, var(--brand), var(--accent)); color:white; border-radius: 10px; box-shadow: var(--shadow); }
.brand h1 { margin: 0; font-size: 1.25rem; }
.brand .tagline { margin:0; color: var(--text-dim); font-size: .9rem; }
.header-actions { display:flex; gap: 8px; }

.hero { padding: 24px; border-radius: 16px; background: linear-gradient(180deg, var(--glass), transparent); border: 1px solid #ffffff22; box-shadow: var(--shadow); }
.hero h2 { margin-top:0; font-size: 1.6rem; }
.hero .hero-actions { display:flex; flex-wrap: wrap; gap: 10px; }

.panel { margin-top: 28px; }
.tabs { display:flex; gap: 6px; flex-wrap: wrap; margin-bottom:12px; }
.tab { background: var(--surface); border: 1px solid #ffffff1a; color: var(--text-dim); padding: 8px 12px; border-radius: 10px; cursor:pointer; }
.tab.active { color: var(--text); box-shadow: inset 0 0 0 1px #ffffff20, 0 6px 16px #0003; }
.tabpanel { display:none; }
.tabpanel.active { display:block; }

.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid #ffffff18; border-radius: 14px; padding: 16px; box-shadow: var(--shadow); }
.muted { color: var(--text-dim); font-size:.9rem; }
.actions { display:flex; gap: 8px; flex-wrap: wrap; }

.table-wrap { background: var(--surface); border:1px solid #ffffff18; border-radius:14px; padding:10px; box-shadow: var(--shadow); }
table { width:100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px dashed #ffffff15; text-align:left; }
thead th { color: var(--text-dim); font-weight:600; }
tbody tr:hover { background: #ffffff08; }

.toolbar { display:flex; align-items:center; gap: 10px; margin-bottom: 10px; }
input { width: 100%; padding: 10px 12px; background: #0b0e16; color: var(--text); border: 1px solid #ffffff22; border-radius: 10px; outline: none; }
:root.light input { background: #f2f5fb; border-color: #0000001a; }

.gallery { display:grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid #ffffff1a; border-radius: 12px; overflow: hidden; display:flex; flex-direction:column; }
.tile img { aspect-ratio: 4/3; width:100%; height:auto; object-fit:cover; }
.tile .tile-body { padding: 10px; display:flex; justify-content:space-between; align-items:center; gap:10px; }

.console { min-height: 160px; background: #05070d; color: #a6e3a1; border: 1px solid #ffffff22; border-radius: 10px; padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow:auto; }
.console-input { display:flex; gap: 8px; margin-top: 8px; }

/* Buttons */
.btn { padding: 10px 12px; border-radius: 10px; border:1px solid #ffffff2a; background: var(--surface); color: var(--text); cursor:pointer; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--accent)); border-color: transparent; color: white; }
.btn.ghost { background: transparent; border-color: #ffffff3a; }
.btn:active { transform: translateY(1px); }

/* Canvas tweak */
#chart { width: 100%; height: auto; display:block; border-radius: 10px; background: #0b1020; border:1px solid #ffffff10; box-shadow: inset 0 0 0 1px #0006; }

/* Dialog */
dialog { width: min(560px, 92vw); border: 1px solid #ffffff33; border-radius: 14px; padding: 16px 18px; background: var(--surface); color: var(--text); }
dialog::backdrop { background: #0008; }

/* Utility */
.right { display:flex; justify-content:flex-end; }
.glass { backdrop-filter: blur(8px); }

/* ---- SRS BAR (if used later) ---- */
.reps-indicator { display:flex; align-items:center; gap:10px; margin-top: 8px; }
.reps-indicator .reps-label { font-size:.9rem; color: var(--text-dim); min-width: 50px; }
.reps-indicator .reps-bar { display:inline-flex; gap:6px; }
.reps-indicator .seg { width:22px; height:8px; border-radius:6px; background: rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.12); }
.reps-indicator .seg.active { background: linear-gradient(135deg, var(--brand), var(--accent)); border-color: rgba(255,255,255,.18); }
.reps-indicator .seg.done { background: var(--ok); border-color: rgba(255,255,255,.18); }

/* Small screens */
@media (max-width:680px){
  .site-header { position: sticky; }
}
