:root {
  --bg: #0f172a;
  --card: #1e293b;
  --panel: #020817;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --text: #f8fafc;
  --muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.12);
  --blue-border: rgba(37, 99, 235, 0.55);
  --radius: 20px;
  --radius-lg: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(30, 58, 138, 0.45), transparent 35%),
    linear-gradient(135deg, #0f172a, #111827);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 32px;
}

.app-header {
  margin-bottom: 26px;
}

h1 {
  margin: 0;
  font-size: clamp(2.7rem, 5vw, 4.2rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

h2 {
  margin: 0 0 20px;
  font-size: clamp(1.7rem, 2.5vw, 2.2rem);
  letter-spacing: -0.03em;
}

h3 {
  margin: 26px 0 14px;
  font-size: 1.35rem;
}

.muted {
  color: var(--muted);
}

.step {
  display: none;
}

.step.active {
  display: block;
}

.card {
  width: 100%;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid var(--blue-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

/* Form controls */

.input-section {
  margin-top: 22px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.46);
  border: 1px solid var(--border);
  border-radius: 22px;
}

.grid,
.summary-card,
.mini-grid,
.performance-grid {
  display: grid;
  gap: 18px;
}

.grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.summary-card,
.mini-grid,
.performance-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 15px 16px;
  font-size: 1rem;
}

textarea {
  min-height: 115px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

button {
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  padding: 16px 22px;
  font-size: 1.05rem;
  font-weight: 900;
  cursor: pointer;
}

button.secondary {
  background: #334155;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 24px;
}

/* Setup */

#step-start {
  max-width: 1100px;
  margin: 0 auto;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  width: 100%;
  margin-bottom: 24px;
}

.choice {
  width: 100%;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 1.2rem;
}

.choice.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.setup-box button {
  width: 100%;
  height: 60px;
  margin-top: 18px;
}

.tools-card p {
  margin-top: -10px;
  margin-bottom: 22px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.tool-button {
  text-align: left;
  min-height: 110px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
}

.tool-button span,
.tool-button small {
  display: block;
}

.tool-button span {
  font-size: 1.25rem;
  margin-bottom: 8px;
}

.tool-button small {
  color: var(--muted);
  line-height: 1.35;
}

.secondary-tool {
  background: rgba(51, 65, 85, 0.85);
}

/* Summary */

.summary-card label {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

.summary-card .wide {
  grid-column: 1 / -1;
}

/* Loading */

.mini-grid div,
.performance-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
}

.mini-grid span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.mini-grid strong {
  font-size: 1.2rem;
}

.plane-top {
  width: 100%;
  max-width: 850px;
  margin: 44px auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 380px));
  gap: 34px 28px;
  justify-content: center;
}

.station,
.seat-card {
  min-height: 145px;
  white-space: pre-line;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(145deg, rgba(37, 99, 235, 0.24), rgba(15, 23, 42, 0.96));
  border: 1px solid var(--blue-border);
  border-radius: 22px;
  color: white;
  text-align: center;
  line-height: 1.25;
}

.seat-left {
  grid-column: 1;
}

.seat-right {
  grid-column: 2;
}

.seat-center {
  grid-column: 1 / 3;
  justify-self: center;
  width: min(380px, 100%);
}

.station.flightbags {
  box-shadow: none;
}

.metar-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: stretch;
}

.metar-button {
  height: 100%;
}

/* Results */

.performance-card h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 1rem;
}

.performance-value {
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  font-weight: 950;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
}

thead {
  background: var(--panel);
}

th,
td {
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
}

.cg-plot-wrap {
  width: 100%;
  overflow: hidden;
  margin-top: 16px;
}

.cg-plot {
  display: block;
  width: min(100%, 850px);
  height: auto;
  margin: 0 auto;
  border-radius: 14px;
  background: white;
}

/* School-style fleet calendar */

#step-calendar.card {
  max-width: none;
  width: 100%;
  padding: 12px;
  background: #f3f4f6 !important;
  color: #111827 !important;
  border: none !important;
  border-radius: 0;
  box-shadow: none !important;
}

