:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #121820;
  --panel-2: #18202b;
  --line: #243040;
  --text: #e8edf3;
  --muted: #8a97a8;
  --down: #ff4d5e;
  --down-soft: rgba(255, 77, 94, 0.14);
  --up: #2bd67b;
  --gold: #ffc542;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
body > .wrap { flex: 1; }
a { color: var(--text); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; width: 100%; }

/* Ticker tape (matches the landing page) */
.tape {
  border-bottom: 1px solid var(--line); background: #080b0f; overflow: hidden; white-space: nowrap;
  font-family: var(--mono); font-size: 13px;
}
.tape-track { display: inline-block; padding: 8px 0; animation: tape-scroll 40s linear infinite; }
.tape span { margin: 0 22px; color: var(--muted); }
.tape b { color: var(--text); font-weight: 600; margin-right: 6px; }
.tape i { font-style: italic; }
.tape .tape-you b { color: var(--down); }
.tape .tape-you { background: var(--down-soft); padding: 2px 8px; border-radius: 4px; }
@keyframes tape-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tape-track { animation: none; } }

/* Nav */
.topnav { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; gap: 12px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; letter-spacing: -0.02em; text-decoration: none; }
.logo img { border-radius: 7px; box-shadow: 0 0 0 1.5px rgba(70, 140, 255, 0.55), 0 0 12px rgba(70, 140, 255, 0.35); }
.logo em { font-style: normal; color: var(--down); }
.navlinks { display: flex; align-items: center; gap: 16px; font-size: 14px; font-weight: 600; }
.navlinks > a { text-decoration: none; white-space: nowrap; }
.navlinks > a:not(.ticker-chip):not(.balance-chip):not(.nav-cta) { color: var(--muted); }
.navlinks > a:not(.ticker-chip):not(.balance-chip):not(.nav-cta):hover,
.navlinks > a[aria-current="page"]:not(.ticker-chip):not(.balance-chip) { color: var(--text); }
.navlinks > a[aria-current="page"]:not(.ticker-chip):not(.balance-chip) { text-decoration: underline; text-decoration-color: var(--down); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.ticker-chip[aria-current="page"], .balance-chip[aria-current="page"] { box-shadow: inset 0 0 0 1px currentColor; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-actions-end { align-items: center; gap: 12px; }
.page-head-back { margin-bottom: 12px; }
.nav-cta { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; }
.nav-cta:hover { border-color: var(--down); }
.ticker-chip { font-family: var(--mono); color: var(--down) !important; background: var(--down-soft); padding: 5px 10px; border-radius: 6px; }
.inline { display: inline; margin: 0; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.linkbtn:hover { color: var(--text); }

/* Layout */
main { padding: 24px 0 64px; margin: 0 auto; }
.main-narrow { max-width: 460px; }
.main-wide { max-width: 860px; }
.main-full { max-width: 1120px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
}
h1 { font-size: 28px; letter-spacing: -0.03em; margin: 0 0 6px; line-height: 1.15; }
h2 { font-size: 20px; letter-spacing: -0.02em; margin: 0 0 12px; }
.muted { color: var(--muted); margin: 0 0 20px; }

/* Forms */
label { display: block; font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.label-link { float: right; font-weight: 500; color: var(--muted); }
input[type=email], input[type=password], input[type=text], .icon-picker input[type=search] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
}
input:focus { outline: none; border-color: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.prefix-input { display: flex; align-items: stretch; }
.prefix-input span {
  display: flex; align-items: center; padding: 0 12px;
  font-family: var(--mono); font-weight: 600; color: var(--down);
  background: var(--panel-2); border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px;
}
.prefix-input input { border-radius: 0 10px 10px 0; font-family: var(--mono); text-transform: uppercase; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--muted); }
.check input { width: 16px; height: 16px; accent-color: var(--down); }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.field-error { font-size: 13px; color: var(--gold); margin: 6px 0 0; }

.btn {
  display: inline-block;
  width: 100%;
  margin-top: 22px;
  background: var(--down);
  color: #fff;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  padding: 13px 20px;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.btn-danger { background: transparent; border: 1px solid var(--down); color: var(--down); }
.below { text-align: center; color: var(--muted); font-size: 14px; margin: 20px 0 0; }

.alert, .flash {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 18px;
}
.alert { background: rgba(255, 197, 66, 0.1); border: 1px solid rgba(255, 197, 66, 0.35); color: var(--gold); }
.flash-ok { background: rgba(43, 214, 123, 0.1); border: 1px solid rgba(43, 214, 123, 0.35); color: var(--up); }
.flash-error { background: rgba(255, 197, 66, 0.1); border: 1px solid rgba(255, 197, 66, 0.35); color: var(--gold); }
.flash-info { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }

/* Account */
.ticker-card .sym { font-family: var(--mono); font-weight: 600; font-size: 40px; color: var(--down); letter-spacing: -0.02em; }
.ticker-card .muted { margin-bottom: 16px; }
.coming-soon { background: var(--panel-2); border-radius: 10px; padding: 14px 16px; color: var(--muted); font-size: 14px; }
.coming-soon strong { display: block; color: var(--text); }
details.danger summary { cursor: pointer; font-weight: 700; color: var(--down); }
details.danger[open] summary { margin-bottom: 12px; }

footer { border-top: 1px solid var(--line); padding: 24px 0 32px; color: var(--muted); font-size: 13px; }
.footer-row { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; }
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }
.about p { line-height: 1.6; }
.credits dt { font-weight: 700; margin-top: 14px; }
.credits dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.credits a { color: var(--text); }

/* Shared app pieces ------------------------------------------------------- */
h3 { font-size: 15px; margin: 24px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
select, input[type=date], input[type=time] {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 15px; padding: 11px 12px; border-radius: 10px;
}
select:focus, input[type=date]:focus, input[type=time]:focus { outline: none; border-color: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font-family: var(--mono); font-size: 13px; padding: 12px; border-radius: 10px; resize: vertical;
}
.optional { font-weight: 400; color: var(--muted); font-size: 12px; }
.muted-sm { color: var(--muted); font-size: 13px; }
.dn { color: var(--down); }
.up { color: var(--up); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.btn-small {
  display: inline-block; background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 8px; cursor: pointer; text-decoration: none;
}
.btn-small:hover { border-color: var(--muted); }
.btn-small.btn-danger { color: var(--down); border-color: rgba(255, 77, 94, 0.5); background: transparent; }
.btn-secondary { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn-inline { width: auto; margin-top: 0; }

.card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .muted { margin: 0; }
.head-link { margin-left: auto; font-size: 14px; color: var(--muted); }
.card-editing { border-color: rgba(255, 197, 66, 0.5); }

/* Weigh-in form */
.when { position: relative; margin-top: 14px; }
.when-now {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 14px;
}
.when-icon { color: var(--muted); flex: none; }
#now-text { font-family: var(--mono); font-weight: 600; }
.when-tz { color: var(--muted); font-size: 13px; }
.override-link {
  display: inline; margin: 0 0 0 auto; font-size: 13px; font-weight: 600; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.override-link:hover { color: var(--text); }
.override-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.override-toggle:focus-visible ~ .when-now .override-link { outline: 2px solid var(--down); outline-offset: 2px; border-radius: 3px; }
.override-panel { display: none; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px 14px 14px; }
.override-toggle:checked ~ .when-now { display: none; }
.override-toggle:checked ~ .override-panel, .when-editing .override-panel { display: block; }
.when-editing .override-panel { background: none; border: 0; padding: 0; }
.override-fields { display: grid; grid-template-columns: 1fr 0.8fr 1.4fr; gap: 0 14px; }
.override-panel .override-link { display: inline-block; margin: 12px 0 0; }
.field-weight { max-width: 260px; }
.field-weight input { font-family: var(--mono); font-size: 22px; font-weight: 600; padding: 8px 14px; }
.form-actions { display: flex; align-items: center; gap: 18px; }
.form-actions .btn { width: auto; padding-left: 28px; padding-right: 28px; }
.cancel { margin-top: 22px; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.history, table.preview { width: 100%; border-collapse: collapse; font-size: 14px; }
.history th, .preview th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted);
  font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.history td, .preview td { padding: 9px 10px; border-bottom: 1px solid rgba(36, 48, 64, 0.6); vertical-align: middle; }
.history tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.history .num, .history th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.muted-cell { color: var(--muted); }
.col-check { width: 32px; }
.col-check input { width: 16px; height: 16px; accent-color: var(--down); }
.col-note { color: var(--muted); max-width: 280px; overflow-wrap: anywhere; }
.actions { white-space: nowrap; text-align: right; }
.actions a, .actions .linkbtn { font-size: 13px; margin-left: 12px; }
.actions a { color: var(--muted); }
.actions a:hover { color: var(--text); }
.danger-link:hover { color: var(--down); }
.row-editing td { background: rgba(255, 197, 66, 0.07); }
.tag {
  display: inline-block; font-size: 11px; font-family: var(--mono); color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 4px; vertical-align: 1px;
}
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager { display: flex; gap: 16px; align-items: center; font-size: 14px; color: var(--muted); }

/* Import */
.step-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--down-soft); color: var(--down); font-family: var(--mono); font-size: 13px; margin-right: 6px; vertical-align: 2px;
}
.dropzone {
  position: relative; display: block; text-align: center; margin: 0; padding: 34px 20px;
  border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; font-weight: 500; color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--down); background: var(--down-soft); }
.dropzone:focus-within { border-color: var(--down); }
.dropzone strong { color: var(--text); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.dz-icon { display: block; font-size: 26px; color: var(--down); margin-bottom: 6px; }
.dz-link { color: var(--down); text-decoration: underline; }
.dz-file { display: block; margin-top: 8px; font-family: var(--mono); font-size: 13px; color: var(--text); }
.paste { margin-top: 16px; }
.paste summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.paste textarea { margin: 10px 0; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; margin-bottom: 14px; }
.preview { font-family: var(--mono); font-size: 12px; }
.preview td { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.preview .hl { color: var(--text); background: rgba(255, 77, 94, 0.07); }
.tag-map { color: var(--down); border-color: rgba(255, 77, 94, 0.5); text-transform: none; letter-spacing: 0; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.summary .stat, .stats-grid .stat { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; }
.unit-warning { background: rgba(255, 197, 66, 0.1); border: 1px solid rgba(255, 197, 66, 0.35); color: var(--gold); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.bad-rows { margin-top: 14px; }
.bad-rows summary { cursor: pointer; color: var(--gold); font-size: 14px; }
.gap { text-align: center; color: var(--muted); font-size: 12px; }

/* Dashboard */
.quote-bar { display: flex; align-items: center; gap: 14px 28px; margin: 4px 0 18px; flex-wrap: wrap; }
.quote-id .sym { font-family: var(--mono); font-weight: 600; font-size: 34px; color: var(--down); letter-spacing: -0.02em; line-height: 1.1; }
.quote-px { font-family: var(--mono); }
.quote-px .last { font-size: 30px; font-weight: 600; line-height: 1.1; }
.quote-px .chg { font-size: 14px; }
.quote-bar .btn { margin-left: auto; }
.rating { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; padding: 4px 10px; border-radius: 5px; }
.r-strong-sell { background: var(--down); color: #fff; }
.r-sell { background: var(--down-soft); color: var(--down); }
.r-hold { background: var(--panel-2); color: var(--muted); }
.r-buy { background: rgba(43, 214, 123, 0.12); color: var(--up); }
.r-strong-buy { background: var(--up); color: #062312; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .v { font-family: var(--mono); font-size: 17px; font-weight: 600; margin-top: 2px; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

.chart-card { padding: 16px; }
.chart-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button {
  background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fs-btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
.fs-btn:hover { color: var(--text); border-color: #3a4a60; }
.fs-icon-exit { display: none; }
.is-fullscreen .fs-icon-enter { display: none; }
.is-fullscreen .fs-icon-exit { display: inline; }
.chart-card.is-fullscreen {
  position: fixed; inset: 0; z-index: 1000; margin: 0; border: 0; border-radius: 0;
  width: 100%; height: 100%; overflow: hidden; background: var(--panel);
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.chart-card:fullscreen { background: var(--panel); }
.chart-card::backdrop { background: var(--panel); }
html.chart-fs-open, html.chart-fs-open body { overflow: hidden; }
.indicator-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; cursor: pointer;
}
.chip[aria-pressed="true"] { color: var(--text); border-color: #3a4a60; background: var(--panel-2); }
.chip .sw { width: 10px; height: 3px; border-radius: 2px; opacity: 0.4; }
.chip[aria-pressed="true"] .sw { opacity: 1; }
.chip-pane::before { content: "\25A4"; font-size: 11px; }
.chart-wrap { position: relative; }
.chart { width: 100%; height: 420px; }
.chart-legend {
  position: absolute; top: 6px; left: 8px; z-index: 3; pointer-events: none;
  display: flex; flex-wrap: wrap; gap: 4px 12px; font-family: var(--mono); font-size: 12px; color: var(--text);
  background: rgba(18, 24, 32, 0.85); padding: 3px 6px; border-radius: 6px; max-width: calc(100% - 80px);
}
.point-pop {
  position: absolute; z-index: 5; white-space: nowrap; pointer-events: none;
  display: flex; gap: 7px; align-items: baseline;
  background: #0e141b; border: 1px solid #3a4a60; border-radius: 6px; padding: 3px 8px;
  font-family: var(--mono); font-size: 12px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  --caret-x: 50%;
}
.point-pop b { font-weight: 600; color: var(--text); }
.point-pop::after {
  content: ""; position: absolute; left: var(--caret-x); bottom: -4px; width: 7px; height: 7px; margin-left: -3.5px;
  background: #0e141b; border-right: 1px solid #3a4a60; border-bottom: 1px solid #3a4a60; transform: rotate(45deg);
}
.point-pop.pp-below::after { bottom: auto; top: -4px; transform: rotate(225deg); }
.chart-legend b { color: var(--muted); font-weight: 400; }
.chart-help { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.guide summary { cursor: pointer; font-weight: 700; }
.guide dl { margin: 14px 0 0; }
.guide dt { font-weight: 700; margin-top: 12px; }
.guide dd { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.empty-state { text-align: center; padding: 40px 28px; }
.empty-state .muted { max-width: 520px; margin: 0 auto 22px; }
.empty-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }

@media (max-width: 700px) {
  .override-fields { grid-template-columns: 1fr 1fr; }
  .override-fields .field-tz { grid-column: 1 / -1; }
  .field-weight { max-width: none; }
  .col-note { display: none; }
  .hide-sm { display: none; }
}
@media (max-width: 480px) {
  .card { padding: 22px 16px; }
  .navlinks { gap: 12px; }
  .quote-bar .btn { margin-left: 0; width: 100%; }
  .chart { height: 360px; }
  .chart-card { padding: 12px 8px; }
  .col-time, .weekday { display: none; }
  .history .actions a, .history .actions .linkbtn { display: block; margin: 2px 0; text-align: right; }
  .history td, .history th { padding-left: 6px; padding-right: 6px; }
  .fs-label { display: none; }
  .actions a, .actions .linkbtn { margin-left: 8px; }
}

/* Game ------------------------------------------------------------------- */
.balance-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); color: var(--gold) !important; background: rgba(255, 197, 66, 0.1); padding: 5px 10px; border-radius: 6px; }
.vb-icon { display: block; width: auto; height: 20px; margin: -3px 0; }
.wallet-icon { display: block; width: auto; height: 44px; }
.gain { color: var(--gold); }
.loss { color: var(--muted); }
.mono { font-family: var(--mono); }
.small { font-size: 12px; }
.page-sub { margin: 4px 0 0; }
.hint-inline { font-size: 13px; }
.wallet { display: flex; align-items: center; gap: 12px; text-align: right; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; }
.wallet .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wallet .v { font-family: var(--mono); font-size: 24px; font-weight: 600; color: var(--gold); }
.trade-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; margin-bottom: 14px; }
.stake-quick { display: flex; gap: 6px; margin-top: 8px; }
.stake-quick button {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 6px; cursor: pointer;
}
.stake-quick button:hover { color: var(--text); }
.scenarios td:first-child { color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.progress { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 5px; overflow: hidden; width: 100px; }
.progress span { display: block; height: 100%; background: var(--gold); }
.progress-0 { width: 0%; }
.progress-5 { width: 5%; }
.progress-10 { width: 10%; }
.progress-15 { width: 15%; }
.progress-20 { width: 20%; }
.progress-25 { width: 25%; }
.progress-30 { width: 30%; }
.progress-35 { width: 35%; }
.progress-40 { width: 40%; }
.progress-45 { width: 45%; }
.progress-50 { width: 50%; }
.progress-55 { width: 55%; }
.progress-60 { width: 60%; }
.progress-65 { width: 65%; }
.progress-70 { width: 70%; }
.progress-75 { width: 75%; }
.progress-80 { width: 80%; }
.progress-85 { width: 85%; }
.progress-90 { width: 90%; }
.progress-95 { width: 95%; }
.progress-100 { width: 100%; }
.btn-short { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.quote-actions { margin-left: auto; display: flex; gap: 10px; }
.quote-bar .quote-actions .btn { margin-left: 0; }
@media (max-width: 600px) {
  .trade-row { grid-template-columns: 1fr; }
  .wallet { text-align: left; }
}
@media (max-width: 480px) {
  .balance-chip, .ticker-chip { padding: 5px 7px; }
  .quote-actions { margin-left: 0; width: 100%; }
  .quote-actions .btn { flex: 1; }
}

/* Weigh-in history: rows open into an inline editor */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.history-editable .row-click { cursor: pointer; }
.history-editable .row-click:hover td { background: rgba(255, 255, 255, 0.035); }
.history-editable .row-click:focus-visible { outline: 2px solid var(--down); outline-offset: -2px; }
.history-editable .row-click.row-open td { background: var(--panel-2); border-bottom-color: transparent; }
.col-open { width: 28px; text-align: right; }
.chevron { display: inline-block; color: var(--muted); font-size: 18px; line-height: 1; transition: transform 0.25s ease; }
.row-open .chevron { transform: rotate(90deg); color: var(--text); }
.row-editor td { padding: 0 !important; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.row-editor:hover td { background: var(--panel-2) !important; }
.editor-slide { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s ease; }
.editor-slide.open { grid-template-rows: 1fr; }
.editor-slide > .editor-clip { overflow: hidden; min-height: 0; }
.editor-body { padding: 4px 14px 16px; }
.editor-fields { display: grid; grid-template-columns: 1.1fr 0.8fr 0.8fr 2fr; gap: 0 12px; }
.editor-fields label { margin-top: 8px; font-size: 13px; }
.editor-fields > div { min-width: 0; }
.editor-fields input { padding: 9px 11px; font-size: 15px; width: 100%; min-width: 0; }
.editor-fields .ed-weight input { font-family: var(--mono); font-weight: 600; }
.editor-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.editor-actions .btn { width: auto; margin-top: 0; padding: 9px 20px; font-size: 14px; }
.editor-actions .ed-delete { margin-left: auto; font-size: 13px; color: var(--muted); }
.editor-actions .ed-delete:hover { color: var(--down); }
.editor-error { color: var(--gold); font-size: 13px; margin: 8px 0 0; }
.table-hint { margin: 10px 0 0; }
@media (max-width: 700px) {
  .editor-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .editor-fields .ed-note { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) {
  .editor-slide, .chevron { transition: none; }
}

/* Phones: date and time boxes get a line each. iPhone Safari draws them at a fixed minimum
   width and ignores shrink-to-fit, so side by side they overlap on narrow screens. */
@media (max-width: 600px) {
  .editor-fields, .override-fields { grid-template-columns: minmax(0, 1fr); }
  .override-fields .field-tz, .editor-fields .ed-note { grid-column: auto; }
}
/* iPhone/iPad Safari only: make date/time boxes respect their width and match other inputs' height. */
@supports (-webkit-touch-callout: none) {
  input[type=date], input[type=time] {
    -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%;
    min-height: 44px; text-align: left;
  }
}

/* Assets & street scene ----------------------------------------------------- */
.scene { display: block; width: 100%; height: auto; border-radius: 10px; image-rendering: pixelated; background: #8cb9dc; }
.scene image { image-rendering: pixelated; }
.scene-card { padding: 10px; }
/* Little scene animations, in whole scene pixels (1px = one sprite pixel) */
.scene image.anim-hop, .scene image.anim-breathe, .scene image.anim-float, .scene image.anim-fly, .scene .puff {
  transform-box: fill-box; transform-origin: 50% 100%;
}
.scene .anim-hop { animation: scene-hop 6s steps(1, end) infinite; }
.scene .anim-breathe { animation: scene-breathe 3.6s steps(1, end) infinite; }
.scene .anim-float { animation: scene-float 9s steps(1, end) infinite; }
.scene .anim-fly { animation: scene-fly 32s linear infinite; }
.scene .puff { opacity: 0; animation: scene-puff 4.5s linear infinite; }
.scene .puff-2 { animation-delay: 1.5s; }
.scene .puff-3 { animation-delay: 3s; }
.scene .snowfall { animation: scene-snow 14s linear infinite; }
@keyframes scene-hop { 0% { transform: none; } 86% { transform: translateY(-1px); } 89% { transform: translateY(-2px); } 92% { transform: translateY(-1px); } 95% { transform: none; } }
@keyframes scene-breathe { 0% { transform: none; } 50% { transform: translateY(-1px); } }
@keyframes scene-float { 0% { transform: none; } 25% { transform: translateY(-1px); } 50% { transform: translateY(-2px); } 75% { transform: translateY(-1px); } }
@keyframes scene-fly { 0% { transform: translateX(-290px); } 100% { transform: translateX(150px); } }
@keyframes scene-puff { 0% { opacity: 0; transform: none; } 15% { opacity: 0.85; } 100% { opacity: 0; transform: translate(4px, -16px) scale(1.8); } }
@keyframes scene-snow { 0% { transform: none; } 100% { transform: translateY(180px); } }
@media (prefers-reduced-motion: reduce) {
  .scene .anim-hop, .scene .anim-breathe, .scene .anim-float, .scene .anim-fly, .scene .snowfall { animation: none; }
  .scene .puff { animation: none; opacity: 0.6; }
  .scene .puff-2, .scene .puff-3 { display: none; }
}
.public-place h2 { margin: 4px 4px 10px; }
.trophy-shelf { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.trophy-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 6px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; background: var(--panel-2); }
.trophy-chip img { height: 22px; width: auto; image-rendering: pixelated; }
.networth .nw-figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.networth .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.networth .v { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.networth .s { font-size: 12px; color: var(--muted); }
.nw-next { margin-top: 16px; }
.nw-next-label { font-size: 14px; margin-bottom: 6px; }
.progress-wide { width: 100%; height: 8px; border-radius: 4px; }
.asset-slot h2 { margin-bottom: 14px; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: start; }
.asset-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.asset-card[open] { grid-column: span 2; border-color: #3a4a60; }
.asset-card summary { list-style: none; cursor: pointer; padding: 10px; display: grid; gap: 6px; }
.asset-card summary::-webkit-details-marker { display: none; }
.asset-card summary:focus-visible { outline: 2px solid var(--down); outline-offset: -2px; }
.asset-thumb { position: relative; display: grid; place-items: center; height: 84px; background: rgba(140, 185, 220, 0.12); border-radius: 8px; }
.asset-thumb img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; image-rendering: pixelated; }
.asset-locked .asset-thumb img { filter: brightness(0) opacity(0.35); }
.asset-grid-wide { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.asset-grid-wide .asset-thumb { height: auto; aspect-ratio: 16 / 9; overflow: hidden; }
.asset-grid-wide .asset-thumb img { inset: 0; width: 100%; height: 100%; object-fit: cover; }
.asset-grid-wide .asset-locked .asset-thumb img { filter: grayscale(1) brightness(0.45); }
.asset-tbd { font-family: var(--mono); font-size: 28px; color: var(--muted); opacity: 0.6; }
.asset-lock { position: absolute; right: 6px; top: 4px; font-size: 14px; }
.asset-name { font-weight: 700; font-size: 14px; }
.asset-status { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.asset-in-use { border-color: rgba(255, 197, 66, 0.6); }
.asset-in-use .asset-status { color: var(--gold); }
.asset-unlocked .asset-status { color: var(--text); }
.asset-detail { padding: 0 12px 12px; font-size: 14px; }
.asset-detail p { margin: 0 0 8px; }
.asset-detail form { margin: 0; }
.place-card { display: block; text-decoration: none; color: inherit; }
.place-body { display: grid; gap: 14px; }
.place-card:hover { border-color: #3a4a60; }
.place-card h2 { margin: 0 0 12px; }
.place-text { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; }
.place-card p { margin: 0; font-size: 14px; }
.place-link { font-size: 14px; font-weight: 600; color: var(--gold); }
@media (max-width: 600px) {
  .networth .nw-figures { grid-template-columns: 1fr; }
  .asset-card[open] { grid-column: 1 / -1; }
}

/* Continue with Google (Google's light button style) */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; margin-top: 18px; padding: 12px 20px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: 15px; text-decoration: none;
}
.btn-google:hover { background: #f2f2f2; }
.btn-google img { width: 18px; height: 18px; }
.or-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 4px; color: var(--muted); font-size: 13px; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.about ul { line-height: 1.6; padding-left: 20px; }
.about li { margin: 6px 0; }
.about h2 { margin-top: 26px; }

/* Get the app */
.install-card { display: flex; gap: 16px 24px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.install-card h2 { margin: 0 0 6px; }
.install-card p { margin: 0; font-size: 14px; }
.install-text { flex: 1 1 280px; }
.install-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.install-card[hidden], .install-card [hidden] { display: none; }
.install-more { margin-top: 8px !important; }
.install-more a { color: var(--text); }
.howto ol { line-height: 1.6; padding-left: 22px; }
.howto li { margin: 6px 0; }
.steps { display: grid; grid-template-columns: 160px 1fr; gap: 10px 18px; margin: 14px 0 0; line-height: 1.55; }
.steps dt { font-weight: 700; }
.steps dd { margin: 0; color: var(--muted); }
.steps b, .howto li b { color: var(--text); font-weight: 600; }
@media (max-width: 600px) {
  .steps { grid-template-columns: 1fr; gap: 2px; }
  .steps dd { margin-bottom: 12px; }
}
.howto h2:first-child { margin-top: 0; }

/* Profile */
.profile-summary { display: grid; gap: 16px; }
.profile-ticker { font-family: var(--mono); font-size: 32px; font-weight: 600; color: var(--down); }
.profile-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; margin: 0; }
.profile-facts dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.profile-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.profile-facts a { color: var(--text); }
.profile-links { display: flex; gap: 10px; flex-wrap: wrap; }
.profile-links form { margin: 0; }
.pending-note { border: 1px solid var(--gold); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; display: flex; gap: 10px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pending-note p { margin: 0; font-size: 14px; }
.pending-note form { margin: 0; }

/* Admin usage widget */
.admin-widget { margin-top: 28px; border-style: dashed; }
.admin-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-head h2 { margin: 0; }
.admin-badge { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 2px 9px; }
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0 10px; }
@media (max-width: 760px) { .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .admin-stats { grid-template-columns: 1fr; } }
.admin-stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.admin-stat .k { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.admin-stat .v { font-family: var(--mono); font-size: 24px; font-weight: 600; margin: 4px 0 2px; }
.admin-stat .v small { font-family: var(--sans); font-size: 12px; font-weight: 500; color: var(--muted); }
.admin-stat .s { font-size: 13px; color: var(--muted); }
.admin-widget h3 { margin: 22px 0 10px; font-size: 16px; }
.admin-table td { white-space: nowrap; }
.admin-table td.admin-email { white-space: normal; overflow-wrap: anywhere; min-width: 180px; }
.admin-tag { display: inline-block; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-left: 6px; color: var(--muted); }
.admin-tag-warn { color: var(--gold); border-color: var(--gold); }

/* Company name + public ticker pages */
.company { font-size: 15px; font-weight: 600; color: var(--text); margin-top: 2px; }
.form-row-buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.public-note { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.public-note a { color: var(--text); }
.public-cta { text-align: center; margin-top: 22px; }
.public-cta h2 { margin: 0 0 6px; }
.public-cta .btn { max-width: 320px; }

/* Avatar body choice (Assets page) */
.avatar-choices { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.avatar-choice { display: grid; justify-items: center; gap: 6px; width: 140px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); margin: 0; }
.avatar-choice.is-current { border-color: var(--down); }
.avatar-choice .asset-thumb { width: 72px; height: 96px; }
.avatar-choice .btn { padding: 6px 14px; font-size: 14px; }

/* Food diary */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.day-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 14px; }
.day-label { font-weight: 700; min-width: 150px; text-align: center; }
.btn-small.is-disabled { opacity: 0.35; pointer-events: none; }
.food-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px 24px; align-items: start; }
.food-summary .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.food-summary .v { font-family: var(--mono); font-size: 22px; font-weight: 600; margin: 2px 0 4px; }
.food-summary .v small { font-size: 13px; color: var(--muted); font-weight: 400; }
.food-summary .s { font-size: 13px; color: var(--muted); margin-top: 4px; }
.food-kcal .v { font-size: 30px; }
.food-macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.food-extra { grid-column: 1 / -1; margin: 0; }
.progress-wide { width: 100%; height: 6px; }
.progress-over span { background: var(--muted); }
.macro-protein .progress span { background: #6ab0ff; }
.macro-carbs .progress span { background: var(--gold); }
.macro-fat .progress span { background: #c792ea; }
.food-meal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.food-meal-head h2 { margin: 0 0 8px; }
.food-meal-kcal { font-family: var(--mono); color: var(--muted); }
.food-entries { list-style: none; margin: 0 0 12px; padding: 0; }
.food-entries li { border-top: 1px solid var(--line); }
.food-entry, .recipe-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 2px; color: inherit; text-decoration: none; align-items: center; }
.food-entry:hover { background: var(--panel-2); }
.food-entry-name { grid-column: 1; }
.food-entry-amount { grid-column: 1; font-size: 13px; }
.food-entry-kcal { grid-column: 2; grid-row: 1 / span 2; font-family: var(--mono); }
.food-icon { display: block; image-rendering: pixelated; grid-column: 1; grid-row: 1 / span 2; }
.food-entry.has-icon { grid-template-columns: 32px minmax(0, 1fr) auto; }
.food-entry.has-icon .food-entry-name, .food-entry.has-icon .food-entry-amount { grid-column: 2; }
.food-entry.has-icon .food-entry-kcal { grid-column: 3; }
.food-result.has-icon { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px 12px; align-items: center; }
.food-result.has-icon > span { grid-column: 2; }
.recipe-item form { grid-column: 2; grid-row: 1 / span 2; }
.food-add { margin-top: 4px; }
.food-disclaimer { text-align: center; margin: 20px 0; }
.food-search-form {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 5px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; transition: border-color 0.15s, box-shadow 0.15s;
}
.food-search-form:focus-within { border-color: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.food-search-form .search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.food-search-form:focus-within .search-icon { color: var(--text); }
.food-search-form input[type=search] {
  flex: 1; min-width: 0; -webkit-appearance: none; appearance: none;
  background: transparent; border: 0; color: var(--text); font: inherit; font-size: 16px;
  padding: 10px 8px 10px 42px;
}
.food-search-form input[type=search]:focus { box-shadow: none; }
.food-search-form input::placeholder { color: var(--muted); opacity: 0.8; }
.food-search-form input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.food-search-form .btn { margin-top: 0; padding: 10px 18px; border-radius: 9px; }
.food-add-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 4px; }
@media (max-width: 600px) {
  .food-add-actions { flex-wrap: nowrap; }
  /* three equal buttons; long labels wrap to two lines rather than spill into each other */
  .food-add-actions .btn { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; padding: 10px 6px; font-size: 14px; line-height: 1.2; white-space: normal; text-align: center; }
}
.food-results { list-style: none; margin: 10px 0 0; padding: 0; }
.food-results li { border-top: 1px solid var(--line); }
.food-result { display: flex; flex-direction: column; gap: 2px; padding: 10px 2px; color: inherit; text-decoration: none; }
.food-result:hover { background: var(--panel-2); }
/* Recipe icons and the icon picker */
.food-results.with-icons li { display: flex; align-items: center; gap: 10px; }
.food-results.with-icons .food-result { flex: 1; min-width: 0; }
.food-icon-btn { flex: none; display: grid; place-items: center; padding: 3px; background: transparent; border: 1px solid transparent; border-radius: 10px; cursor: pointer; }
.food-icon-btn img { display: block; image-rendering: pixelated; }
.food-icon-btn.is-empty { border: 1px dashed #3a4a5e; }
.food-icon-btn:hover, .food-icon-btn:focus-visible { border-color: var(--muted); background: var(--panel-2); }
.recipe-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.icon-picker { width: min(560px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 32px)); padding: 0; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.icon-picker::backdrop { background: rgba(0, 0, 0, 0.6); }
.icon-picker form { display: flex; flex-direction: column; gap: 10px; padding: 16px; max-height: min(638px, calc(100vh - 34px)); }
.icon-picker form > * { flex-shrink: 0; }
.icon-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.icon-picker-head h2 { margin: 0; font-size: 18px; }
.icon-picker-for { margin: -4px 0 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; overflow-y: auto; min-height: 120px; flex: 1 1 auto; flex-shrink: 1 !important; }
.icon-choice { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 6px; background: var(--panel-2); border: 1px solid transparent; border-radius: 10px; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }
.icon-choice img { image-rendering: pixelated; }
.icon-choice:hover, .icon-choice:focus-visible { border-color: var(--muted); }
.icon-choice.is-suggested { border-color: rgba(255, 197, 66, 0.45); }
.icon-choice.is-current { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.icon-choice.is-best::after { content: '\2605'; position: absolute; top: 3px; right: 6px; color: var(--gold); font-size: 12px; line-height: 1; }
.icon-clear { align-self: flex-start; }
.food-result-meta { font-size: 13px; color: var(--muted); }
.food-tag { display: inline-block; font-size: 11px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; margin-right: 4px; }
.food-none { padding: 12px 2px; color: var(--muted); }
.scanner { margin: 12px 0; text-align: center; }
.scanner video { width: 100%; max-width: 480px; border-radius: 10px; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.food-amount { display: grid; grid-template-columns: 110px minmax(0, 1fr) 150px; gap: 12px; }
.food-amount label { margin-top: 0; }
.nutrition-panel { margin: 18px 0 4px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.nutrition-kcal { font-family: var(--mono); font-size: 30px; font-weight: 600; }
.nutrition-kcal small { font-size: 14px; color: var(--muted); }
.nutrition-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.nutrition-table th { text-align: left; font-weight: 500; padding: 5px 0; border-top: 1px solid var(--line); }
.nutrition-table td { text-align: right; font-family: var(--mono); border-top: 1px solid var(--line); }
.nutrition-table tr.sub th { padding-left: 16px; color: var(--muted); font-weight: 400; }
.food-delete { margin-top: 10px; }
.inline-create { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.inline-create > div { flex: 1 1 200px; }
.inline-create > div.narrow { flex: 0 0 100px; }
.inline-create label { margin-top: 0; }
.inline-create .btn { margin-top: 0; }
.form-section { font-size: 16px; margin: 22px 0 0; }
.form-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.form-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.nutrient-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.nutrient-grid .sub label { color: var(--muted); }
.recipe-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 14px; }
.recipe-totals .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.recipe-totals .v { font-family: var(--mono); margin-top: 3px; }
.food-today { display: block; }
.food-today h2 { margin: 0 0 12px; }
@media (max-width: 600px) {
  .food-summary { grid-template-columns: 1fr; }
  .food-amount { grid-template-columns: 90px minmax(0, 1fr); }
  .food-amount > div:nth-child(3) { grid-column: 1 / -1; }
  .form-pair, .nutrient-grid { grid-template-columns: 1fr; }
  .food-search-form .btn { padding-left: 14px; padding-right: 14px; }
  .food-search-form input[type=search] { padding-left: 38px; }
  .food-search-form .search-icon { left: 14px; }
}
@media (max-width: 600px) {
  .food-macros .v { font-size: 18px; }
  .food-macros .v small { display: block; margin-top: 2px; }
}

/* Macro donut charts */
:root { --protein: #6ab0ff; --carbs: #ffc542; --fat: #c792ea; }
.macro-pie { display: flex; align-items: center; gap: 14px; }
.macro-pie-chart { flex: 0 0 auto; transform: rotate(0deg); }
.macro-pie-lg .macro-pie-chart { width: 132px; height: 132px; }
.macro-pie-md .macro-pie-chart { width: 112px; height: 112px; }
.macro-pie-sm .macro-pie-chart { width: 34px; height: 34px; }
.pie-track { stroke: var(--panel-2); }
.pie-protein { stroke: var(--protein); }
.pie-carbs { stroke: var(--carbs); }
.pie-fat { stroke: var(--fat); }
.pie-center { fill: var(--text); font-family: var(--mono); font-size: 8.5px; font-weight: 600; }
.pie-center.is-long { font-size: 6.8px; }   /* 5+ characters ("2,100") would touch the ring */
.pie-unit { fill: var(--muted); font-size: 3.6px; text-transform: uppercase; letter-spacing: 0.08em; }
.macro-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.macro-legend li { display: grid; grid-template-columns: 12px auto auto auto; gap: 8px; align-items: center; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-protein .legend-dot { background: var(--protein); }
.legend-carbs .legend-dot { background: var(--carbs); }
.legend-fat .legend-dot { background: var(--fat); }
.legend-pct { font-family: var(--mono); font-weight: 600; }
.legend-g { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.macro-pie-sm { gap: 10px; margin: 0 0 8px; }
.macro-pie-sm .macro-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.macro-pie-sm .macro-legend li { grid-template-columns: 10px auto auto auto; gap: 5px; }
.macro-pie-sm .legend-dot { width: 8px; height: 8px; }
.food-summary { grid-template-columns: minmax(0, 0.9fr) auto minmax(0, 1.6fr); }
.food-pie { justify-self: center; }
.nutrition-panel .macro-pie { margin-bottom: 6px; }
.macro-protein .progress span { background: var(--protein); }
.macro-carbs .progress span { background: var(--carbs); }
.macro-fat .progress span { background: var(--fat); }
.recipe-summary { display: flex; gap: 18px 28px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.recipe-summary .recipe-totals { flex: 1 1 260px; margin-bottom: 0; }
@media (max-width: 760px) {
  .food-summary { grid-template-columns: minmax(0, 1fr) auto; }
  .food-macros { grid-column: 1 / -1; }
}
/* phones: calories, then the donut, then macros, each full width (side by side squeezed the number) */
@media (max-width: 600px) {
  .food-summary { grid-template-columns: minmax(0, 1fr); }
  .food-pie { justify-self: start; }
}

/* Nav: compact before the full link list runs out of room, then drop the VB code, then wrap */
@media (max-width: 960px) { .navlinks .hide-sm { display: none; } }
@media (max-width: 560px) { .chip-code { display: none; } }
@media (max-width: 400px) {
  .navlinks { flex-wrap: wrap; justify-content: flex-end; gap: 8px; min-width: 0; }
}
/* Phones: keep the ShortYourself wordmark beside the icon (a bit smaller) and stack the right side as a
   tidy 2x2 block (ticker + VB on top, Weigh in + your avatar below) so everything fits; the wordmark only
   goes on very narrow screens */
@media (max-width: 480px) {
  .logo { gap: 7px; font-size: 16px; }
  .navlinks { display: grid; grid-template-columns: auto auto; grid-template-areas: "t v" "w u"; gap: 8px 12px; justify-items: center; align-items: center; }
  .navlinks .ticker-chip { grid-area: t; }
  .navlinks .balance-chip { grid-area: v; }
  .navlinks .nav-weigh { grid-area: w; }
  .navlinks .user-menu { grid-area: u; }
}
@media (max-width: 349px) {
  .logo span { display: none; }
}

/* Settings: two columns on wide screens, calorie calculator */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 0 20px; align-items: start; }
.settings-col { min-width: 0; }
@media (max-width: 860px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.calc { border-bottom: 1px solid var(--line); padding-bottom: 18px; margin-bottom: 4px; }
.calc .form-section { margin-top: 18px; }
.seg-radio { min-width: 0; display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 14px 0 0; background: var(--bg); }
.seg-radio label { position: relative; margin: 0; font-size: 14px; font-weight: 600; }
.seg-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg-radio span { display: block; padding: 7px 14px; border-radius: 7px; color: var(--muted); cursor: pointer; }
.seg-radio input:checked + span { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.seg-radio input:focus-visible + span { outline: 2px solid var(--down); outline-offset: 1px; }
.label { display: block; font-size: 14px; font-weight: 600; margin: 16px 0 6px; }
.height-pair { display: flex; align-items: center; gap: 6px; }
.height-pair input { flex: 1 1 0; min-width: 0; }
.unit-suffix { color: var(--muted); font-size: 14px; }
.calc-result { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0 0; }
.calc-result > div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.calc-result .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.calc-result .v { font-family: var(--mono); font-size: 26px; font-weight: 600; margin-top: 2px; }
.calc-result .calc-goal { color: var(--gold); }
.calc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Dashboard: today's calories bar + macro donut */
.food-today-body { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: center; }
.food-today-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-top: 14px; font-size: 14px; }
.kcal-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 6px; }
.kcal-eaten { color: var(--muted); font-size: 14px; }
.kcal-big { font-family: var(--mono); font-size: 28px; font-weight: 600; color: var(--text); }
.kcal-status { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.kcal-status-ok { color: var(--gold); }
.kcal-status-over { color: #ff9b42; }
.kcal-status-way-over { color: var(--down); }
.kcal-bar { display: block; width: 100%; height: 30px; }
.kcal-track { fill: var(--panel-2); }
.kcal-in { fill: var(--gold); }
.kcal-over { fill: #ff9b42; }
.kcal-way-over { fill: var(--down); }
.kcal-mark-goal { stroke: var(--text); stroke-width: 3; }
.kcal-mark-maint { stroke: #6fd0ff; stroke-width: 3; stroke-dasharray: 4 3; }
.kcal-legend { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--muted); }
.kcal-legend li { display: flex; align-items: center; gap: 6px; }
.kcal-legend b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.kcal-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.kcal-key-eaten { background: var(--gold); }
.kcal-key-goal { width: 3px; height: 14px; border-radius: 1px; background: var(--text); }
.kcal-key-maint { width: 3px; height: 14px; border-radius: 1px; background: repeating-linear-gradient(to bottom, #6fd0ff 0 4px, transparent 4px 7px); }
@media (max-width: 600px) {
  .food-today-body { grid-template-columns: minmax(0, 1fr); }
}

/* Avatars (lib/avatar.php): a photo, or an SVG circle with the pixel character or letters ---------- */
.avatar { display: inline-block; flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: var(--panel-2); vertical-align: middle; }
.avatar img, .avatar svg { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar svg text { font-family: var(--sans); }
.avatar .avatar-char { image-rendering: pixelated; }
.avatar-sm { width: 34px; height: 34px; }
.avatar-md { width: 42px; height: 42px; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-xl { width: 112px; height: 112px; }
.quote-avatar { margin-right: -12px; box-shadow: 0 0 0 2px var(--line); }

/* The account menu behind your avatar, top right */
.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: block; border-radius: 50%; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary .avatar { display: block; box-shadow: 0 0 0 2px var(--line); transition: box-shadow 0.15s; }
.user-menu > summary:hover .avatar, .user-menu[open] > summary .avatar { box-shadow: 0 0 0 2px var(--down); }
.user-menu > summary:focus-visible { outline: 2px solid var(--down); outline-offset: 3px; }
.user-menu .menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; width: 250px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; padding: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.user-menu .menu a, .user-menu .menu-item {
  display: block; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; text-align: left;
  font: inherit; font-size: 14px; font-weight: 600; background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.user-menu .menu a:hover, .user-menu .menu-item:hover, .user-menu .menu a:focus-visible, .user-menu .menu-item:focus-visible { background: var(--panel-2); outline: none; }
.user-menu .menu a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--down); }
.user-menu .menu form { margin: 0; }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.menu-head > div { min-width: 0; }
.menu-ticker { font-family: var(--mono); font-weight: 600; color: var(--down); }
.menu-sub { font-size: 12px; font-weight: 500; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-rule { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu-sm-only { display: none; }
@media (max-width: 960px) { .menu-sm-only { display: flex; flex-direction: column; } }

/* Profile: the avatar is its own editor */
.profile-id { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.avatar-upload-form { margin: 10px 0 0; }
.avatar-upload-form label { cursor: pointer; }
.avatar-editor { position: relative; }
.avatar-editor > summary { list-style: none; cursor: pointer; display: block; position: relative; border-radius: 50%; }
.avatar-editor > summary::-webkit-details-marker { display: none; }
.avatar-editor > summary .avatar { display: block; box-shadow: 0 0 0 3px var(--line); }
.avatar-editor > summary:focus-visible { outline: 2px solid var(--down); outline-offset: 4px; }
.avatar-edit-badge {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 2px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--text);
  opacity: 0; transition: opacity 0.15s; white-space: nowrap;
}
.avatar-editor > summary:hover .avatar-edit-badge, .avatar-editor > summary:focus-visible .avatar-edit-badge, .avatar-editor[open] .avatar-edit-badge { opacity: 1; }
@media (pointer: coarse) { .avatar-edit-badge { opacity: 1; } }
.avatar-drop-ring {
  position: absolute; inset: -6px; border-radius: 50%; border: 2px dashed var(--gold); display: none;
  align-items: center; justify-content: center; text-align: center; font-size: 12px; font-weight: 700; color: var(--gold); background: rgba(11, 15, 20, 0.7);
}
.avatar-editor.is-dragover .avatar-drop-ring { display: flex; }
.avatar-popover {
  position: absolute; left: 0; top: calc(100% + 14px); z-index: 40; width: 300px; max-width: calc(100vw - 48px);
  padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.avatar-popover .avatar-kind { margin-top: 0; }
.avatar-popover .hint { margin-top: 8px; }
.avatar-popover form { margin: 0; }
.avatar-menu-item {
  display: block; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); text-align: left; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; background: none; border: 0; margin: 0;
}
.avatar-menu-item:hover { background: var(--panel-2); }
.avatar-menu-item.is-danger { color: var(--down); }
.avatar-letters-field input { max-width: 120px; text-transform: uppercase; font-family: var(--mono); }
.avatar-swatches { display: flex; flex-wrap: wrap; gap: 7px; }
.avatar-swatch {
  position: relative; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15); margin: 0;
}
.avatar-swatch.is-on { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.avatar-swatch-custom { background: conic-gradient(#ff4d5e, #ffc542, #2bd67b, #0891b2, #7c5cff, #db2777, #ff4d5e); overflow: hidden; }
.avatar-swatch-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.swatch-ff4d5e { background: #ff4d5e; }
.swatch-ea580c { background: #ea580c; }
.swatch-d97706 { background: #d97706; }
.swatch-ffc542 { background: #ffc542; }
.swatch-2bd67b { background: #2bd67b; }
.swatch-16a34a { background: #16a34a; }
.swatch-0d9488 { background: #0d9488; }
.swatch-0891b2 { background: #0891b2; }
.swatch-2563eb { background: #2563eb; }
.swatch-7c5cff { background: #7c5cff; }
.swatch-db2777 { background: #db2777; }
.swatch-6b4a2a { background: #6b4a2a; }
.swatch-475569 { background: #475569; }
.swatch-243040 { background: #243040; }
.avatar-popover-or { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; color: var(--muted); font-size: 12px; }
.avatar-popover-or::before, .avatar-popover-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Photo crop widget */
.crop-stage { position: relative; width: 100%; max-width: 360px; margin: 14px 0 0; }
.crop-stage canvas { display: block; width: 100%; height: auto; border-radius: 12px; cursor: grab; touch-action: none; background: var(--bg); }
.crop-stage canvas.is-grabbing { cursor: grabbing; }
.crop-stage canvas:focus-visible { outline: 2px solid var(--down); outline-offset: 3px; }
.crop-mask { position: absolute; inset: 0; pointer-events: none; border-radius: 12px; background: radial-gradient(circle at center, transparent 49.6%, rgba(11, 15, 20, 0.65) 50%); }
.crop-controls { display: flex; align-items: center; gap: 14px; max-width: 360px; margin-top: 12px; }
.crop-zoom { display: flex; align-items: center; gap: 10px; flex: 1; margin: 0; font-size: 14px; font-weight: 600; }
.crop-zoom input { flex: 1; }
.pointer-coarse { display: none; }
@media (pointer: coarse) { .pointer-fine { display: none; } .pointer-coarse { display: inline; } }
