:root {
  --bg: #000000;
  --bg-2: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --accent: #ffcc00;
  --accent-strong: #e6b800;
  --accent-deep: #cc9900;
  --gold: #ffcc00;
  --ink: #f2f2f2;
  --muted: #b0b0b0;
  --line: #2a2a2a;
  --line-soft: #1f1f1f;
  --danger: #e5736a;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --font: "Outfit", "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(255, 204, 0, 0.18), transparent 55%),
    linear-gradient(165deg, #000000 0%, #0d0d0d 40%, #1a1400 70%, #000000 100%);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
#app { min-height: 100vh; }

.screen { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(20, 16, 0, 0.95), rgba(0, 0, 0, 0.92));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid #2a2400;
}
.topbar h1 {
  margin: 0; flex: 1;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.topbar .sub {
  display: block;
  font-family: var(--font);
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}
.icon-btn, .btn, .chip { border: 0; border-radius: 12px; cursor: pointer; transition: .15s ease; }
.icon-btn {
  width: 42px; height: 42px;
  background: #141414;
  color: var(--accent);
  display: grid; place-items: center;
  font-size: 1.15rem;
  border: 1px solid #2a2a2a;
}
.icon-btn:hover { background: #1c1c1c; }
.btn {
  padding: 13px 16px;
  background: linear-gradient(180deg, #ffcc00 0%, #e6b800 55%, #000000 160%);
  color: #000;
  font-weight: 700;
  width: 100%;
  border: 1px solid #ffcc00;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn.secondary {
  background: linear-gradient(180deg, #1a1a1a, #000);
  color: var(--accent);
  border: 1px solid #3a3200;
}
.btn.danger {
  background: linear-gradient(180deg, #c45a52, #9e3f38);
  color: #fff;
  border-color: transparent;
}
.content {
  padding: 18px;
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
  flex: 1;
}
.card {
  background: linear-gradient(165deg, #161616 0%, #0a0a0a 100%);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.trial-inline {
  margin-top: 4px;
  font-size: .78rem;
  color: #f5c518;
  line-height: 1.3;
}
.name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sub-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.sub-dot.ok { background: #2e7d32; }
.sub-dot.bad { background: #c62828; }
.trial-inline .link-btn,
.link-btn {
  background: none;
  border: none;
  color: #f5c518;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 600;
  font-size: .78rem;
}
.link-btn.bad { color: #ef5350; }
.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 650;
  color: var(--ink);
}
.muted { color: var(--muted); font-size: .9rem; }
.row { display: flex; gap: 8px; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.metric {
  background: linear-gradient(160deg, #1a1600, #0a0a0a);
  border: 1px solid #2a2400;
  border-radius: 12px;
  padding: 12px;
}
.metric .label {
  font-size: .7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.metric .value {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.metric.metric-em .value { font-size: 1.28rem; }
.share-row { margin: 10px 0; }
.share-row .bar {
  height: 8px;
  background: #222;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.share-row .bar > span {
  display: block;
  height: 100%;
  background: var(--accent, #c9a227);
}
.tone-ok { color: #7dcea0; font-weight: 650; }
.tone-bad { color: var(--danger, #e57373); font-weight: 650; }
.section-label {
  margin: 14px 0 8px;
  font-size: .78rem;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.mini-stat {
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: #121212;
  border: 1px solid #2a2a2a;
}
.mini-stat strong {
  display: block;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.mini-stat span {
  display: block;
  margin-top: 2px;
  font-size: .68rem;
  color: var(--muted);
}
.detail-rows { display: flex; flex-direction: column; gap: 8px; }
.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  font-size: .92rem;
}
.detail-row span { color: var(--muted); }
.detail-row strong { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }

label.field { display: block; margin-bottom: 12px; }
label.field span {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 550;
}
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: #0a0a0a;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.2);
}
option { background: #0a0a0a; color: var(--ink); }
textarea { min-height: 88px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  color: var(--ink);
  font-weight: 500;
}
.chip.active {
  background: linear-gradient(180deg, #ffcc00, #cc9900);
  color: #000;
  border-color: #ffcc00;
}

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
}
.auth-box {
  width: min(420px, 100%);
  border-radius: 24px;
  padding: 28px 24px;
  background: linear-gradient(165deg, #161200, #0a0a0a) !important;
  border: 1px solid #2a2400;
}
.auth-logo {
  width: 112px; height: 112px;
  display: block;
  margin: 0 auto 14px;
}
.auth h1 {
  text-align: center;
  font-family: var(--display);
  color: var(--accent);
  margin: 0 0 4px;
  font-size: 1.85rem;
  letter-spacing: -0.03em;
}
.auth .tag {
  text-align: center;
  color: var(--muted);
  margin: 0 0 22px;
}
.err { color: var(--danger); font-size: .9rem; margin: 8px 0; }
.ok { color: var(--accent); font-size: .9rem; margin: 8px 0; }

.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 40;
}
.drawer {
  position: fixed; inset: 0 auto 0 0;
  width: min(300px, 86vw);
  z-index: 50;
  background: linear-gradient(180deg, #0f0c00, #000);
  padding: 0 0 20px;
  overflow: auto;
  box-shadow: 8px 0 32px rgba(0, 0, 0, .55);
  border-right: 1px solid #2a2400;
}
.drawer .brand {
  display: flex; gap: 12px; align-items: flex-start;
  justify-content: space-between;
  padding: 22px 18px;
  background: linear-gradient(160deg, #1a1500, #000);
  border-bottom: 1px solid #2a2400;
  margin-bottom: 10px;
}
.drawer .brand-main {
  display: flex; gap: 12px; align-items: center; min-width: 0;
}
.drawer .brand img { width: 56px; height: 56px; }
.drawer .brand strong {
  font-family: var(--display);
  color: var(--accent);
  font-size: 1.1rem;
}
.drawer .brand-support {
  max-width: 42%;
  text-align: right;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.drawer .brand-support .support-title {
  font-weight: 700;
  font-size: .82rem;
  color: var(--accent);
}
.drawer .brand-support .support-contact {
  font-size: .72rem;
  color: var(--muted);
  word-break: break-word;
  margin-top: 2px;
}

.weight-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  margin: 8px 0 10px;
  font-size: .78rem;
  color: var(--muted);
}
.weight-legend span { display: inline-flex; align-items: center; gap: 6px; }
.weight-legend i {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block;
}
.weight-evo-chart {
  width: 100%;
  height: 220px;
  display: block;
  background: #0a0a0a;
  border-radius: 12px;
  border: 1px solid #2a2400;
}
.drawer nav { padding: 0 10px; }
.drawer nav button {
  width: 100%; text-align: left;
  padding: 12px 14px; margin-bottom: 3px;
  background: transparent; border: 0;
  border-radius: 12px; cursor: pointer;
  color: var(--ink); font-weight: 500;
}
.drawer nav button.active,
.drawer nav button:hover {
  background: #1a1500;
  color: var(--accent);
  font-weight: 650;
}

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: linear-gradient(180deg, #0a0a0a, #000);
  border-top: 1px solid #2a2400;
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(12px);
}
.bottom-nav button {
  background: transparent; border: 0;
  color: var(--muted); font-size: .68rem;
  padding: 6px 2px; cursor: pointer; font-weight: 550;
}
.bottom-nav button.active { color: var(--accent); font-weight: 700; }
.bottom-nav .ico {
  display: grid; place-items: center;
  width: 28px; height: 28px; margin: 0 auto 3px;
  border-radius: 8px;
  font-size: .7rem; font-weight: 700;
  letter-spacing: 0.02em;
  background: transparent;
  color: inherit;
}
.bottom-nav button.active .ico {
  background: #1a1500;
  color: var(--accent);
}

.list-item {
  display: block; width: 100%; text-align: left;
  background: linear-gradient(165deg, #161616, #0a0a0a);
  border: 1px solid #2a2a2a;
  border-radius: 14px; padding: 14px 16px;
  margin-bottom: 8px; cursor: pointer; color: inherit;
  transition: border-color .15s;
}
.list-item:hover { border-color: var(--accent); }
.actions { display: grid; gap: 8px; margin-top: 12px; }
.toast {
  position: fixed; left: 50%; bottom: 88px;
  transform: translateX(-50%);
  background: #141200; color: var(--ink);
  border: 1px solid #3a3200;
  padding: 11px 18px; border-radius: 12px;
  font-size: .86rem; z-index: 80; max-width: 90vw;
  box-shadow: var(--shadow);
}
.update-backdrop {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
}
.update-dialog { width: min(420px, 100%); margin: 0; }
.update-dialog p { margin: 8px 0 0; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }
.badge {
  display: inline-block; font-size: .7rem; font-weight: 700;
  padding: 4px 9px; border-radius: 8px; text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge.ok { background: #1a1500; color: var(--accent); }
.badge.bad { background: #3a1c18; color: var(--danger); }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
  .shell .drawer-backdrop { display: none !important; }
  .shell .drawer {
    position: sticky; top: 0; height: 100vh; width: auto;
    box-shadow: none;
  }
  .shell .main { min-width: 0; }
  .bottom-nav { display: none; }
  .content { padding: 28px; padding-bottom: 48px; max-width: 980px; }
  .desktop-only-open { display: none !important; }
}