.school-calendar-toolbar {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  color: #111827;
}

.school-calendar-toolbar button {
  background: #fff !important;
  color: #111827 !important;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.85rem;
  box-shadow: none;
}

.school-calendar-toolbar button:hover {
  background: #f8fafc !important;
}

.calendar-title-block {
  text-align: center;
  color: #111827;
}

.calendar-title-block h2 {
  margin: 0;
  color: #111827 !important;
  font-size: 1rem;
  letter-spacing: 0;
}

.calendar-title-block span {
  display: block;
  margin-top: 2px;
  color: #111827;
  font-size: 0.75rem;
  font-weight: 800;
}

.school-calendar-shell {
  width: 100%;
  height: calc(100vh - 120px);
  max-height: none;
  overflow-x: auto;
  overflow-y: auto;
  background: #f3f4f6;
  border: none !important;
  box-shadow: none !important;
}

.school-calendar-wrap {
  width: max-content;
  min-width: 100%;
}

.school-calendar {
  display: grid !important;
  grid-template-columns: 92px repeat(24, 64px) !important;
  grid-auto-rows: 72px;
  min-width: 1628px;
  background: #f3f4f6;
  color: #111827;
  font-family: Arial, sans-serif;
  font-size: 12px;
  border-top: 1px solid #9ca3af;
  border-left: 1px solid #9ca3af;
}

.school-cell,
.school-tail,
.school-row,
.school-head,
.hour-head,
.aircraft-head {
  border-right: 1px solid #9ca3af;
  border-bottom: 1px solid #9ca3af;
}

.school-head {
  position: sticky;
  top: 0;
  z-index: 6;
  background: #ffffff;
  color: #111827;
  font-weight: 700;
  text-align: center;
  padding: 2px 4px;
}

.aircraft-head {
  width: 92px;
  min-width: 92px;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 10;
  background: #ffffff;
  text-align: left;
  padding: 4px;
  border-right: 2px solid #6b7280;
}

.aircraft-head strong,
.aircraft-head small {
  display: block;
}

.aircraft-head strong {
  font-size: 0.9rem;
}

.aircraft-head small {
  margin-top: 4px;
  font-size: 0.62rem;
  color: #111827;
  font-weight: 600;
}

.hour-head {
  width: 64px;
  min-width: 64px;
  min-height: 26px;
  background: #ffffff;
  color: #111827;
  padding: 2px 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
}

.school-tail {
  width: 92px;
  min-width: 92px;
  position: sticky;
  left: 0;
  z-index: 5;
  background: #f3f4f6;
  color: #000;
  border-right: 2px solid #6b7280;
  border-bottom: 2px solid #9ca3af;
  display: flex;
  align-items: center;
  padding: 3px 5px;
  font-size: 0.8rem;
  font-weight: 900;
}

.school-tail strong {
  font-size: 0.8rem;
}

.school-row {
  position: relative;
  height: 72px;
  min-height: 72px;
  background: #f8fafc;
  border-bottom: 2px solid #9ca3af;
  overflow: hidden;
}

.school-hour-bg {
  display: none;
}

.school-row {
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 63px,
      #9ca3af 63px,
      #9ca3af 64px
    ),
    #f8fafc;
}

.school-event {
  position: absolute;
  top: 4px;
  bottom: 4px;
  height: auto;
  background: #a7d8f5;
  border: 1px solid #60a5fa;
  border-radius: 4px;
  color: #000;
  text-align: center;
  overflow: hidden;
  white-space: normal;
  padding: 3px 4px;
  z-index: 3;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.school-event strong,
.school-event span,
.school-event small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.school-event strong {
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.05;
}

.school-event span {
  font-size: 0.66rem;
  line-height: 1.05;
}

.school-event small {
  font-size: 0.6rem;
  line-height: 1.1;
  white-space: normal;
}

.empty-calendar {
  padding: 22px;
  color: #111827;
  text-align: center;
  font-weight: 800;
  background: #f8fafc;
}

/* Compatibility aliases */

.fleet-calendar,
.fleet-calendar-wrapper {
  width: 100%;
  overflow-x: auto;
}

.fleet-grid {
  display: grid !important;
  grid-auto-flow: row;
  min-width: 1628px;
  color: #111827;
}

.fleet-cell {
  min-height: 72px;
  padding: 4px 6px;
  background: #f3f4f6;
  color: #111827;
  border-right: 1px solid #9ca3af;
  border-bottom: 1px solid #9ca3af;
}

/* Modals / accounts */

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  z-index: 1000;
}

