:root {
  color-scheme: light;
  --paper: #fffaf3;
  --surface: #ffffff;
  --ink: #1f1b18;
  --muted: #6b625a;
  --line: #eaded1;
  --accent: #ff2d2d;
  --accent-dark: #111111;
  --gold: #d69a2d;
  --teal: #111111;
  --success: #23724f;
  --danger: #a8342f;
  --shadow: 0 20px 55px rgba(55, 35, 21, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #ffffff;
}

button,
input {
  font: inherit;
}

.site-header {
  padding: 28px 20px 12px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
}

.brand-logo {
  display: block;
  width: min(760px, 100%);
  height: auto;
  max-height: 150px;
  object-fit: contain;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid rgba(31, 27, 24, 0.18);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 24px rgba(31, 27, 24, 0.08);
  font-size: 34px;
  line-height: 1;
}

.brand-name,
.brand-subtitle {
  margin: 0;
}

.brand-name {
  font-size: clamp(1.7rem, 4vw, 2.75rem);
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.18rem);
  font-weight: 700;
}

.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.intro-card,
.card {
  border: 1px solid rgba(234, 222, 209, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.intro-card {
  padding: clamp(24px, 5vw, 42px);
  margin-bottom: 18px;
}

.intro-card h1 {
  max-width: 720px;
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: 0;
}

.intro-card p {
  max-width: 800px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.65;
}

.menu-shell {
  padding-bottom: 56px;
}

.menu-intro {
  margin-bottom: 22px;
}

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

.tool-card {
  position: relative;
  display: flex;
  min-height: 285px;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
  border: 1px solid rgba(234, 222, 209, 0.95);
  border-radius: 8px;
  padding: 24px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.96), rgba(248, 241, 233, 0.9)),
    #fffdf9;
  box-shadow: 0 16px 42px rgba(55, 35, 21, 0.1);
  text-decoration: none;
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

.tool-card::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: -54px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 50%;
  background: rgba(255, 45, 45, 0.08);
}

.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(180, 61, 42, 0.35);
  box-shadow: 0 22px 52px rgba(55, 35, 21, 0.14);
}

.tool-card:focus-visible {
  outline: 3px solid rgba(255, 45, 45, 0.34);
  outline-offset: 4px;
}

.tool-card.is-disabled {
  color: rgba(31, 27, 24, 0.72);
  background:
    linear-gradient(180deg, rgba(250, 247, 242, 0.88), rgba(240, 235, 229, 0.82)),
    #f7f1ea;
}

.tool-card.is-disabled:hover {
  transform: none;
  border-color: rgba(234, 222, 209, 0.95);
  box-shadow: 0 16px 42px rgba(55, 35, 21, 0.1);
}

.tool-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  margin-bottom: 20px;
  border: 2px solid #111111;
  border-radius: 8px;
  color: #111111;
  background: var(--accent);
  box-shadow: 5px 5px 0 #111111;
  font-size: 1.7rem;
  line-height: 1;
}

.tool-status {
  display: inline-flex;
  margin-bottom: 10px;
  border: 1px solid rgba(107, 98, 90, 0.18);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.tool-card h2 {
  margin: 0;
  font-size: clamp(1.32rem, 2vw, 1.75rem);
}

.tool-card p {
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.tool-tags {
  display: inline-flex;
  position: relative;
  z-index: 1;
  margin-bottom: 16px;
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--ink);
  background: rgba(17, 17, 17, 0.07);
  font-size: 0.78rem;
  font-weight: 900;
}

.tool-action {
  position: relative;
  z-index: 1;
  margin-top: auto;
  color: var(--accent-dark);
  font-weight: 900;
}

.tool-card.is-disabled .tool-action {
  color: var(--muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--accent-dark);
  background: rgba(255, 253, 249, 0.78);
  font-weight: 850;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  border-color: rgba(180, 61, 42, 0.45);
  outline: 3px solid rgba(255, 45, 45, 0.28);
  outline-offset: 3px;
}

.card {
  padding: clamp(18px, 3vw, 28px);
  margin-top: 18px;
}

.card-heading {
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-heading .eyebrow {
  color: var(--accent);
}

h2 {
  margin: 4px 0 0;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  letter-spacing: 0;
}

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

fieldset {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

legend {
  padding: 0 6px;
  font-weight: 900;
}

label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-top: 10px;
  color: var(--ink);
  cursor: pointer;
}

input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--ink);
  background: #fffdf9;
  font-weight: 850;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease, background 150ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(180, 61, 42, 0.45);
  box-shadow: 0 10px 24px rgba(55, 35, 21, 0.12);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(255, 45, 45, 0.34);
  outline-offset: 3px;
}

