:root {
  --bg: #121b1e;
  --card: #1a282c;
  --border: #2d4548;
  --text: #f0ebd8;
  --muted: #9aab9e;
  --accent: #c5a367;
  --accent-hover: #d4b57a;
  --teal: #3d6363;
  --high: #ff6b6b;
  --low: #51cf66;
  --flat: #ffd43b;
  --bear: #ff8787;
  --bull: #69db7c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #1a2d30 0%, var(--bg) 55%);
  color: var(--text);
}

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

.header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  margin-bottom: 0.15rem;
}

.brand {
  display: inline-block;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--accent);
  text-decoration: none;
  line-height: 1.2;
}

.brand span {
  color: var(--text);
  font-weight: 600;
}

.brand:hover {
  color: var(--accent-hover);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  margin-top: 1.25rem;
}

.picker label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.picker-row {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}

.picker-hint {
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.picker-hint-mark {
  display: inline-block;
  padding: 0.05rem 0.38rem;
  border-radius: 999px;
  background: rgba(197, 163, 103, 0.18);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.ticker-combo {
  position: relative;
  flex: 1;
  min-width: 0;
}

#ticker-search {
  width: 100%;
  padding: 0.7rem 2.2rem 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1a1c;
  color: var(--text);
  font: inherit;
}

#ticker-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(197, 163, 103, 0.2);
}

#ticker-search::-webkit-search-cancel-button {
  appearance: none;
}

.ticker-toggle {
  position: absolute;
  top: 0;
  right: 0;
  width: 2.2rem;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  cursor: pointer;
  box-shadow: none;
}

.ticker-toggle:hover {
  background: transparent;
  color: var(--text);
}

.ticker-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  max-height: 20rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #10191c;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.ticker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}

.ticker-option:hover,
.ticker-option.is-active {
  background: rgba(255, 255, 255, 0.05);
}

.ticker-option-main {
  display: flex;
  gap: 0.55rem;
  min-width: 0;
  align-items: baseline;
}