.modal-card {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  color: var(--text);
}

.modal-card button {
  width: 100%;
  margin-top: 14px;
}

.accounts-card {
  width: min(720px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
}

.accounts-header h2 {
  margin: 0 0 12px;
}

.account-mode {
  display: block;
  width: 100%;
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: 16px;
  text-align: center;
  font-weight: 900;
}

.account-mode.edit {
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.7);
  color: #dbeafe;
}

.account-mode.new {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(74, 222, 128, 0.7);
  color: #dcfce7;
}

.account-mode.locked {
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: #e2e8f0;
}

.account-actions,
.account-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0;
}

.account-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.account-form-grid .wide {
  grid-column: 1 / -1;
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.checkbox-label input {
  width: auto;
}

#accountCode[readonly],
.accounts-card input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#deleteAccount:disabled,
#saveAccount:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Mobile */

@media (max-width: 900px) {
  .app-shell {
    padding: 16px;
  }

  .card {
    padding: 20px;
  }

  .choice-row,
  .button-row,
  .metar-row,
  .tool-grid {
    grid-template-columns: 1fr;
  }

  .plane-top {
    grid-template-columns: 1fr 1fr;
    max-width: 100%;
    gap: 14px;
    margin: 28px auto;
  }

  .station,
  .seat-card {
    min-height: 118px;
    padding: 10px;
    font-size: 0.9rem;
  }

  .seat-left {
    grid-column: 1;
  }

  .seat-right {
    grid-column: 2;
  }

  .seat-center {
    grid-column: 1 / 3;
    width: min(100%, 320px);
    justify-self: center;
  }

  .school-calendar-toolbar {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .calendar-title-block {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #calendarRefresh {
    grid-column: 1 / -1;
  }

  .account-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .app-shell {
    padding: 8px;
  }

  #step-calendar.card {
    padding: 6px;
  }

  .school-calendar-toolbar {
    gap: 4px;
  }

  .school-calendar-toolbar button {
    padding: 7px 8px;
    font-size: 0.8rem;
  }

  .calendar-title-block h2 {
    margin: 0;
    font-size: 0.95rem;
  }

  .calendar-title-block span {
    margin-top: 2px;
  }

  .school-calendar-shell {
    height: calc(100vh - 105px);
  }

  .school-calendar {
    grid-template-columns: 78px repeat(24, 54px) !important;
    min-width: 1374px;
    grid-auto-rows: 78px;
  }

  .aircraft-head,
  .school-tail {
    width: 78px;
    min-width: 78px;
  }

  .hour-head {
    width: 54px;
    min-width: 54px;
    font-size: 0.68rem;
  }

  .school-tail {
    font-size: 0.68rem;
    padding: 3px;
  }

  .school-row {
    height: 78px;
    min-height: 78px;
  }

  .school-event {
    top: 4px;
    bottom: 4px;
    padding: 3px 2px;
  }

  .school-event strong {
    font-size: 0.62rem;
  }

  .school-event span {
    font-size: 0.58rem;
  }

  .school-event small {
    font-size: 0.52rem;
  }
}

.school-event-stage {
  background: #f9a8d4 !important;
  border: 1px solid #ec4899 !important;
  color: #831843 !important;
}


.tail-link {
  all: unset;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #000;
  font-weight: 900;
}

.tail-link:hover {
  text-decoration: underline;
}

.flying-icon {
  color: #16a34a;
  font-size: 0.85rem;
}

.tail-link-live {
  text-decoration: underline;
}

.school-calendar {
  grid-template-columns: 92px repeat(24, 64px) !important;
}

@media (max-width: 700px) {
  .school-calendar {
    grid-template-columns: 78px repeat(24, 54px) !important;
  }
}

@media (max-width: 700px) {
  .school-row {
    background:
      repeating-linear-gradient(
        to right,
        transparent 0,
        transparent 53px,
        #9ca3af 53px,
        #9ca3af 54px
      ),
      #f8fafc;
  }
}

.school-calendar {
  position: relative;
}

.current-time-global {
  position: absolute;
  top: 72px;
  bottom: 0;
  width: 3px;
  background: #ef4444;
  z-index: 20;
  pointer-events: none;
}
.current-time-global::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ef4444;
}

