:root {
  color-scheme: light;
  --paper: #f5f1e6;
  --paper-strong: #fffdf5;
  --ink: #111111;
  --muted: #5d625f;
  --line: #111111;
  --red: #d83b2d;
  --blue: #155c9f;
  --yellow: #e2b72f;
  --green: #2d8a57;
  --shadow: rgba(0, 0, 0, 0.28);
  font-family:
    Helvetica, Arial, "Univers", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #26353a;
  color: var(--ink);
}

.hidden {
  display: none !important;
}

.home-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(280px, 0.7fr) minmax(360px, 1fr);
  gap: 24px;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 17, 17, 0.08) 1px, transparent 1px),
    var(--paper);
  background-size: 36px 36px;
}

.home-mark {
  align-self: start;
  border-top: 8px solid var(--line);
  padding-top: 16px;
}

.home-mark h1 {
  max-width: 420px;
  font-size: clamp(42px, 7vw, 96px);
  line-height: 0.9;
}

.module-grid {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.module-card {
  display: grid;
  min-height: 190px;
  align-content: start;
  gap: 14px;
  padding: 18px;
  text-align: left;
  background: var(--paper-strong);
  box-shadow: 6px 6px 0 var(--shadow);
}

.module-card span {
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
}

.module-card strong {
  font-size: 30px;
  line-height: 1;
  text-transform: uppercase;
}

.module-card small {
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.module-card.disabled {
  opacity: 0.55;
}

.geography-view {
  display: none;
}

.geography-view.active {
  display: block;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 0 14px;
  background: var(--paper-strong);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

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

input,
select {
  width: 100%;
  min-height: 38px;
  border: 2px solid var(--line);
  border-radius: 0;
  padding: 0 10px;
  background: var(--paper-strong);
  color: var(--ink);
}

#map {
  position: fixed;
  inset: 0;
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  margin-bottom: 12px;
}

.panel {
  position: fixed;
  z-index: 2;
  border: 2px solid var(--line);
  background: rgba(245, 241, 230, 0.94);
  box-shadow: 8px 8px 0 var(--shadow);
}

.map-mode-control {
  position: fixed;
  left: 50%;
  top: 14px;
  z-index: 3;
  display: flex;
  border: 2px solid var(--line);
  background: var(--paper);
  transform: translateX(-50%);
}

.map-mode-btn {
  min-height: 34px;
  border: 0;
  border-right: 2px solid var(--line);
  padding: 0 12px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.map-mode-btn:last-child {
  border-right: 0;
}

.map-mode-btn.active {
  background: var(--yellow);
}

.panel-toggle {
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 5;
  min-height: 34px;
  background: var(--yellow);
  font-size: 12px;
  text-transform: uppercase;
}

.panel-left {
  left: 16px;
  top: 16px;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 16px;
}

.panel-left.idle .prompt-block,
.panel-left.idle .actions,
.panel-left.idle .feedback {
  display: none;
}

.panel-right {
  right: 16px;
  top: 16px;
  width: 360px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 58px 12px 12px;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.right-panel-collapsed .panel-right {
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 32px));
}

.brand-row,
.section-heading,
.actions,
.feedback,
.auth-actions,
.session-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-row,
.section-heading {
  justify-content: space-between;
}

.eyebrow,
.prompt-label,
.prompt-context,
.feedback p,
.section-heading span,
.rank-list small,
.level-item small,
.field-label,
.session-controls span {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--red);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.05;
  text-transform: uppercase;
}

h2 {
  margin-top: 4px;
  font-size: 34px;
  line-height: 1.02;
  letter-spacing: 0;
}

h3 {
  font-size: 13px;
  line-height: 1;
  text-transform: uppercase;
}

.status-pill {
  border: 2px solid var(--line);
  padding: 7px 10px;
  background: var(--blue);
  color: white;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  text-transform: uppercase;
}

.status-pill.complete {
  background: var(--green);
}

.prompt-block {
  padding: 26px 0 18px;
}

.prompt-label,
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.prompt-context {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.35;
}

.actions {
  align-items: stretch;
}

.primary {
  flex: 1 1 auto;
  background: var(--red);
  color: white;
}

.secondary {
  flex: 0 0 auto;
  background: var(--paper-strong);
}

.small-button {
  min-height: 38px;
  padding: 0 10px;
  font-size: 12px;
  text-transform: uppercase;
}

.feedback {
  min-height: 86px;
  margin-top: 14px;
  padding: 10px;
  border: 2px solid var(--line);
  background: var(--paper-strong);
}

.score {
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  height: 64px;
  border: 2px solid var(--line);
  background: var(--yellow);
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

.feedback p {
  margin: 3px 0;
  font-size: 13px;
  line-height: 1.35;
}

.feedback #outcomeText {
  color: var(--ink);
  font-weight: 800;
}

.session-card {
  margin-top: 10px;
  border: 2px solid var(--line);
  background: var(--paper);
  padding: 10px;
}

.session-card:first-child {
  margin-top: 0;
}

.auth-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.auth-form.signed-in {
  display: none;
}

.signout-button {
  width: 100%;
  margin-top: 10px;
}

.auth-actions,
.session-controls {
  align-items: stretch;
}

.session-controls > button.is-stopping {
  background: var(--ink);
  color: var(--paper-strong);
}

.auth-actions > button,
.session-controls > button {
  flex: 1;
}

.session-controls {
  margin-top: 10px;
}

.session-controls label {
  flex: 1;
}

.session-controls span {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.mix-list,
.rank-list,
.level-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.mix-row {
  display: grid;
  grid-template-columns: 82px 1fr 48px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.bar {
  overflow: hidden;
  height: 8px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.bar > i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 220ms ease;
}

.level-group {
  margin-top: 4px;
  border-top: 2px solid var(--line);
  padding-top: 8px;
  color: var(--red);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.level-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 10px;
  min-height: 58px;
  overflow: hidden;
  padding: 9px 10px 12px;
  text-align: left;
}

.level-item strong,
.rank-item strong {
  overflow: hidden;
  display: block;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-item small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.25;
}

.level-item b {
  color: var(--blue);
  font-size: 18px;
  line-height: 1;
  text-align: right;
}

.level-item i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 5px;
  background: var(--green);
}

.level-item.active {
  background: #e8eff8;
}

.level-item.recommended {
  border-color: var(--red);
}

.rank-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  font-size: 13px;
  line-height: 1.25;
}

.rank-item span {
  color: var(--blue);
  font-weight: 800;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 5;
  transform: translateX(-50%) translateY(20px);
  max-width: min(460px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 2px solid var(--line);
  background: var(--paper-strong);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

#toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 900px) {
  .home-screen {
    position: fixed;
    display: block;
    overflow: auto;
    padding: 18px;
  }

  .home-mark {
    margin-bottom: 18px;
  }

  .home-mark h1 {
    font-size: 48px;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .module-card {
    min-height: 132px;
  }

  .panel-left {
    top: auto;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 58vh;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    border-right: 0;
    border-left: 0;
    border-bottom: 0;
    box-shadow: none;
  }

  .panel-right {
    top: 64px;
    left: 12px;
    right: 12px;
    width: auto;
    max-height: 34vh;
    padding: 10px;
  }

  .panel-toggle {
    top: 12px;
    right: 12px;
  }

  .map-mode-control {
    top: 12px;
    left: 12px;
    transform: none;
  }

  h1 {
    display: none;
  }

  h2 {
    font-size: 28px;
  }

  .prompt-block {
    padding: 13px 0 11px;
  }

  .feedback {
    min-height: 76px;
  }

  .score {
    flex-basis: 54px;
    height: 54px;
    font-size: 18px;
  }

  .maplibregl-ctrl-bottom-left,
  .maplibregl-ctrl-bottom-right {
    margin-bottom: 230px;
  }
}