.ticker-code {
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.ticker-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticker-option.has-futoi .ticker-code {
  font-weight: 800;
  color: var(--accent);
}

.ticker-option.has-futoi .ticker-name {
  font-weight: 700;
  color: var(--text);
}

.ticker-futoi-mark {
  flex-shrink: 0;
  padding: 0.12rem 0.42rem;
  border-radius: 999px;
  background: rgba(197, 163, 103, 0.18);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.ticker-empty {
  padding: 0.7rem 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

select,
button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid var(--border);
}

button {
  padding: 0.7rem 1.25rem;
  background: var(--accent);
  color: #1a1510;
  border: none;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}

button:hover {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.status {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #2b2110;
  border: 1px solid #5c4a1f;
  color: #ffd8a8;
}

.status.error {
  background: #2b1215;
  border-color: #7f2b32;
  color: #ffc9c9;
}

.hidden {
  display: none !important;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.45rem;
}

.badge.bull { background: #1b3d2a; color: var(--bull); }
.badge.bear { background: #3d1b1f; color: var(--bear); }
.badge.flat { background: #3d3518; color: var(--flat); }

#ticker-title {
  margin: 0;
  font-size: 1.5rem;
}

.meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.width-box {
  text-align: right;
}

.width-label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
}

.width-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-top: 1.35rem;
}

.level {
  border-radius: 12px;
  padding: 1rem;
  border: 1px solid var(--border);
}

.level-high { background: rgba(255, 107, 107, 0.08); }
.level-low { background: rgba(81, 207, 102, 0.08); }

.level-name {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.level-price {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.level-high .level-price { color: var(--high); }
.level-low .level-price { color: var(--low); }

.level-hint {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.gap-note {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  background: #121c2b;
  font-size: 0.9rem;
  color: var(--muted);
}

.gap-note.gap_up,
.gap-note.gap_down {
  color: #ffe066;
  background: #2b2612;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid h3 {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}

.ohlc {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.ohlc div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

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

.ohlc dd {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.turnover {
  margin: 0.85rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.footer {
  margin-top: 2.25rem;
  text-align: center;
}

.footer-tagline {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  line-height: 1.45;
}

.footer-note {
  margin: 0.55rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

/* FUTOI — минималистичный блок в духе аналитических дашбордов */
.futoi-block-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.futoi-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.35rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border);
}

.futoi-head-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.futoi-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.futoi-segment {
  display: inline-flex;
  padding: 0.2rem;
  border-radius: 10px;
  background: #0c1118;
  border: 1px solid var(--border);
  gap: 0.15rem;
}

.futoi-segment-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.futoi-segment-btn:hover {
  color: var(--text);
}

.futoi-segment-btn.active {
  background: #1e2a3d;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.futoi-instrument-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.futoi-instrument-btn {
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0f1724;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.futoi-instrument-btn.active {
  background: rgba(61, 99, 99, 0.35);
  border-color: var(--accent);
  color: var(--text);
}

.futoi-panels {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.futoi-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0c1118;
  padding: 1rem 1.15rem 1.1rem;
}

.futoi-panel--long {
  border-top: 2px solid rgba(81, 207, 102, 0.45);
}

.futoi-panel--short {
  border-top: 2px solid rgba(255, 107, 107, 0.45);
}

.futoi-panel-title {
  margin: 0 0 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.futoi-panel--long .futoi-panel-title {
  color: #8ce99a;
}

.futoi-panel--short .futoi-panel-title {
  color: #ffa8a8;
}

.futoi-rows {
  max-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.futoi-row {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr) minmax(5.5rem, auto);
  column-gap: 2.25rem;
  row-gap: 0;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: background 0.12s;
}

.futoi-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.futoi-row-time {
  color: var(--muted);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
  padding-right: 0.5rem;
  text-align: right;
}

.futoi-row-bar-wrap {
  padding: 0 1.25rem;
  min-width: 0;
  overflow: hidden;
}

.futoi-row-bar {
  display: block;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1;
  letter-spacing: 0;
  color: #b8c4d4;
  white-space: nowrap;
  overflow: hidden;
}

.futoi-row-bar--long {
  color: #74c69d;
}

.futoi-row-bar--short {
  color: #f08080;
}

.futoi-row-value {
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}

.futoi-row-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  padding-left: 0.75rem;
}

.futoi-signal {
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  padding: 0.14rem 0.42rem;
  border-radius: 5px;
  white-space: nowrap;
}

.futoi-signal--up {
  color: #8ce99a;
  background: rgba(81, 207, 102, 0.14);
}

.futoi-signal--down {
  color: #ffa8a8;
  background: rgba(255, 107, 107, 0.14);
}

.futoi-row.is-peak-long {
  background: rgba(81, 207, 102, 0.12);
}

.futoi-row.is-peak-long .futoi-row-time,
.futoi-row.is-peak-long .futoi-row-bar,
.futoi-row.is-peak-long .futoi-row-value {
  color: #51cf66;
}

.futoi-row.is-peak-long .futoi-signal--up {
  color: #b2f2bb;
  background: rgba(81, 207, 102, 0.22);
}

.futoi-row.is-peak-long .futoi-signal--down {
  color: #ffc9c9;
  background: rgba(255, 107, 107, 0.2);
}

.futoi-row.is-peak-short {
  background: rgba(255, 107, 107, 0.12);
}

.futoi-row.is-peak-short .futoi-row-time,
.futoi-row.is-peak-short .futoi-row-bar,
.futoi-row.is-peak-short .futoi-row-value {
  color: #ff6b6b;
}

.futoi-row.is-peak-short .futoi-signal--up {
  color: #b2f2bb;
  background: rgba(81, 207, 102, 0.2);
}

.futoi-row.is-peak-short .futoi-signal--down {
  color: #ffc9c9;
  background: rgba(255, 107, 107, 0.22);
}

.futoi-bars-block {
  display: none;
}

.futoi-unavailable {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .brand {
    font-size: 0.84rem;
    letter-spacing: 0.12em;
  }

  .subtitle {
    font-size: 0.72rem;
  }

  .levels,
  .grid {
    grid-template-columns: 1fr;
  }

  .picker-row {
    flex-direction: column;
  }

  .ticker-list {
    max-height: 16rem;
  }

  .futoi-row {
    grid-template-columns: 3.25rem minmax(0, 1fr) minmax(4.5rem, auto);
    column-gap: 1.25rem;
    padding: 0.45rem 0.5rem;
  }

  .futoi-row-bar-wrap {
    padding: 0 0.85rem;
  }

  .futoi-row-end {
    padding-left: 0.5rem;
  }

  .futoi-signal {
    font-size: 0.62rem;
    padding: 0.1rem 0.32rem;
  }

  .futoi-segment {
    width: 100%;
  }

  .futoi-segment-btn {
    flex: 1;
    text-align: center;
  }
}