@media (max-width: 700px) {
  .current-time-global {
    top: 78px;
  }
}

.aircraft-head {
  z-index: 50;
}

.school-tail {
  z-index: 40;
}

.current-time-global {
  z-index: 20;
}

.hour-head {
  position: sticky;
  top: 0;
  z-index: 60;
  background: #ffffff;
}

#step-calendar .button-row {
  display: flex;
  justify-content: center;
}

#step-calendar #calendarBack {
  width: auto;
  min-width: 220px;
}

.school-tail,
.tail-link,
.tail-link span {
  white-space: pre-line;
}

.school-tail-standby {
  background: #eef2ff;
  color: #3730a3;
}

.school-row-standby {
  background: #f8fafc;
}

.school-event-standby {
  background: #ddd6fe;
  border-color: #8b5cf6;
}

.saved-flash {
  background: #22c55e !important;
  transform: scale(1.02);
  transition: 0.15s ease;
}

#step-accounts {
  max-width: 760px;
  margin: 0 auto;
}

#step-accounts .accounts-card {
  width: 100%;
  max-height: none;
  overflow: visible;
}

.field-help-row {
  display: grid;
  grid-template-columns: 1fr 52px;
  gap: 10px;
}

.help-button {
  padding: 0;
  height: 52px;
  border-radius: 16px;
}

.calendar-help-button {
  width: 100%;
  margin-top: 12px;
}

.help-card {
  width: min(1100px, 95vw);
}

.help-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

.help-image-wrap {
  overflow: hidden;
  border-radius: 16px;
}

.help-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
}

.help-steps {
  margin-top: 20px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-image {
    max-height: 45vh;
    object-fit: contain;
  }
}

.weather-grid {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 10px;
  width: 100%;
  max-width: none;
  margin: 0;
}

.weather-panel {
  width: 100%;
  background: rgba(2, 8, 23, 0.65);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px;
}

.weather-panel .grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.metar-row {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  align-items: stretch;
}

.wx-textarea {
  min-height: 170px;
}

@media (max-width: 1000px) {
  .weather-panel .grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .metar-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 650px) {
  .weather-panel .grid {
    grid-template-columns: 1fr;
  }
}

.wx-textarea,
.taf-display {
  width: 100%;
  min-height: 160px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.taf-applicable {
  display: block;
  margin: 8px 0;
  padding: 10px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.65);
}

.route-field {
  margin-bottom: 10px;
}

.weather-panel h4 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.wx-time {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.cg-plot-wrap {
  background: white;
  border-radius: 18px;
  padding: 16px;
  overflow: hidden;
}

.cg-plot {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.runway-graphics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
}

.runway-card {
  background: linear-gradient(180deg, #0b1220, #111827);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 24px;
  padding: 26px;
}

.runway-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}

.runway-card-head h4 {
  margin: 0;
  font-size: 1.65rem;
}

.runway-card-head span {
  color: var(--muted);
  font-weight: 950;
  font-size: 1.05rem;
}

.runway-diagram {
  position: relative;
  height: 260px;
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px),
    #1f2937;
  background-size: 28px 28px;
  padding: 86px 34px 64px;
}

