:root {
  --bg: #0d1210;
  --bg-2: #111815;
  --card: #161f1a;
  --card-2: #1e2923;
  --line: #2a3830;
  --text: #ecf3ee;
  --muted: #8fa397;
  --green: #22c55e;
  --green-dim: #15803d;
  --gold: #fbbf24;
  --red: #f87171;
  --radius: 16px;
  /* rarity colours (the game's own) */
  --r-common: #9a9894;
  --r-uncommon: #67f835;
  --r-rare: #4ea2ff;
  --r-epic: #e375ff;
  --r-legendary: #ffd500;
  --r-exotic: #e83030;
  /* value split colours */
  --c-money: #22c55e;
  --c-property: #38bdf8;
  --c-loot: #c084fc;
  --c-research: #fbbf24;
  --tabbar-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 500px at 50% -200px, #16301f 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 14px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(13, 18, 16, .88);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.tb-row {
  max-width: 760px; margin: 0 auto; padding: 8px 16px 7px;
  display: flex; align-items: center; gap: 14px;
}
.brand {
  font: 800 19px/1 system-ui, sans-serif; letter-spacing: -.3px; color: var(--text);
  background: none; border: 0; padding: 0; cursor: pointer; margin-right: auto;
}
.brand span { color: var(--green); }
.tb-stat { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.tb-stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.tb-stat span { font-size: 11px; color: var(--muted); }
.tb-need b { color: var(--gold); }
.topbar.maxed .tb-need b { color: var(--green); }
.tb-bar { height: 3px; background: transparent; }
.tb-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--green-dim), var(--green)); transition: width .35s ease; }

