
:root {
  color-scheme: dark;
  --bg: #10131a;
  --panel: #181d28;
  --panel-2: #202736;
  --text: #f5f0df;
  --muted: #a8adba;
  --gold: #d7ad45;
  --gold-2: #f0cd72;
  --danger: #ff7b72;
  --ok: #8bd49a;
  --line: #303849;
  --radius: 20px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #2a2415 0, transparent 34rem), var(--bg);
  color: var(--text);
  font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: calc(.75rem + env(safe-area-inset-top)) 1rem .75rem;
  background: rgba(16,19,26,.9); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(215,173,69,.25);
}
.brand { color: var(--gold-2); font-weight: 800; letter-spacing: .02em; text-decoration: none; }
.identity-box { display: flex; align-items: center; gap: .45rem; font-size: .82rem; color: var(--muted); }
.identity-box select { max-width: 8.5rem; }
.test-badge { color: #17130a; background: var(--gold); border-radius: 999px; padding: .18rem .45rem; font-weight: 700; }
.app-shell, .login-shell { width: min(100%, 760px); margin: 0 auto; padding: 1rem 1rem 6.5rem; }
.login-shell { padding-top: 12vh; }
.login-card, .card, .loading-card {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; box-shadow: 0 18px 50px rgba(0,0,0,.25);
}
.login-card { padding: 1.4rem; }
h1 { font-size: clamp(1.7rem, 8vw, 3rem); line-height: 1.02; margin: .2rem 0 .8rem; }
h2 { margin: .2rem 0 .8rem; font-size: 1.35rem; }
h3 { margin: .4rem 0; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }
.success { color: var(--ok); }
.stack { display: grid; gap: .85rem; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .grid.two { grid-template-columns: minmax(0, 1fr); } }
label { display: grid; gap: .35rem; color: var(--muted); font-size: .9rem; }
input, select, textarea {
  width: 100%; min-width: 0; max-width: 100%; border: 1px solid var(--line); border-radius: 14px;
  background: #111722; color: var(--text); padding: .8rem .9rem; font: inherit;
}
/* Shared shrink rules prevent native date/select/file controls from expanding grids. */
.stack, .grid, .grid > *, .stack > *, label, fieldset, .card, .day-row > *, .bar-row > * { min-width: 0; }
fieldset { min-inline-size: 0; max-width: 100%; margin: 0; }
input, select, textarea { display: block; min-inline-size: 0; font-size: 16px; }
input[type="date"] { min-height: 44px; }
input[type="date"]::-webkit-date-and-time-value { min-width: 0; text-align: left; }
.card { overflow-wrap: anywhere; }
textarea { min-height: 5.5rem; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus, a:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
button, .button {
  border: 1px solid var(--line); border-radius: 999px; padding: .75rem 1rem;
  background: #252d40; color: var(--text); font: inherit; font-weight: 700;
  text-decoration: none; display: inline-flex; justify-content: center; align-items: center; gap: .4rem;
  cursor: pointer; min-height: 44px;
}
button.primary, .button.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1507; border-color: #f3d787; }
button.danger { border-color: rgba(255,123,114,.6); color: #ffb0aa; background: rgba(120,30,25,.25); }
button.ghost { background: transparent; }
button:disabled { opacity: .45; cursor: wait; }
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 20;
  width: min(100%, 760px); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: .45rem .45rem calc(.45rem + env(safe-area-inset-bottom));
  background: rgba(16,19,26,.94); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.bottom-nav a { text-align: center; text-decoration: none; padding: .65rem .2rem; border-radius: 999px; color: var(--muted); font-weight: 700; }
.bottom-nav a.active { background: rgba(215,173,69,.18); color: var(--gold-2); }
.hero-img, .thumb { width: 100%; object-fit: cover; background: #2a3040; }
.hero-img { height: 230px; border-radius: 16px; }
.thumb { height: 150px; border-radius: 14px; }
.poll-thumb { height: 72px; border-radius: 12px; }
.placeholder {
  display: grid; place-items: center; color: var(--gold-2); font-size: 2.3rem; font-weight: 900;
  background: linear-gradient(145deg, #3a2f16, #222a3d);
}
.item-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
@media (max-width: 430px) { .item-grid { grid-template-columns: minmax(0, 1fr); } }
.item-card { overflow: hidden; padding: .75rem; }
.item-card h3 { font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: .28rem .55rem; color: var(--muted); font-size: .78rem; }
.chip.fast { color: #ffd0cc; border-color: rgba(255,123,114,.55); }
.chip.healthy { color: #c9f2d2; border-color: rgba(139,212,154,.45); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.actions > * { flex: 1 1 auto; }
.toolbar { display: grid; gap: .7rem; margin-bottom: 1rem; }
.toolbar-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 620px) { .toolbar-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.poll-option { border: 1px solid var(--line); border-radius: 16px; padding: .8rem; background: rgba(255,255,255,.03); }
.poll-option.selected { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.day-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .8rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.day-row:last-child { border-bottom: 0; }
.stat { font-size: 2rem; font-weight: 900; color: var(--gold-2); }
.bar-row { display: grid; grid-template-columns: 7rem minmax(0, 1fr) 2rem; gap: .6rem; align-items: center; }
.bar { height: .7rem; background: #111722; border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); }
.checkline { display: flex !important; grid-template-columns: none !important; align-items: center; gap: .6rem; color: var(--text); }
.checkline input { width: auto; }
.small { font-size: .86rem; }
.hidden { display: none !important; }
@media (max-width: 560px) {
  .test-badge { display: none; }
  .identity-box label { display: none; }
  .identity-box select { max-width: 6.8rem; padding: .55rem; }
  .identity-box button { padding: .55rem .7rem; }
  .brand { font-size: .95rem; }
}
