:root {
  color-scheme: dark;
  --bg: #060811;
  --panel: rgba(7, 12, 24, .78);
  --panel-strong: rgba(11, 18, 32, .94);
  --line: rgba(0, 245, 255, .28);
  --line-soft: rgba(255, 255, 255, .12);
  --text: #f1fbff;
  --muted: #8ea8b8;
  --cyan: #00f5ff;
  --pink: #ff3df2;
  --lime: #b7ff2a;
  --amber: #ffe46b;
  --danger: #ff5c7a;
  --shadow-cyan: 0 0 26px rgba(0, 245, 255, .28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 10%, rgba(255, 61, 242, .18), transparent 26rem),
    radial-gradient(circle at 86% 8%, rgba(0, 245, 255, .22), transparent 30rem),
    linear-gradient(135deg, #070912, #101521 56%, #050506);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 52px 52px;
}

.topbar,
.main-panel,
.side-panel > section,
.drawer-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 0 34px rgba(0, 245, 255, .04), 0 24px 60px rgba(0, 0, 0, .34);
  backdrop-filter: blur(14px);
}

.topbar {
  display: grid;
  grid-template-columns: auto minmax(280px, 520px) auto;
  gap: 22px;
  align-items: center;
  min-height: 70px;
  padding: 12px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--cyan);
  color: #021017;
  box-shadow: 0 0 18px rgba(0, 245, 255, .75);
}

.ticker-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(183, 255, 42, .45);
  background: rgba(0, 0, 0, .28);
}

.search-icon {
  color: var(--lime);
  display: grid;
  place-items: center;
}

.ticker-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  display: none;
  border: 1px solid var(--line);
  background: #09101d;
  box-shadow: var(--shadow-cyan);
}

.search-results.open {
  display: grid;
}

.search-result {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.search-result:hover {
  background: rgba(0, 245, 255, .08);
}

.portfolio-button,
.add-button,
.panel-title button,
.drawer-header button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 15px;
  color: #061018;
  background: var(--lime);
  font-weight: 900;
  box-shadow: 0 0 22px rgba(183, 255, 42, .32);
  white-space: nowrap;
}

.portfolio-button strong {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  background: #07101a;
  color: var(--lime);
}

.stock-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 22px;
  margin-top: 22px;
}

.main-panel {
  min-height: 720px;
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto minmax(360px, 1fr);
  gap: 20px;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

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

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(44px, 6vw, 84px);
  line-height: .9;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(0, 245, 255, .24);
}

.ticker-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  flex-wrap: wrap;
}

.ticker-line strong {
  color: var(--cyan);
}

.price-block {
  display: grid;
  gap: 10px;
  justify-items: end;
  text-align: right;
}

.price-block strong {
  font-size: clamp(42px, 5vw, 72px);
  line-height: .92;
  text-shadow: 0 0 18px rgba(183, 255, 42, .26);
}

.change-positive,
.change-negative {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  font-weight: 900;
}

.change-positive {
  color: var(--lime);
  background: rgba(183, 255, 42, .08);
}

.change-negative {
  color: var(--danger);
  background: rgba(255, 92, 122, .08);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.range-control {
  display: flex;
  gap: 8px;
}

.range-control button {
  width: 48px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  font-weight: 900;
}

.range-control button.active {
  border-color: var(--pink);
  background: var(--pink);
  color: #fff;
  box-shadow: 0 0 18px rgba(255, 61, 242, .5);
}

.add-button {
  background: var(--cyan);
  box-shadow: 0 0 22px rgba(0, 245, 255, .35);
}

.add-button.saved {
  background: var(--lime);
}

.chart-card {
  min-height: 0;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.chart-header h2,
.panel-title h2,
.drawer-header h2 {
  margin: 0;
  font-size: 16px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.chart-header p,
.fundamental-card p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.chart-stat {
  display: grid;
  gap: 4px;
  justify-items: end;
  color: var(--muted);
  font-size: 12px;
}

.chart-stat strong {
  color: var(--lime);
  font-size: 17px;
}

.chart-stage {
  min-height: 430px;
}

#priceChart {
  width: 100%;
  height: 100%;
  min-height: 430px;
  display: block;
}

.side-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.side-panel > section {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.panel-title button,
.drawer-header button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  color: var(--cyan);
  background: rgba(0, 245, 255, .08);
  border: 1px solid var(--line);
  box-shadow: none;
}

.metric-grid {
  display: grid;
  gap: 10px;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .045);
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  font-size: 21px;
}

.score-track {
  height: 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, .1);
}

.score-track span {
  display: block;
  width: 82%;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--cyan), var(--lime));
  box-shadow: var(--shadow-cyan);
}

.signal-list {
  display: grid;
  gap: 8px;
  margin-top: 15px;
}

.signal {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 13px;
}

.signal strong {
  color: var(--text);
}

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

.news-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 80px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .035);
}

.thumb {
  height: 64px;
  border: 1px solid rgba(0, 245, 255, .45);
  overflow: hidden;
}

.thumb.launch {
  background:
    radial-gradient(circle at 72% 24%, #fff 0 6px, transparent 7px),
    linear-gradient(132deg, transparent 0 42%, #111 43% 47%, transparent 48%),
    linear-gradient(180deg, #95b5ff, #e8eefc 58%, #ff8b2b 59%, #1e1e1e 74%);
}

.thumb.factory {
  background:
    linear-gradient(90deg, #171717 0 16%, transparent 17%),
    repeating-linear-gradient(90deg, #fff 0 7px, #b8c5d9 7px 13px),
    linear-gradient(180deg, #dee8ff 0 42%, #929aa9 43% 100%);
}

.thumb.market {
  background:
    linear-gradient(135deg, transparent 0 50%, rgba(255, 255, 255, .5) 51%),
    repeating-linear-gradient(90deg, #103d2f 0 13px, #1ed18a 13px 18px),
    #0f1720;
}

.news-item h3 {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.2;
}

.news-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.portfolio-drawer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  justify-items: end;
  background: rgba(0, 0, 0, .55);
}

.portfolio-drawer[hidden] {
  display: none;
}

.drawer-panel {
  width: min(430px, 100vw);
  height: 100%;
  padding: 22px;
  background: var(--panel-strong);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

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

.portfolio-empty,
.portfolio-item {
  padding: 15px;
  border: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .04);
}

.portfolio-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.portfolio-item strong {
  display: block;
}

.portfolio-item span,
.portfolio-empty {
  color: var(--muted);
}

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

  .side-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

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

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

  .ticker-search {
    width: 100%;
  }

  .hero-row,
  .toolbar,
  .chart-header {
    align-items: stretch;
    flex-direction: column;
  }

  .price-block,
  .chart-stat {
    justify-items: start;
    text-align: left;
  }

  .range-control {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .range-control button,
  .add-button,
  .portfolio-button {
    width: 100%;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .main-panel,
  .side-panel > section {
    padding: 16px;
  }

  .news-item {
    grid-template-columns: 1fr;
  }

  .thumb {
    width: 100%;
  }
}