/* ---------- views ---------- */
.view-head { display: flex; align-items: baseline; justify-content: space-between; margin: 4px 2px 2px; }
.view-head h1 { margin: 0; font-size: 26px; letter-spacing: -.5px; }
.view-sub { margin: 0 2px 12px; color: var(--muted); font-size: 14px; }
.sec-total { color: var(--gold); font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card h2 { margin: 0 0 12px; font-size: 17px; }
.note { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 22px 16px 16px; background: linear-gradient(180deg, #1a2d21, var(--card)); }
.hero-label { margin: 0; color: var(--muted); font-size: 14px; }
.hero-num {
  margin: 2px 0 14px; font-size: clamp(46px, 15vw, 68px); font-weight: 800;
  letter-spacing: -2px; line-height: 1.05; color: var(--gold); font-variant-numeric: tabular-nums;
}
.hero.maxed .hero-num { color: var(--green); }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hero-stats div { background: var(--card-2); border-radius: 12px; padding: 9px 4px; }
.hero-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: 12px; color: var(--muted); }
.hero-wipe { margin: 12px 0 0; font-size: 14px; }
.hero-wipe b { color: var(--gold); }
.saved { margin: 12px 0 0; font-size: 12px; color: var(--green); min-height: 1.2em; }
.saved.warn { color: var(--gold); }
.saved.bad { color: var(--red); }

/* ---------- court ruling button ---------- */
.ruling-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 12px;
  padding: 14px 16px; border-radius: var(--radius); cursor: pointer; text-align: left;
  background: linear-gradient(135deg, #f4f1ea, #ddd6c6); color: #1b1b1b; border: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  font: inherit;
}
.ruling-btn:active { transform: scale(.985); }
.rb-icon { font-size: 28px; }
.rb-text { flex: 1; display: flex; flex-direction: column; }
.rb-text b { font: italic 900 19px/1.1 Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif; letter-spacing: .3px; }
.rb-text span { font-size: 13px; color: #55534e; }
.rb-arrow { font-size: 30px; color: #8a867c; line-height: 1; }

/* ---------- value split ---------- */
.split-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--card-2); }
.split-bar span { height: 100%; transition: width .35s ease; }
.split-list { display: grid; gap: 4px; margin-top: 12px; }
.split-row {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px;
  background: var(--card-2); border: 0; border-radius: 10px; color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.split-row .dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.split-row .nm { flex: 1; }
.split-row .pc { color: var(--muted); font-size: 13px; width: 42px; text-align: right; }
.split-row b { font-variant-numeric: tabular-nums; min-width: 72px; text-align: right; }
.split-row .go { color: var(--muted); }

/* ---------- inputs ---------- */
input {
  font: inherit; color: var(--text); background: var(--card-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; width: 100%;
}
input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.money-field { display: flex; align-items: center; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; }
.money-field span { padding-left: 14px; color: var(--muted); font-weight: 700; }
.money-field input { border: 0; background: transparent; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 11px 12px 11px 6px; }
.money-field input:focus { outline: none; }
.money-field:focus-within { outline: 2px solid var(--green); outline-offset: 1px; }
.money-field.compact input { font-size: 16px; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 700; color: #0d1210; background: var(--green);
  border: 0; border-radius: 12px; padding: 12px 14px; cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.96); }
.btn.neg { background: var(--card-2); color: var(--red); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost.danger { color: var(--red); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.big { padding: 15px; font-size: 17px; width: 100%; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.quick .btn { padding: 9px 4px; font-size: 14px; }

/* ---------- segmented ---------- */
.seg { display: inline-flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; gap: 2px; }
.seg button {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: transparent;
  border: 0; border-radius: 8px; padding: 7px 10px; cursor: pointer; touch-action: manipulation;
}
.seg button[aria-pressed="true"] { background: var(--green); color: #0d1210; }
.seg.tiers { display: flex; width: 100%; }
.seg.tiers button { flex: 1; padding: 9px 4px; min-width: 0; }

/* ---------- general: money ---------- */
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.muted-sm { color: var(--muted); font-size: 13px; }
.money-list { display: grid; gap: 16px; }
.mr-label { display: block; font-weight: 700; margin-bottom: 6px; }
.mr-label small { color: var(--muted); font-weight: 600; }

/* ---------- general: authority ---------- */
.auth-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.auth-now { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.auth-now input { font-size: 26px; font-weight: 800; text-align: center; padding: 8px; font-variant-numeric: tabular-nums; }
.auth-arrow { color: var(--muted); font-size: 22px; }
.auth-after { display: flex; flex-direction: column; align-items: center; font-size: 13px; color: var(--muted); }
.auth-after b { font-size: 30px; line-height: 1.15; color: var(--gold); font-variant-numeric: tabular-nums; }
.auth-after small { color: var(--green); font-weight: 700; font-size: 13px; }
.auth-bar { height: 8px; border-radius: 99px; background: var(--card-2); overflow: hidden; margin-top: 14px; }
.auth-fill { height: 100%; width: 0; background: linear-gradient(90deg, #b45309, var(--gold)); transition: width .35s ease; }
.auth-goal { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: right; }
.auth-next { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.auth-next li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--card-2); border-radius: 10px; font-size: 14px; }
.auth-next .yr { min-width: 54px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.auth-next .what { flex: 1; }
.auth-next .tag { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.auth-next li.new { background: color-mix(in srgb, var(--green) 18%, var(--card-2)); }
.auth-next li.new .yr { color: var(--green); }
.auth-next li.new .tag { background: var(--green); color: #0d1210; }
.auth-next li.later .tag { color: var(--muted); border: 1px solid var(--line); }

/* ---------- settings ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.backup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.file-btn { position: relative; text-align: center; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid var(--green); outline-offset: 1px; }
#newWipeBtn { width: 100%; margin-top: 14px; }

/* ---------- toolbar: search + chips ---------- */
.toolbar {
  position: sticky; top: 50px; z-index: 10;
  margin: 0 -16px 12px; padding: 8px 16px 10px;
  background: linear-gradient(var(--bg) 75%, rgba(13,18,16,0));
}
.search {
  padding: 11px 14px 11px 38px; font-size: 16px; border-radius: 999px;
  background: var(--card-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238fa397' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5.5'/%3E%3Cpath d='M11 11l4 4'/%3E%3C/svg%3E") no-repeat 14px 50%;
}
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: 600 14px/1.2 system-ui, sans-serif; cursor: pointer; white-space: nowrap;
}
.chip .n { color: var(--muted); font-weight: 600; font-size: 12px; }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip[aria-pressed="true"] .n { color: #4b5a51; }
.chip.mine[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #0d1210; }
.chip.edit[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #1a1405; }

/* ---------- tile grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 740px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid-head {
  grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px;
  margin: 10px 2px -2px; font-weight: 800; font-size: 15px;
}
.grid-head:first-child { margin-top: 0; }
.grid-head .gi { font-size: 17px; }
.grid-head .gm { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.grid-note { grid-column: 1 / -1; margin: -2px 2px 0; color: var(--muted); font-size: 13px; }
.grid-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 30px 10px; }

.tile {
  --rc: var(--r-common);
  position: relative; display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.tile.r-uncommon { --rc: var(--r-uncommon); }
.tile.r-rare { --rc: var(--r-rare); }
.tile.r-epic { --rc: var(--r-epic); }
.tile.r-legendary { --rc: var(--r-legendary); }
.tile.r-exotic { --rc: var(--r-exotic); }
.tile { border-color: color-mix(in srgb, var(--rc) 45%, var(--line)); }
.tile.on { border-color: var(--green); box-shadow: 0 0 0 1px var(--green) inset; }
.tile-rar {
  padding: 7px 10px 0; font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase;
  color: var(--rc);
}
.tile-rar + .tile-name { padding-top: 1px; }

/* rarity legend */
.rarity-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0 2px 12px; font-size: 12px; font-weight: 700; }
.rl { display: inline-flex; align-items: center; gap: 5px; color: var(--rc); }
.rl::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--rc); }
.r-common { --rc: var(--r-common); }
.r-uncommon { --rc: var(--r-uncommon); }
.r-rare { --rc: var(--r-rare); }
.r-epic { --rc: var(--r-epic); }
.r-legendary { --rc: var(--r-legendary); }
.r-exotic { --rc: var(--r-exotic); }

/* ---------- upgrades tree ---------- */
.tree-wrap { position: relative; margin: 0 -16px 10px; }
.tree-scroll {
  height: min(62vh, 560px); min-height: 340px; overflow: auto; overscroll-behavior: contain;
  background:
    radial-gradient(circle at 50% 50%, rgba(34,197,94,.05), transparent 70%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 1px, transparent 1px 40px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.025) 0 1px, transparent 1px 40px),
    #0a0f0c;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  cursor: grab; -webkit-overflow-scrolling: touch;
}
.tree-scroll.dragging { cursor: grabbing; user-select: none; }
.tree-world { position: relative; }
.tree-stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.tree-edges { position: absolute; left: 0; top: 0; overflow: visible; }
.tree-edges path { fill: none; stroke: #33423a; stroke-width: 4; }
.tree-edges path.on { stroke: var(--green); stroke-width: 6; }
.tree-edges path.spine { stroke: #4b5e53; stroke-width: 6; }
.tcat {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap; cursor: pointer;
  padding: 10px 22px; border-radius: 999px; border: 3px solid #4b5e53; background: #18211c; color: var(--text);
  font: 800 30px/1 system-ui, sans-serif;
}
.tnode {
  --rc: var(--r-common);
  position: absolute; width: 100px; height: 100px; padding: 0; cursor: pointer;
  border-radius: 16px; border: 4px solid var(--rc);
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rc) 35%, #16201b) 0%, #121915 72%);
  box-shadow: 0 4px 10px rgba(0,0,0,.5);
  opacity: .78; filter: saturate(.7) brightness(.9);
  transition: opacity .15s, filter .15s, box-shadow .15s;
}
.tnode.r-uncommon { --rc: var(--r-uncommon); }
.tnode.r-epic { --rc: var(--r-epic); }
.tnode.r-legendary { --rc: var(--r-legendary); }
.tnode.r-exotic { --rc: var(--r-exotic); }
.tnode.avail { opacity: .95; filter: none; }
.tnode.on { opacity: 1; filter: none; box-shadow: 0 0 0 4px var(--green), 0 0 26px rgba(34,197,94,.55); }
.tnode.sel { box-shadow: 0 0 0 6px #fff, 0 0 30px rgba(255,255,255,.4); opacity: 1; filter: none; z-index: 2; }
.tnode.hit { opacity: 1; filter: none; animation: hitPulse 1.1s ease-in-out infinite; z-index: 1; }
@keyframes hitPulse { 50% { box-shadow: 0 0 0 8px rgba(251,191,36,.85), 0 0 34px rgba(251,191,36,.6); } }
.tnode img { position: absolute; left: 12px; top: 6px; width: 68px; height: 62px; object-fit: contain;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); pointer-events: none; }
.tn-cost { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; color: #fff;
  font: 800 17px/1 system-ui, sans-serif; text-shadow: 0 1px 3px #000; pointer-events: none; }
.tn-lvl { position: absolute; left: -8px; top: -12px; min-width: 30px; padding: 2px 6px; border-radius: 8px;
  background: #0d1210; border: 2px solid var(--rc); color: var(--text); font: 800 15px/1.2 Georgia, serif; pointer-events: none; }
.tn-jail { position: absolute; right: -10px; top: -12px; padding: 2px 6px; border-radius: 8px; background: #7f1d1d;
  color: #fecaca; font: 800 14px/1.2 system-ui, sans-serif; pointer-events: none; }
.tn-check { position: absolute; right: -12px; bottom: -12px; width: 34px; height: 34px; border-radius: 50%;
  display: none; place-items: center; background: var(--green); color: #0d1210; font: 900 22px/1 system-ui, sans-serif;
  border: 3px solid #0a0f0c; pointer-events: none; }
.tnode.on .tn-check { display: grid; }
.tree-zoom { position: absolute; right: 12px; bottom: 12px; display: grid; gap: 6px; }
.tree-zoom button {
  width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(22,31,26,.92); color: var(--text); font: 800 22px/1 system-ui, sans-serif;
}
.tree-panel {
  position: fixed; z-index: 35; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 10px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; padding: 14px; border-radius: 18px;
  background: #18211c; border: 2px solid var(--rc); box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
@media (min-width: 760px) { .tree-panel { bottom: calc(var(--tabbar-h) + 24px); } }
.tp-close { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.tp-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; padding-right: 24px; }
.tp-img { width: 64px; height: 64px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: radial-gradient(circle, color-mix(in srgb, var(--rc) 40%, #16201b), #121915 75%); border: 2px solid var(--rc); }
.tp-img img { width: 52px; height: 52px; object-fit: contain; }
.tp-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tp-info b { font-size: 18px; }
.tp-rar { color: var(--rc); font-weight: 800; font-size: 13px; }
.tp-meta { color: var(--muted); font-size: 13px; }
.tile-hit {
  display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0; margin: 0;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
  touch-action: manipulation;
}
.tile-hit:active .tile-img img { transform: scale(.92); }
.tile-hit:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; border-radius: 14px; }
.tile-img {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3;
  background:
    radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rc) 38%, transparent) 0%, transparent 68%),
    linear-gradient(180deg, var(--card-2), var(--card));
  border-bottom: 2px solid var(--rc);
}
.tile-img img {
  position: absolute; left: 11%; top: 9%; width: 78%; height: 78%; object-fit: contain;
  transition: transform .12s; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45));
}
.tile-img .emoji { font-size: 40px; }
.tile-name { padding: 8px 10px 0; font-weight: 700; font-size: 14px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em; }
.tile-price { padding: 2px 10px 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile-price b { color: var(--text); }
.tile-price .tag { font-size: 11px; color: var(--gold); margin-left: 4px; }
.tile-price input { padding: 6px 8px; font-size: 14px; margin-top: 2px; }
.tile .jail { display: inline-block; font-size: 11px; color: #fca5a5; border: 1px solid #7f1d1d; border-radius: 6px; padding: 0 4px; margin-top: 3px; }
.tile-badge {
  position: absolute; top: 7px; right: 7px; min-width: 28px; height: 28px; padding: 0 8px;
  border-radius: 99px; display: grid; place-items: center;
  background: var(--card-2); color: var(--muted); font-weight: 800; font-size: 15px; pointer-events: none;
  border: 1px solid var(--line);
}
.tile.on .tile-badge { background: var(--green); color: #0d1210; border-color: var(--green); }
.tile-step { display: grid; grid-template-columns: 38px 1fr 38px; gap: 4px; padding: 0 8px 8px; margin-top: auto; }
.tile-step .btn { padding: 0; height: 36px; font-size: 20px; line-height: 1; }
.tile-step .btn.minus { background: var(--card-2); color: var(--text); border: 1px solid var(--line); }
.tile-step input { text-align: center; padding: 4px; font-weight: 800; font-size: 16px; height: 36px; font-variant-numeric: tabular-nums; }
.tile-tiers { display: flex; gap: 4px; padding: 0 8px 8px; margin-top: auto; }
.tile-tiers button {
  flex: 1; min-width: 0; padding: 7px 2px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--muted); font: 700 12px/1 system-ui, sans-serif; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-tiers button[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #0d1210; }
.tile-tiers button.reached { background: color-mix(in srgb, var(--green) 25%, var(--card-2)); color: var(--text); }
.tile .remove { position: absolute; top: 7px; left: 7px; background: rgba(0,0,0,.55); color: var(--text);
  border: 0; border-radius: 99px; width: 26px; height: 26px; cursor: pointer; font-size: 14px; }
.custom-card .grid { margin-top: 12px; }
.custom-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-top: 10px; }

/* ---------- timer ---------- */
.timer-set { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.timer-set label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.timer-set input { text-align: center; font-size: 18px; font-weight: 700; padding: 10px 4px; }
.timer-show { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.timer-left { margin: 0; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- donate / footer ---------- */
.donate { text-align: center; }
.donate p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.btn.donate-btn { display: block; text-decoration: none; background: var(--gold); color: #1a1405; }
footer { color: var(--muted); font-size: 12px; text-align: center; padding: 6px 4px; }
footer p { margin: 6px 0; }
footer a { color: var(--green); }

/* ---------- bottom tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(17, 24, 21, .94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
@media (min-width: 760px) {
  .tabbar { left: 50%; right: auto; width: 560px; transform: translateX(-50%); bottom: 12px; height: var(--tabbar-h);
    border: 1px solid var(--line); border-radius: 18px; padding-bottom: 0; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 4px 2px; min-width: 0;
  touch-action: manipulation;
}
.tabbar .ti { font-size: 21px; line-height: 1; filter: grayscale(.6); opacity: .8; }
.tabbar .tl { font-size: 11px; font-weight: 700; }
.tabbar .tv { font-size: 10px; font-variant-numeric: tabular-nums; min-height: 1.2em; }
.tabbar button[aria-current="page"] { color: var(--text); }
.tabbar button[aria-current="page"] .ti { filter: none; opacity: 1; transform: translateY(-1px); }
.tabbar button[aria-current="page"] .tl { color: var(--green); }

/* ---------- banner / toast ---------- */
.banner {
  position: sticky; top: 0; z-index: 25;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; background: #3b2f0b; color: #fde68a; font-size: 14px; text-align: center;
}
.banner-btns { display: flex; gap: 6px; }
.banner .btn.ghost { color: #fde68a; border-color: #7a6320; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-weight: 700;
  padding: 10px 18px; border-radius: 99px; z-index: 40; max-width: calc(100% - 32px); text-align: center;
}

@media (max-width: 380px) {
  .custom-form { grid-template-columns: 1fr 1fr; }
  .custom-form .btn { grid-column: 1 / -1; }
  .timer-set { grid-template-columns: 1fr 1fr; }
  .timer-set .btn { grid-column: 1 / -1; }
  .grid { gap: 8px; }
}

/* ---------- court ruling ---------- */
.ruling-dialog {
  border: 0; padding: 0; background: transparent; color: #1b1b1b;
  width: min(440px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto;
}
.ruling-dialog::backdrop { background: rgba(5, 8, 6, .85); }
.paper {
  --ink: #1b1b1b; --ink-soft: #55534e; --red: #c8281e;
  position: relative; overflow: hidden;
  background: #f4f1ea; color: var(--ink);
  padding: 18px 18px 14px; border-radius: 4px;
  box-shadow: 0 18px 50px rgba(0,0,0,.55);
  font-family: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
}
.paper-head { display: flex; align-items: center; gap: 10px; }
.paper-head h2 {
  flex: 1; margin: 0; text-align: center; color: var(--ink);
  font: italic 900 30px/1 Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
  letter-spacing: 1px; transform: skewX(-6deg);
}
.bars { width: 34px; height: 14px; flex: none; background: linear-gradient(#9b9890 0 30%, transparent 30% 70%, #9b9890 70%); }
.rul-meta { margin: 14px 0 4px; color: var(--ink-soft); text-transform: uppercase; display: grid; gap: 2px; }
.rul-meta label, .rul-meta div { display: flex; align-items: baseline; gap: 4px; }
.rul-meta b { color: var(--ink); }
.rul-meta input {
  font: inherit; font-weight: 700; color: var(--ink); text-transform: uppercase;
  background: transparent; border: 0; border-bottom: 1px dotted #b3afa5; border-radius: 0;
  padding: 0 2px; width: auto; flex: 1; min-width: 0;
}
.rul-meta input::placeholder { color: #aaa69c; font-weight: 400; }
.rul-meta input:focus { outline: none; border-bottom-color: var(--ink); }
.paper h3 { margin: 14px 0 4px; color: var(--ink); font: 700 17px/1.1 Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif; letter-spacing: .5px; }
.rul-row { display: flex; align-items: baseline; gap: 6px; padding: 2px 0; }
.rul-row .lbl { white-space: nowrap; }
.rul-row .dots { flex: 1; border-bottom: 1px dotted #b3afa5; transform: translateY(-3px); min-width: 12px; }
.rul-row .val { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rul-row.zero { color: #9a968c; }
.rul-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 12px;
  font: 700 18px/1 Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif; }
.rul-total b { color: var(--red); font-size: 20px; font-variant-numeric: tabular-nums; }
.rul-bottom { display: grid; grid-template-columns: 1fr auto; align-items: end; margin-top: 10px; position: relative; min-height: 96px; }
.rul-final span { display: block; font: 700 16px/1 Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif; }
.rul-final b { display: block; margin-top: 4px; font: 900 36px/1 Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif; letter-spacing: .5px; }
.rul-seal { width: 104px; height: 104px; color: #c9c4b8; }
.rul-sign { position: absolute; right: 6px; bottom: 6px; width: 130px; color: #23233b; }
.rul-judge { margin: 2px 0 0; text-align: right; color: var(--ink-soft); font-size: 11px; }
.rul-stamp {
  position: absolute; right: 16px; bottom: 88px; padding: 4px 12px; pointer-events: none; white-space: nowrap;
  border: 4px solid var(--red); border-radius: 8px; color: var(--red);
  font: 900 30px/1 Impact, Haettenschweiler, "Arial Black", sans-serif; letter-spacing: 2px;
  transform: rotate(-14deg); opacity: 0; mix-blend-mode: multiply;
}
.rul-stamp.long { font-size: 21px; border-width: 3px; }
.ruling-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.paper.play .rul-row { opacity: 0; animation: rulIn .35s ease forwards; }
.paper.play .rul-final b { opacity: 0; animation: rulIn .3s ease forwards; animation-delay: var(--final-delay, 1.6s); }
.paper.play .rul-stamp { animation: stampIn .35s cubic-bezier(.2, 1.6, .4, 1) forwards; animation-delay: var(--stamp-delay, 2s); }
.paper.done .rul-stamp { opacity: .85; transform: rotate(-14deg) scale(1); }
@keyframes rulIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes stampIn {
  from { opacity: 0; transform: rotate(-14deg) scale(2.4); }
  to { opacity: .85; transform: rotate(-14deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .paper.play .rul-row, .paper.play .rul-final b, .paper.play .rul-stamp { animation: none; opacity: 1; }
  .paper.play .rul-stamp { opacity: .85; }
  .tb-fill, .split-bar span { transition: none; }
}

/* =====================================================================
   DESKTOP LAYOUT - the site is made for big screens. These rules come
   last on purpose: they override the older phone layout above.
   ===================================================================== */
:root { --header-h: 80px; }
body { font-size: 17px; min-width: 1180px; } /* made for computers: small windows scroll instead of squashing */
main { max-width: 1480px; padding: 28px 36px 56px; }

/* header: logo · tabs · summary */
.tb-row { max-width: 1480px; min-height: 74px; padding: 10px 36px; gap: 28px; }
.brand { font-size: 27px; margin-right: 0; flex: none; }
.tabbar {
  position: static; display: flex; gap: 6px; flex: 1;
  height: auto; padding: 0; transform: none; width: auto;
  background: none; border: 0; border-radius: 0; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.tabbar button {
  flex-direction: row; align-items: center; gap: 9px; padding: 11px 18px; border-radius: 14px;
  transition: background .15s, color .15s;
}
.tabbar button:hover { background: var(--card); color: var(--text); }
.tabbar button[aria-current="page"] { background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.tabbar button[aria-current="page"] .ti { transform: none; }
.tabbar .ti { font-size: 22px; }
.tabbar .tl { font-size: 17px; }
.tabbar .tv { font-size: 14px; font-weight: 800; color: var(--gold); min-height: 0; }
.tb-stats { display: flex; gap: 28px; flex: none; }
.tb-stat b { font-size: 28px; }
.tb-stat span { font-size: 13px; }
.tb-bar { height: 5px; background: rgba(255,255,255,.04); }

/* views */
.view-head { margin: 0 2px 4px; }
.view-head h1 { font-size: 36px; }
.sec-total { font-size: 28px; }
.view-sub { font-size: 16px; margin-bottom: 14px; }
.card { padding: 24px; margin-bottom: 20px; border-radius: 20px; }
.card h2 { font-size: 21px; margin-bottom: 16px; }
.note { font-size: 14px; }

/* General: two columns */
.gen-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.hero { padding: 36px 28px 26px; }
.hero-label { font-size: 17px; }
.hero-num { font-size: 104px; letter-spacing: -3px; margin: 4px 0 20px; }
.hero-stats { gap: 12px; }
.hero-stats div { padding: 14px 6px; }
.hero-stats b { font-size: 24px; }
.hero-stats span { font-size: 14px; }
.hero-wipe { font-size: 16px; }
.ruling-btn { padding: 20px 22px; margin-bottom: 20px; border-radius: 20px; }
.rb-icon { font-size: 36px; }
.rb-text b { font-size: 25px; }
.rb-text span { font-size: 15px; }
.ruling-btn:hover { filter: brightness(1.04); }
.money-list { grid-template-columns: 1fr 1fr; gap: 22px 22px; }
.auth-now input { font-size: 32px; }
.auth-after b { font-size: 38px; }
.auth-next li { font-size: 15px; padding: 10px 12px; }

/* toolbars: search left, chips right, sticky under the header */
.toolbar {
  top: var(--header-h); margin: 0 -36px 18px; padding: 12px 36px 14px;
  display: flex; align-items: flex-start; gap: 16px;
}
.toolbar .search { width: 360px; flex: none; }
.toolbar .chips { flex: 1; flex-wrap: wrap; overflow: visible; padding: 4px 0 0; }
.chip { font-size: 15px; padding: 7px 14px; }
.chip:hover { border-color: var(--muted); }

/* tile grids: as many columns as fit */
.grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.grid-head { font-size: 19px; margin-top: 18px; }
.grid-head .gi { font-size: 21px; }
.grid-head .gm { font-size: 15px; }
.tile { border-radius: 16px; transition: transform .12s, border-color .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.35); }
.tile-name { font-size: 16px; }
.tile-price { font-size: 15px; }
.tile-rar { font-size: 11px; }
.rarity-legend { font-size: 14px; gap: 8px 16px; }

/* Upgrades: big tree + sidebar */
.tree-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.tree-wrap { margin: 0; }
.tree-scroll {
  height: calc(100vh - var(--header-h) - 250px); min-height: 540px;
  border: 1px solid var(--line); border-radius: 20px;
}
.tree-zoom { right: 16px; bottom: 16px; }
.tree-zoom button { width: 48px; height: 48px; font-size: 26px; }
.tree-zoom button:hover { border-color: var(--muted); }
.tree-side { position: sticky; top: calc(var(--header-h) + 80px); display: grid; gap: 16px; }
.tree-side .rarity-legend { margin: 0; }
.tree-side .note { margin: 0; }
.tree-panel { position: static; max-width: none; margin: 0; padding: 18px; box-shadow: none; }
.tp-empty {
  display: grid; gap: 6px; padding: 20px; border-radius: 18px;
  border: 1px dashed var(--line); color: var(--muted); font-size: 15px;
}
.tp-empty b { color: var(--text); font-size: 18px; }
.tp-img { width: 84px; height: 84px; }
.tp-img img { width: 70px; height: 70px; }
.tp-info b { font-size: 21px; }
.tp-rar, .tp-meta { font-size: 14px; }
.tnode:hover { opacity: 1; filter: none; }

.toast { bottom: 28px; }
.custom-form { max-width: 720px; }
