:root {
  --white: #fff;
  --paper: #f6f7fb;
  --navy: #1b373d;
  --teal: #405356;
  --light-blue: #b4c1c3;
  --red: #d31316;
  --orange: #f97316;
  --muted: #64748b;
  --border: #d8d8d8;
  --shadow: 0 20px 60px rgb(20 35 55 / 16%);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(145deg, var(--navy), var(--teal));
  color: var(--navy);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }

.portal-shell {
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 100px rgb(0 0 0 / 28%);
}

.topbar {
  min-height: 108px;
  padding: 24px 42px;
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--navy);
  color: var(--white);
}

.topbar h1, .topbar p, h2, p { margin: 0; }
.topbar h1 { font-size: 2.2rem; letter-spacing: -.05em; }
.topbar p { color: var(--light-blue); }

.home-button, .logout-button {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--light-blue);
  border-radius: 999px;
  color: var(--white);
  font-weight: 900;
}

.logout-button { margin-left: auto; }

.notice {
  margin: 28px 42px 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: #fff0f0;
  color: var(--red);
  font-weight: 800;
}

.auth-grid, .dashboard-grid {
  padding: 42px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.panel, .dashboard-hero {
  padding: 28px;
  border-radius: 18px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.panel h2, .dashboard-hero h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
  letter-spacing: -.055em;
}

.accent-panel { border-top: 8px solid var(--red); }

label {
  margin: 14px 0 6px;
  display: block;
  color: var(--teal);
  font-weight: 900;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
}

input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  accent-color: var(--red);
}

button, .quick-actions a {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: var(--white);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

button:disabled {
  opacity: .45;
  cursor: default;
}

form > button { margin-top: 18px; width: 100%; }

.preference-form {
  margin-bottom: 18px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--paper);
}

.checkbox-row {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--navy);
}

.checkbox-row span {
  display: grid;
  gap: 3px;
}

.checkbox-row small {
  color: var(--muted);
}

.dashboard-hero {
  margin: 42px 42px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.dashboard-hero p:not(.kicker) {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.5;
}

.kicker {
  margin-bottom: 8px;
  color: var(--red);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.quick-actions {
  min-width: 210px;
  display: grid;
  gap: 12px;
}

.quick-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.list-row, .result-row {
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.result-row-button {
  width: 100%;
  min-height: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--navy);
  text-align: left;
}

.result-row-button:hover,
.result-row-button:focus-visible {
  background: var(--paper);
}

.list-row button {
  min-height: 38px;
  padding: 0 14px;
  background: var(--navy);
}

.list-row strong, .result-row strong { display: block; }
.list-row small, .result-row small, .muted { color: var(--muted); }

.inline-form {
  margin-top: 20px;
  padding-top: 6px;
}

.results-panel {
  grid-column: 1 / -1;
}

.result-row b {
  font-size: 1.4rem;
  color: var(--red);
}

.result-dialog {
  width: min(92vw, 760px);
  max-height: 86vh;
  padding: 28px;
  border: 0;
  border-radius: 18px;
  color: var(--navy);
  box-shadow: 0 30px 90px rgb(0 0 0 / 34%);
}

.result-dialog::backdrop {
  background: rgb(27 55 61 / 62%);
}

.dialog-close {
  width: 42px;
  min-height: 42px;
  margin: 0;
  padding: 0;
  position: absolute;
  right: 18px;
  top: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  font-size: 1.4rem;
}

.dialog-heading {
  padding-right: 52px;
}

.dialog-heading h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -.05em;
}

.dialog-heading p:not(.kicker) {
  color: var(--muted);
  font-weight: 900;
}

.detail-list {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.detail-row {
  padding: 12px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: center;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--paper);
}

.detail-row.correct {
  border-color: var(--teal);
}

.detail-row.incorrect {
  border-color: var(--red);
  background: #fff0f0;
}

.detail-row em {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-style: normal;
  font-weight: 900;
}

.detail-row strong,
.detail-row span span {
  display: block;
}

.detail-row span span {
  margin-top: 3px;
  color: var(--muted);
}

@media (max-width: 860px) {
  .topbar, .dashboard-hero { flex-wrap: wrap; }
  .auth-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .logout-button { margin-left: 0; }
}
