﻿:root {
  --bg: #0b1020;
  --panel: #141c30;
  --text: #eef3ff;
  --muted: #9fb0cc;
  --primary: #38bdf8;
  --line: #2a3c63;
  --tone-1: #ef4444;
  --tone-2: #f97316;
  --tone-3: #facc15;
  --tone-4: #22c55e;
  --tone-5: #14b8a6;
}

* {
  box-sizing: border-box;
  font-family: Inter, system-ui, sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #20345f, var(--bg) 60%);
  color: var(--text);
}

.app {
  width: min(1100px, 95vw);
  margin: 1.5rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.panel {
  background: rgba(20, 28, 48, 0.95);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
}

.subpanel {
  background: #10182a;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  display: grid;
  gap: 0.6rem;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.tab-btn {
  background: #0f172a;
  color: var(--text);
  border: 1px solid #324a77;
  border-radius: 8px;
  padding: 0.55rem 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  border-color: var(--primary);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.single-auth-form {
  max-width: 520px;
}

.hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.grid-form {
  display: grid;
  gap: 0.7rem;
  max-width: 700px;
}

label {
  font-size: 0.95rem;
  color: var(--muted);
}

input,
select,
button {
  border-radius: 8px;
  border: 1px solid #324a77;
  padding: 0.65rem 0.8rem;
}

input,
select {
  background: #0b1324;
  color: var(--text);
}

button {
  border: 0;
  background: var(--primary);
  color: #04283a;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: #334155;
  color: #dbeafe;
}

button:hover {
  filter: brightness(1.06);
}

.hidden {
  display: none;
}

.message {
  color: var(--muted);
  min-height: 1.2rem;
}

.message.error {
  color: #fecaca;
}

.message.success {
  color: #86efac;
}

.message.highlight {
  color: #86efac;
  font-weight: 700;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.inline-actions {
  display: flex;
  gap: 0.4rem;
}

.progress-wrap {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #0f172a;
  border: 1px solid #334155;
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #14b8a6);
  transition: width 0.2s ease;
}

.options {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.option-btn {
  text-align: left;
  background: #0d162b;
  color: var(--text);
  border: 1px solid #2f436d;
}

.option-btn.correct {
  border-color: var(--tone-4);
  background: rgba(34, 197, 94, 0.15);
}

.option-btn.wrong {
  border-color: var(--tone-1);
  background: rgba(239, 68, 68, 0.15);
}

.feedback {
  margin-top: 0.8rem;
  padding: 0.7rem;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #0f172a;
}

.controls {
  margin-top: 0.8rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.kpi {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 0.6rem;
}

.kpi b {
  display: block;
  font-size: 1.25rem;
}

.kpi.tone-1 b { color: var(--tone-1); }
.kpi.tone-2 b { color: var(--tone-2); }
.kpi.tone-3 b { color: var(--tone-3); }
.kpi.tone-4 b { color: var(--tone-4); }
.kpi.tone-5 b { color: var(--tone-5); }

.chart {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.row {
  display: grid;
  grid-template-columns: minmax(120px, 260px) 1fr 60px;
  align-items: center;
  gap: 0.5rem;
}

.bar-wrap {
  height: 14px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 999px;
  overflow: hidden;
}

.bar {
  height: 100%;
}

.axis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.axis span:nth-child(2),
.axis span:nth-child(3),
.axis span:nth-child(4) {
  text-align: center;
}

.axis span:last-child {
  text-align: right;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border: 1px solid #334155;
  padding: 0.45rem;
  text-align: left;
}

.table th {
  background: #1e293b;
}

.pie-layout {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.pie {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 1px solid #334155;
}

.legend {
  display: grid;
  gap: 0.35rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

.dot.good { background: var(--tone-5); }
.dot.bad { background: var(--tone-1); }

@media (max-width: 640px) {
  .session-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .home-actions {
    grid-template-columns: 1fr;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

@media print {
  body {
    background: white;
    color: black;
  }

  .app {
    width: 100%;
    margin: 0;
  }

  .panel,
  .subpanel {
    border: 1px solid #cbd5e1;
    background: white;
    color: black;
  }

  .no-print,
  #authScreen,
  #startScreen,
  #quizScreen,
  #homeScreen {
    display: none !important;
  }

  #resultsScreen {
    display: block !important;
  }
}

.deck-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}
.button-link {
  display: inline-block;
  border-radius: 8px;
  border: 0;
  background: var(--primary);
  color: #04283a;
  font-weight: 700;
  cursor: pointer;
  padding: 0.65rem 0.8rem;
  text-decoration: none;
}

textarea {
  border-radius: 8px;
  border: 1px solid #324a77;
  padding: 0.65rem 0.8rem;
  background: #0b1324;
  color: var(--text);
  width: 100%;
}

.line-chart {
  width: 100%;
  height: 220px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
  padding: 0.5rem;
}

.line-chart svg {
  width: 100%;
  height: 100%;
}


.title-link {
  background: transparent;
  border: 0;
  color: inherit;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.title-link:hover {
  color: var(--primary);
}

.admin-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.table-sort {
  all: unset;
  cursor: pointer;
  font-weight: 700;
  color: #e2e8f0;
}

.table-sort:hover {
  color: var(--primary);
}

.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.5rem 0 1rem;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}