.runway-strip {
  position: relative;
  height: 96px;
  background: linear-gradient(180deg, #8d949e, #707783);
  border: 5px solid #f8fafc;
  box-shadow: 0 0 0 2px rgba(255,255,255,.35);
  overflow: hidden;
}

.runway-number {
  position: absolute;
  top: 50%;
  transform-origin: center;
  transform: translateY(-50%);
  color: white;
  font-size: 2rem;
  font-weight: 900;
  z-index: 5;
}

.runway-number.left {
  left: 100px;
  transform: translateY(-50%) rotate(90deg);
}

.runway-number.right {
  right: 100px;
  transform: translateY(-50%) rotate(-90deg);
}

.threshold-bars {
  position: absolute;
    width: 70px;
    height: 79px;
    top: 6px;
    z-index: 4;
    background: repeating-linear-gradient(#fff 0, #fff 5px, transparent 4px, transparent 10px );
}

.threshold-bars.left {
  left: 6px;
}

.threshold-bars.right {
  right: 6px;
}

.runway-centerline {
  position: absolute;
  left: 11%;
  right: 11%;
  top: 50%;
  height: 5px;
  transform: translateY(-50%);
  background: repeating-linear-gradient(
    90deg,
    #fff 0,
    #fff 22px,
    transparent 22px,
    transparent 46px
  );
  z-index: 2;
}

.aiming-point {
  position: absolute;
  width: 70px;
  height: 15px;
  background: white;
  z-index: 4;
}

.aiming-point.top {
  top: 15px;
}

.aiming-point.bottom {
  bottom: 15px;
}

/* 1000 ft from threshold */
.aiming-point.aim-l {
  left: 20%;
}

.aiming-point.aim-r {
  right: 20%;
}
.perf-line {
  position: absolute;
  left: 34px;
  height: 5px;
  min-width: 70px;
  max-width: calc(100% - 68px);
  border-radius: 999px;
  z-index: 10;
}

.perf-line::before,
.perf-line::after {
  content: "";
  position: absolute;
  top: -9px;
  width: 4px;
  height: 24px;
  border-radius: 4px;
}

.perf-line::before {
  left: 0;
}

.perf-line::after {
  right: 0;
}

.perf-line span {
  position: absolute;
  left: 10px;
  top: -34px;
  font-weight: 950;
  font-size: 0.95rem;
  white-space: nowrap;
  text-shadow: 0 2px 4px #000;
}

.perf-line.over50 {
  top: 40px;
  background: #3b82f6;
}

.perf-line.over50::before,
.perf-line.over50::after {
  background: #3b82f6;
}

.perf-line.over50 span {
  color: #60a5fa;
}

.perf-line.ground {
  bottom: 36px;
  background: #65a30d;
}

.perf-line.ground::before,
.perf-line.ground::after {
  background: #65a30d;
}

.perf-line.ground span {
  color: #84cc16;
}

.runway-scale {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
}

.runway-info-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));      
  gap: 12px;
  margin-top: 18px;
}

.runway-info-row div {
  background: #020817;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 14px;
}

.runway-info-row span {
  display: block;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
}

.runway-info-row strong {
  display: block;
  margin-top: 5px;
  font-size: 1.15rem;
}

.runway-info-row .good strong,
.runway-info-row strong.green {
  color: #65a30d;
}

.runway-info-row .bad strong {
  color: #ef4444;
}

.runway-info-row strong.blue {
  color: #3b82f6;
}

