:root {
  --bg: #f8fafc;
  --header: #0f172a;
  --text: #1e293b;
  --muted: #64748b;
  --green: #16a34a;
  --blue: #2563eb;
  --red: #dc2626;
  --aqua: #00ffff;
  --yellow: #facc15;
  --sold: #9ca3af;
  --selected: #dbeafe;
  --row-even: #f1f5f9;
  --row-odd: #f8fafc;
  --track: #e2e8f0;
  --border: #cbd5e1;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.hidden { display: none !important; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: linear-gradient(160deg, #0f172a, #1e3a5f 55%, #0f766e);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate-card {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 24px 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}
.gate-card h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}
.gate-card p { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.gate-card input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 10px;
}
.gate-card button {
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: 8px;
  background: #1e40af;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}
.error { color: var(--red) !important; min-height: 1.2em; }
.muted { color: var(--muted); font-size: 0.85em; }

.header {
  background: var(--header);
  color: #fff;
  padding: 10px 12px 8px;
  flex-shrink: 0;
}
.header-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.brand { font-weight: 800; font-size: 1.1rem; letter-spacing: 0.03em; }
.ilerleme { margin-top: 3px; color: #86efac; font-weight: 700; font-size: 0.85rem; }
.status { margin-top: 2px; color: #cbd5e1; font-size: 0.72rem; }
.user-chip {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
  white-space: nowrap;
}
.linkish {
  background: none;
  border: 0;
  color: #93c5fd;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0;
  margin-left: 6px;
  text-decoration: underline;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.btn {
  flex: 1;
  border: 0;
  border-radius: 6px;
  padding: 8px 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #fff;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.blue { background: #1e40af; }
.btn.gray { background: #475569; }
.btn.dark { background: #1e293b; }
.btn.green { background: var(--green); }
.btn.small { flex: 0; padding: 6px 12px; font-size: 0.8rem; }

.list-header {
  background: #e2e8f0;
  color: #475569;
  font-size: 0.65rem;
  padding: 4px 8px;
  flex-shrink: 0;
}

.main {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.bars-host {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.row {
  display: grid;
  grid-template-columns: 72px 1fr 52px 58px;
  gap: 4px 6px;
  align-items: center;
  padding: 6px 8px 8px;
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  flex: 1;
  min-height: 52px;
}
.row.even { background: var(--row-even); }
.row.odd { background: var(--row-odd); }
.row.selected {
  background: var(--selected);
  box-shadow: inset 4px 0 0 var(--blue);
}
.row.sold { opacity: 0.75; }

.code {
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.15;
}
.sub {
  grid-column: 2 / -1;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: -2px;
}

.bar-track {
  position: relative;
  height: 14px;
  background: var(--track);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: visible;
}
.bar-fill {
  height: 100%;
  border-radius: 2px;
  min-width: 0;
}
.star-wrap {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 3px;
}
.star {
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 0 2px #fff) drop-shadow(0 0 3px #fff);
}
.star-gain {
  font-size: 0.62rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  text-shadow: 0 0 3px #fff, 0 0 4px #fff;
}

.live, .pct {
  font-size: 0.75rem;
  text-align: right;
}
.pct { font-weight: 800; }

.chart-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 48vh;
  background: #fff;
  border-top: 2px solid #1e293b;
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18);
  padding: 8px 10px 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
#chartCanvas {
  width: 100%;
  height: auto;
  max-height: 36vh;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.chart-meta {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

@media (min-width: 900px) {
  body {
    max-width: 720px;
    margin: 0 auto;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
  }
}