.primary-button {
  border-color: var(--accent);
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.secondary-button {
  margin-top: 18px;
}

.note-display,
.feedback {
  border-radius: 8px;
  padding: 14px 16px;
  line-height: 1.5;
}

.note-display {
  margin: 18px 0;
  color: var(--muted);
  background: rgba(17, 17, 17, 0.06);
}

.feedback {
  min-height: 52px;
  margin: 18px 0 0;
  color: var(--muted);
  background: #fffdf9;
  border: 1px solid var(--line);
  font-weight: 800;
}

.feedback.is-correct {
  color: var(--success);
  border-color: rgba(35, 114, 79, 0.28);
  background: rgba(35, 114, 79, 0.08);
}

.feedback.is-wrong {
  color: var(--danger);
  border-color: rgba(168, 52, 47, 0.28);
  background: rgba(168, 52, 47, 0.08);
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.answer-grid button {
  width: 100%;
  min-height: 52px;
  white-space: normal;
}

.answer-grid button.selected-correct {
  color: #ffffff;
  border-color: var(--success);
  background: var(--success);
}

.answer-grid button.selected-wrong {
  color: #ffffff;
  border-color: var(--danger);
  background: var(--danger);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.score-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 14px;
  background: #fffdf9;
  text-align: center;
}

.score-grid span {
  display: block;
  color: var(--accent-dark);
  font-size: clamp(1.55rem, 4vw, 2.4rem);
  font-weight: 950;
}

.score-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 800;
}

.login-shell,
.admin-shell {
  width: min(900px, calc(100% - 32px));
}

.login-shell {
  display: grid;
  min-height: calc(100vh - 190px);
  place-items: center;
}

.login-card {
  max-width: 720px;
  margin-inline: auto;
  text-align: center;
}

.login-card.intro-card {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.login-card h1,
.login-card p {
  margin-inline: auto;
}

.login-form,
.admin-login {
  display: grid;
  gap: 14px;
  max-width: 460px;
  margin-top: 22px;
}

.login-form {
  margin-inline: auto;
  text-align: center;
}

.login-form button {
  justify-self: center;
  min-width: 180px;
}

.login-form label,
.admin-login label,
.pilot-feedback-form label {
  display: grid;
  gap: 8px;
  min-height: auto;
  margin: 0;
}

.login-form span,
.admin-login span,
.pilot-feedback-form span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form input,
.admin-login input,
.pilot-feedback-form select,
.pilot-feedback-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fffdf9;
  font: inherit;
  font-weight: 800;
}

.login-form input,
.admin-login input {
  min-height: 48px;
  text-transform: uppercase;
}

.login-form p {
  min-height: 24px;
  margin: 0;
  color: var(--danger);
  font-weight: 850;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf9;
}

.admin-item strong,
.admin-item time {
  display: block;
}

.admin-item time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.admin-item p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.admin-item pre {
  overflow: auto;
  margin: 10px 0 0;
  border-radius: 8px;
  padding: 12px;
  background: rgba(17, 17, 17, 0.06);
  color: var(--ink);
  font-size: 0.84rem;
}

.pilot-feedback {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  justify-items: end;
  gap: 10px;
  max-width: min(390px, calc(100vw - 32px));
}

.pilot-feedback-toggle {
  min-height: 42px;
  border: 2px solid #111111;
  padding: 0 14px;
  color: #111111;
  background: var(--accent);
  box-shadow: 4px 4px 0 #111111;
}

.pilot-feedback.is-collapsed .pilot-feedback-toggle {
  width: 42px;
  min-height: 42px;
  border-radius: 50%;
  padding: 0;
  font-size: 1.25rem;
  line-height: 1;
}

.pilot-feedback.is-collapsed {
  max-width: 42px;
}

.pilot-feedback-form {
  display: grid;
  gap: 12px;
  width: min(390px, calc(100vw - 32px));
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 48px rgba(31, 27, 24, 0.18);
}

.pilot-feedback-form[hidden] {
  display: none;
}

.pilot-feedback-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pilot-feedback-heading strong {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 950;
}

.pilot-feedback-tool {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: #fffdf9;
  font-size: 0.92rem;
  font-weight: 850;
}

.pilot-feedback-tool strong {
  color: var(--ink);
}

.pilot-feedback-heading button {
  min-height: 34px;
  width: 34px;
  padding: 0;
}

.pilot-feedback-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.admin-rating {
  display: block;
  margin-top: 4px;
  color: var(--accent-dark);
  font-weight: 900;
}

@media (max-width: 720px) {
  .site-header {
    padding-top: 20px;
  }

  .brand {
    justify-content: center;
  }

  .brand-logo {
    max-height: 96px;
  }

  .settings-grid,
  .tool-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .controls button {
    flex: 1 1 100%;
  }

  .pilot-feedback {
    right: 12px;
    bottom: 12px;
  }
}

@media (min-width: 721px) and (max-width: 980px) {
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