@media (max-width: 900px) {
  .runway-card {
    padding: 18px;
  }

  .runway-diagram {
    height: 230px;
    padding-left: 22px;
    padding-right: 22px;
  }

  .perf-line {
    left: 22px;
    max-width: calc(100% - 44px);
  }

  .runway-scale {
    left: 22px;
    right: 22px;
  }

  .runway-info-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile vertical runway view */
@media (max-width: 700px) {
  .runway-card {
    padding: 16px;
  }

  .runway-card-head {
    display: block;
    margin-bottom: 14px;
  }

  .runway-card-head h4 {
    font-size: 1.35rem;
    margin-bottom: 4px;
  }

  .runway-card-head span {
    font-size: 0.9rem;
  }

  .runway-diagram {
    height: 520px;
    padding: 54px 20px 44px;
  }

  .runway-strip {
    width: 120px;
    height: 100%;
    margin: 0 auto;
  }

  .threshold-bars {
    width: 92px;
    height: 70px;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%);
    background: repeating-linear-gradient(
      90deg,
      #fff 0,
      #fff 7px,
      transparent 7px,
      transparent 14px
    );
  }

  .threshold-bars.left {
    top: 8px;
    bottom: auto;
  }

  .threshold-bars.right {
    top: auto;
    bottom: 8px;
  }

  .runway-number.left {
    top: 90px;
    left: 50% !important;
    transform: translateX(-50%) rotate(180deg);
  }

  .runway-number.right {
    top: auto;
    bottom: 90px;
    right: auto !important;
    left: 50%;
    transform: translateX(-50%) rotate(0deg);
  }

  .runway-centerline {
    left: 50%;
    right: auto;
    top: 18.5%;
    bottom: 16.5%;
    width: 5px;
    height: auto;
    transform: translateX(-50%);
    background: repeating-linear-gradient(
      180deg,
      #fff 0,
      #fff 22px,
      transparent 22px,
      transparent 46px
    );
  }

  .aiming-point {
    width: 22px;
    height: 58px;
  }

  .aiming-point.top {
    top: auto;
  }

  .aiming-point.bottom {
    bottom: auto;
  }

  .aiming-point.aim-l.top {
    top: 25%;
    left: 17px;
  }

  .aiming-point.aim-l.bottom {
    top: 25%;
    right: 17px;
    left: auto;
  }

  .aiming-point.aim-r.top {
    bottom: 25%;
    left: 17px;
    right: auto;
  }

  .aiming-point.aim-r.bottom {
    bottom: 25%;
    right: 17px;
    left: auto;
  }

  .perf-line {
    left: 18px;
    width: 5px !important;
    min-width: 0;
    max-width: none;
    height: var(--line-height, 80px);
  }

  .perf-line::before,
  .perf-line::after {
    left: -9px;
    top: auto;
    width: 24px;
    height: 4px;
  }

  .perf-line::before {
    top: 0;
  }

  .perf-line::after {
    bottom: 0;
  }

  .perf-line.over50 {
    top: 54px;
  }

  .perf-line.ground {
    top: 54px;
    left: auto;
    right: 18px;
    bottom: auto;
  }

  .perf-line span {
    top: 0;
    left: 14px;
    writing-mode: vertical-rl;
    transform: none;
    font-size: 0.82rem;
  }

  .perf-line.ground span {
    left: auto;
    right: 14px;
    writing-mode: vertical-rl;
  }

  .runway-scale {
    left: 12px;
    right: 12px;
    bottom: 8px;
    font-size: 0rem;
  }
}

@media (max-width: 700px) {
  .runway-info-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
  }

  .runway-info-row div {
    min-width: 135px;
    scroll-snap-align: start;
  }

  .runway-info-row::-webkit-scrollbar {
    height: 6px;
  }

  .runway-info-row::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 999px;
  }
}

/* FINAL mobile runway info cards */
@media (max-width: 700px) {
  .runway-info-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
  }

  .runway-info-row div {
    min-width: 0 !important;
    width: auto !important;
    padding: 12px !important;
  }

  .runway-info-row span {
    font-size: 0.72rem !important;
  }

  .runway-info-row strong {
    font-size: 1rem !important;
    line-height: 1.15 !important;
  }
}

@media (max-width: 700px) {

  .runway-card {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px;
    align-items: start;
  }

  .runway-card-head {
    grid-column: 1 / -1;
  }

  .runway-diagram {
    grid-column: 1;
    height: 520px;
    margin: 0;
  }

  .runway-info-row {
    grid-column: 2;

    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;

    margin-top: 0 !important;
    align-self: stretch;
  }

  .runway-info-row div {
    min-width: 0 !important;
    width: 100%;
  }
}
@media (max-width: 700px) {

  .runway-card {
    grid-template-columns: 220px 1fr;
  }

  .runway-diagram {
    height: 800px !important;
    min-height: 800px !important;
  }

  .runway-surface {
    height: 720px !important;
  }
}

@media (max-width: 700px) {
  .perf-line {
    width: 5px !important;
    height: var(--line-height, 80px) !important;
  }
}