:root {
  --bg: #0f0f12;
  --surface: #1a1a1f;
  --surface-2: #24242b;
  --text: #f5f5f7;
  --text-muted: #a0a0a8;
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.1);
  --fill: #e8e8ed;
  --danger: #ff6b6b;
  --ok: #5cff9a;
  --radius: 12px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 420px;
  margin: 0 auto;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
}

.user-name {
  color: var(--text-muted);
}

.logout-link {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.65rem;
  transition: background 0.15s, border-color 0.15s;
}

.logout-link:hover {
  background: var(--surface-2);
  border-color: rgba(255, 255, 255, 0.25);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.tagline {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Plane section */
.plane-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

.plane {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 80px 80px 40px 40px / 120px 120px 40px 40px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.3s ease;
}

.plane:hover {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.fuselage-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0%;
  background: linear-gradient(
    to top,
    rgba(255, 255, 255, 0.22) 0%,
    rgba(255, 255, 255, 0.08) 100%
  );
  transition: height 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 1;
  pointer-events: none;
}

.nose {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50% 50% 0 0;
  z-index: 2;
}

.wing {
  position: absolute;
  top: 42%;
  width: 110px;
  height: 28px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  z-index: 0;
}

.wing-left {
  left: -95px;
  border-radius: 40px 8px 8px 40px;
  transform: rotate(-6deg);
}

.wing-right {
  right: -95px;
  border-radius: 8px 40px 40px 8px;
  transform: rotate(6deg);
}

.tail {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  z-index: 2;
}

.tail::before {
  content: "";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 28px;
  background: var(--surface-2);
  border-radius: 4px;
}

/* Form */
.plane-form {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  padding: 3.2rem 2rem 2rem;
  height: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.form-group label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group select,
.form-group input {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.form-group select:focus,
.form-group input:focus {
  border-color: rgba(255, 255, 255, 0.35);
  background: #2a2a32;
}

.form-group select.error,
.form-group input.error {
  border-color: var(--danger);
  background: rgba(255, 107, 107, 0.08);
}

.form-group select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%23a0a0a8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.2rem;
}

/* Date picker — тёмная тема */
.form-group input[type="date"],
.sim-controls input[type="date"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.85);
  cursor: pointer;
  opacity: 0.7;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.form-group input[type="number"]::-webkit-inner-spin-button {
  opacity: 0.4;
}

.field-error {
  font-size: 0.75rem;
  color: var(--danger);
  line-height: 1.3;
  min-height: 1.1em;
}

.btn-calc {
  margin-top: auto;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s, background 0.2s;
}

.btn-calc:hover {
  background: #e8e8ed;
  transform: translateY(-1px);
}

.btn-calc:active {
  transform: translateY(0);
}

.btn-calc:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.fill-badge {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  z-index: 4;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.7rem;
  text-align: center;
  min-width: 58px;
}

.fill-badge span {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
}

.fill-badge small {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Summary */
.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 420px;
}

.summary-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 0.75rem;
  text-align: center;
}

.summary-item .label {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.25rem;
}

.summary-item .value {
  font-size: 1.25rem;
  font-weight: 700;
}

.summary-item.highlight {
  border-color: rgba(255, 255, 255, 0.25);
  background: var(--surface-2);
}

/* Chart sections */
.chart-section,
.sim-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.25rem 1.25rem;
  margin-bottom: 1.5rem;
}

.chart-section h2,
.sim-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.chart-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.chart-wrap {
  position: relative;
  height: 300px;
}

.sim-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
}

.sim-chart-wrap,
.sim-dist-wrap {
  height: 260px;
  position: relative;
}

@media (max-width: 720px) {
  .sim-charts-row {
    grid-template-columns: 1fr;
  }
}

/* Custom tooltip */
.tooltip-box {
  position: fixed;
  z-index: 100;
  background: #1e1e24;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  max-width: 260px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  line-height: 1.4;
}

/* Simulation controls */
.sim-controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.sim-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sim-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 80px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

.seg {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn.active {
  background: var(--accent);
  color: var(--bg);
}

.sim-controls input[type="date"],
.sim-controls input[type="number"] {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  outline: none;
  max-width: 160px;
}

.sim-controls input:focus {
  border-color: rgba(255, 255, 255, 0.35);
}

.play-row {
  gap: 0.6rem;
}

.btn-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.btn-play img { width: 24px; height: 24px; display:block; }

.btn-play:hover {
  background: #2e2e36;
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-play.playing {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

#simSlider {
  flex: 1;
  min-width: 120px;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  outline: none;
}

#simSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

#simSlider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
}

.sim-value {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 90px;
  text-align: right;
  color: var(--text);
}

.sim-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.6rem;
  text-align: center;
}

/* Footer */
.footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Price stepper */
.price-control {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.price-control input[type="number"] {
  flex: 1;
  min-width: 0;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.price-control input[type="number"]::-webkit-inner-spin-button,
.price-control input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.price-step {
  width: 42px;
  min-width: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

.price-step:hover:not(:disabled) {
  background: #35353e;
  border-color: rgba(255, 255, 255, 0.3);
}

.price-step:active:not(:disabled) {
  background: #41414a;
}

.price-step:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.price-control input:focus {
  border-color: rgba(255, 255, 255, 0.4);
}
.sim-price-control {
  max-width: 220px;
  width: 100%;
}

.sim-price-control input[type="number"] {
  max-width: none;
  width: 100%;
  flex: 1;
  min-width: 0;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.sim-price-control input::-webkit-inner-spin-button,
.sim-price-control input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.sim-price-control[hidden] {
  display: none;
}



/* Responsive */
/*@media (max-width: 520px) {*/
/*  .plane {*/
/*    max-width: 100%;*/
/*    height: 520px;*/
/*    border-radius: 60px 60px 32px 32px / 90px 90px 32px 32px;*/
/*    background: var(--surface);*/
/*    border: 1px solid var(--border);*/
/*    overflow: hidden;*/
/*    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);*/
/*    transition: box-shadow 0.3s ease;*/
/*  }*/

/*  .wing {*/
/*    display: none;*/
/*  }*/

/*  .summary {*/
/*    grid-template-columns: 1fr;*/
/*  }*/

/*  .plane-form {*/
/*    padding: 2.8rem 1.4rem 1.6rem;*/
/*  }*/

/*  .sim-row {*/
/*    flex-direction: column;*/
/*    align-items: stretch;*/
/*  }*/

/*  .sim-label {*/
/*    min-width: auto;*/
/*  }*/

/*  .play-row {*/
/*    flex-direction: row;*/
/*    align-items: center;*/
/*  }*/
/*}*/
