/* Arc Torn by Genie — dark Torn-style theme */
:root {
  --bg: #0d1117;
  --bg2: #161b22;
  --card: #161b22;
  --line: #21262d;
  --txt: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
  --energy: #f85149;
  --nerve: #58a6ff;
  --happy: #d29922;
  --life: #3fb950;
  --radius: 10px;
}

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

body {
  background: var(--bg);
  color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }

/* Layout */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { font-weight: 800; font-size: 22px; letter-spacing: 1px; margin-bottom: 22px; }
.brand span { color: var(--accent); }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.brand-big { text-align: center; font-size: 30px; margin-bottom: 6px; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a, .nav-off, .nav-soon {
  padding: 9px 12px; border-radius: 8px; color: var(--txt); font-weight: 500;
}
.sidebar nav a:hover { background: #1c2129; }
.sidebar nav a.active { background: #1f6feb33; color: var(--accent); }
.nav-off, .nav-soon { color: var(--muted); font-size: 13px; cursor: default; }
.nav-off em, .nav-soon em { display: block; font-style: normal; font-size: 10px; opacity: .8; }

.side-foot { margin-top: auto; color: var(--muted); font-size: 11px; text-align: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: var(--bg2);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar-in { display: flex; align-items: center; gap: 10px; }

.content { padding: 22px; max-width: 1100px; width: 100%; margin: 0 auto; }

/* Cards & grids */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
}
.card h2 { font-size: 16px; margin-bottom: 12px; }
.card h3 { font-size: 14px; margin-bottom: 8px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: 1fr 1fr; }
.center-card { text-align: center; max-width: 520px; margin: 40px auto; }
.card hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr.hl td { color: var(--ok); font-weight: 700; border-top: 1px solid var(--line); }
.tbl tr.earned td { opacity: .75; }
.tag { white-space: nowrap; color: var(--muted); font-size: 12px; text-align: right; }
.tag.ok { color: var(--ok); font-weight: 600; }

/* Bars */
.bar-row { margin-bottom: 14px; }
.bar-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-name { font-weight: 600; }
.bar-val { color: var(--muted); }
.bar-val b { color: var(--txt); }
.track { background: #0a0d12; border: 1px solid var(--line); border-radius: 6px; height: 14px; overflow: hidden; }
.fill { height: 100%; border-radius: 5px; transition: width .6s ease; }
.fill-energy { background: var(--energy); }
.fill-nerve { background: var(--nerve); }
.fill-happy { background: var(--happy); }
.fill-life { background: var(--life); }
.bar-sub { font-size: 11px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.chain-chip { margin-top: 8px; font-size: 13px; color: var(--warn); font-weight: 600; }

/* Stats grid */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: #0a0d12; border: 1px solid var(--line); border-radius: 8px; padding: 10px; text-align: center; }
.stat-v { display: block; font-weight: 700; font-size: 16px; color: var(--accent); }
.stat-k { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }

/* Cooldowns */
.cd-list { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cd-list li {
  background: #0a0d12; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; display: flex; justify-content: space-between; font-size: 13px;
}
.cd-val { font-variant-numeric: tabular-nums; color: var(--warn); }
.cd-val.done { color: var(--ok); }

/* Status chips */
.who-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.state { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-okay { background: #3fb95033; color: var(--ok); }
.st-hospital, .st-jail { background: #f8514933; color: var(--err); }
.st-traveling, .st-abroad { background: #58a6ff33; color: var(--accent); }

/* Badges & buttons */
.badge { padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-l1 { background: #8b949e33; color: var(--muted); }
.badge-l2 { background: #d2992233; color: var(--warn); }
.badge-l3 { background: #58a6ff33; color: var(--accent); }
.badge-l4 { background: #3fb95033; color: var(--ok); }

.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--bg2);
  color: var(--txt); padding: 8px 16px; border-radius: 8px; font-size: 14px;
  font-weight: 600; cursor: pointer; text-align: center;
}
.btn:hover { background: #1c2129; }
.btn-primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.btn-primary:hover { background: #388bfd; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); padding: 6px 12px; }
.btn-block { width: 100%; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-err { background: #f8514922; border: 1px solid #f8514955; color: #ff8b85; }
.flash-ok { background: #3fb95022; border: 1px solid #3fb95055; color: #7ee787; }

/* Forms */
.fld { display: block; margin-bottom: 14px; }
.fld span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select {
  width: 100%; padding: 10px 12px; border-radius: 8px; font-size: 15px;
  background: #0a0d12; border: 1px solid var(--line); color: var(--txt);
}
input:focus, select:focus { outline: none; border-color: var(--accent); }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row select { flex: 0 0 200px; width: 200px; }
.filter-in { margin-bottom: 10px; }

/* Travel */
.travel-live { text-align: center; }
.travel-live .btn { margin-top: 10px; }
.big-count {
  font-size: 44px; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums; margin: 16px 0; letter-spacing: 2px;
}
.big-count.done { color: var(--ok); }
.tip-list { margin-left: 18px; display: grid; gap: 8px; font-size: 14px; }

/* Market */
.item-head { display: flex; justify-content: space-between; align-items: flex-start; margin: 14px 0 10px; }
.mini-h { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin: 14px 0 6px; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.item-card {
  background: #0a0d12; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; display: flex; flex-direction: column; gap: 3px; color: var(--txt);
}
.item-card:hover { border-color: var(--accent); }
.item-mv { color: var(--ok); font-weight: 700; font-size: 13px; }

/* Auth page */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-wrap { width: 100%; max-width: 460px; }
.auth-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px;
}
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; text-align: center; }
.auth-help { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.auth-help h3 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); }
.auth-help ol { margin-left: 18px; font-size: 13px; }
.auth-help .tbl td { font-size: 13px; padding: 5px 6px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.flash + .card, .content > .card:first-child { margin-top: 0; }

/* History */
.delta-pos { color: var(--ok); }
.delta-neg { color: #f85149; }

/* Stocks */
.tbl th {
  text-align: right; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px;
  padding: 6px 8px; border-bottom: 1px solid var(--line);
}
.tbl th:first-child { text-align: left; }
.verdict { padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.v-hold { background: #3fb95033; color: var(--ok); }
.v-sell { background: #f8514933; color: var(--err); }
.v-watch { background: #d2992233; color: var(--warn); }
.div-ready {
  background: #3fb95033; color: var(--ok); padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap;
}

/* Donations */
.donate-upi { display: flex; gap: 22px; align-items: center; justify-content: center; flex-wrap: wrap; }
.qr-img { background: #fff; border-radius: 10px; padding: 6px; border: 1px solid var(--line); }
.donate-upi-side { display: flex; flex-direction: column; gap: 10px; align-items: stretch; min-width: 200px; }
.upi-id {
  font-family: ui-monospace, monospace; font-size: 16px; font-weight: 600;
  background: #0a0d12; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px;
  text-align: center; user-select: all;
}
.donate-btns { display: flex; flex-direction: column; gap: 14px; align-items: center; }
.btn-don { min-width: 260px; }
.crypto-addr { font-size: 12px; word-break: break-all; }
.don-amt-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.don-amt-row input[type="number"] { flex: 1 1 150px; }
.amt-chip {
  background: var(--bg2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 999px; padding: 9px 16px; cursor: pointer; font-size: 14px;
}
.amt-chip:hover { border-color: var(--accent); color: var(--accent); }
.don-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; text-align: left; margin-bottom: 14px; }
.payu-test {
  background: #d2992222; border: 1px solid #d2992255; color: var(--warn);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 12px;
}

/* PWA install (topbar) — browser ready hone par JS dikhaata hai */
#btn-install { display: none; }
.topbar { flex-wrap: wrap; gap: 8px; }
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart-lbl { fill: var(--muted); font-size: 11px; font-family: ui-monospace, monospace; }
.chart-area { fill: #2ea04322; }
.chart-line { fill: none; stroke: #2ea043; stroke-width: 2; stroke-linejoin: round; }
.chart-dot { fill: #0d1117; stroke: #2ea043; stroke-width: 2; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 12px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .brand { margin-bottom: 10px; font-size: 18px; }
  .brand small { display: inline; margin-left: 6px; }
  .side-foot { display: none; }
  .g2, .cd-list, .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .g2, .cd-list, .stat-grid { grid-template-columns: 1fr; }
  .content { padding: 14px; }
  .big-count { font-size: 34px; }
}
