:root {
  color-scheme: dark;
  --bg: #101820;
  --surface: #18232c;
  --surface-raised: #202e39;
  --line: #2d404c;
  --text: #f0f4f6;
  --muted: #91a4b1;
  --gold: #f0bd58;
  --green: #73d49b;
  --red: #f0817d;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% -12%, #2a3b46 0, var(--bg) 42rem);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, textarea, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { max-width: 620px; margin: 0 auto; }
.topbar { display: flex; align-items: center; gap: 11px; padding: 4px 2px 15px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px;
  color: #211906; background: linear-gradient(145deg, #ffda80, #d8952e); font-size: 12px; font-weight: 900;
  box-shadow: 0 7px 22px #e4ad4140;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.15; }
.brand-copy strong { font-size: 15px; letter-spacing: .2px; }
.brand-copy span { color: var(--muted); font-size: 11px; margin-top: 4px; }
.top-avatar { width: 36px; height: 36px; display: grid; place-items: center; margin-left: auto; border-radius: 50%; background: var(--surface-raised); font-size: 17px; }
.tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; padding: 4px; margin-bottom: 21px; border: 1px solid var(--line); border-radius: 15px; background: #121c24cc; }
.tab-button { min-height: 38px; padding: 4px 2px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 650; white-space: nowrap; }
.tab-button.active { background: var(--surface-raised); color: var(--text); box-shadow: 0 1px 4px #0004; }
.screen { animation: appear .18s ease-out; }
.screen[hidden], [hidden] { display: none !important; }
@keyframes appear { from { opacity: .55; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.welcome-row, .panel-heading, .balance-top, .balance-foot, .activity-row, .leader-row, .submission-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.welcome-row { margin: 0 2px 14px; }
.eyebrow { color: #a7b8c3; font-size: 9px; font-weight: 800; letter-spacing: 1.25px; }
h1 { margin: 3px 0 0; font-size: 23px; line-height: 1.22; letter-spacing: -.5px; }
h2 { margin: 0; font-size: 15px; line-height: 1.3; }
p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid #35664a; border-radius: 20px; color: #a3e1b6; font-size: 10px; white-space: nowrap; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: #69d890; box-shadow: 0 0 8px #69d890; }
.balance-card { position: relative; overflow: hidden; padding: 19px 18px 15px; border: 1px solid #735c32; border-radius: 20px; background: linear-gradient(122deg, #3b3324, #272923 55%, #1b282e); box-shadow: 0 14px 36px #0003; }
.balance-card::after { content: ""; position: absolute; width: 180px; height: 180px; right: -88px; top: -105px; border: 1px solid #f0bd583d; border-radius: 50%; box-shadow: 0 0 0 18px #f0bd5810, 0 0 0 36px #f0bd5808; }
.balance-top { color: #e5d3ac; font-size: 12px; }
.coin { font-size: 20px; }
.balance-value { position: relative; z-index: 1; margin: 3px 0 8px; color: var(--gold); font-size: 37px; font-weight: 850; letter-spacing: -1.5px; line-height: 1.1; }
.balance-foot { color: #c2c6bd; font-size: 11px; }
.feature-card { display: flex; align-items: center; gap: 12px; margin: 11px 0; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(130deg, var(--surface-raised), var(--surface)); }
.feature-icon, .shop-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border: 1px solid #40515c; border-radius: 13px; background: #16212a; font-size: 18px; }
.feature-copy { min-width: 0; flex: 1; }
.feature-copy p { line-height: 1.35; }
.feature-copy .eyebrow { margin: 0 0 3px; }
.feature-copy h2 { font-size: 13px; }
.icon-button { width: 37px; height: 37px; flex: 0 0 37px; margin: 0; border: 1px solid #755f37; border-radius: 12px; background: #3c3325; color: var(--gold); font-size: 20px; font-weight: 800; }
.panel { margin: 12px 0; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #18232cdd; }
.panel-heading { margin-bottom: 9px; }
.panel-heading h2 { margin-top: 3px; }
.text-button { width: auto; margin: 0; padding: 7px 9px; border: 0; background: transparent; color: var(--gold); font-size: 11px; font-weight: 700; }
.activity-list, .submission-list, .leaderboard { padding: 0; margin: 0; list-style: none; }
.activity-row, .submission-row { min-height: 50px; padding: 8px 0; border-top: 1px solid #2d3c465e; }
.activity-copy, .submission-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.activity-copy strong, .submission-copy strong { overflow: hidden; color: #e3eaee; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy small, .submission-copy small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.amount-positive { color: var(--green); font-size: 12px; white-space: nowrap; }
.amount-negative { color: #e6a08c; font-size: 12px; white-space: nowrap; }
.page-heading { margin: 0 2px 16px; }
.page-heading h1 { margin: 5px 0; }
.page-heading p { max-width: 440px; font-size: 12px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 12px 0; border: 1px solid var(--line); border-radius: 14px; background: #121c24; }
.segment { min-height: 37px; margin: 0; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.segment.active { background: #334550; color: var(--text); }
.tank-search-panel { padding: 12px; }
.tank-catalog-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 14px; background: #121c24; }
.tank-catalog-tabs .segment { min-width: 0; padding: 5px 2px; font-size: 10px; }
.tank-search-input { width: 100%; min-height: 45px; padding: 10px 12px; border: 1px solid #374955; border-radius: 12px; background: #101920; color: var(--text); font: inherit; }
.tank-search-input::placeholder { color: #768a97; }
.tank-search-meta { min-height: 18px; margin: 9px 2px 0; }
.tank-results { display: grid; gap: 8px; padding: 0; margin: 10px 0 0; list-style: none; }
.tank-result { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.tank-result summary { position: relative; display: flex; min-height: 74px; align-items: center; gap: 10px; padding: 9px 34px 9px 10px; cursor: pointer; list-style: none; }
.tank-result summary::-webkit-details-marker { display: none; }
.tank-result summary::after { content: "＋"; position: absolute; right: 14px; color: var(--gold); }
.tank-result[open] summary::after { content: "−"; }
.tank-photo-thumb { width: 78px; height: 54px; flex: 0 0 78px; position: relative; display: grid; place-items: center; overflow: hidden; border: 1px solid #344651; border-radius: 9px; background: #101920; color: #91a4b1; font-size: 10px; }
.tank-result-photo { width: 100%; height: 100%; display: block; object-fit: cover; }
.tank-photo-placeholder { padding: 2px; text-align: center; }
.tank-photo-placeholder[hidden] { display: none; }
.tank-result-summary-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tank-result-name { padding-right: 0; font-size: 13px; font-weight: 750; }
.tank-result-subtitle { padding-right: 0; color: var(--muted); font-size: 10px; }
.tank-photo-credit { display: block; overflow: hidden; padding: 8px 12px 0; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.tank-photo-credit[hidden] { display: none; }
.tank-details { overflow-wrap: anywhere; white-space: pre-wrap; margin: 0; padding: 12px; border-top: 1px solid var(--line); color: #d9e2e7; font: 11px/1.55 system-ui, sans-serif; }
.leaderboard-panel { padding: 6px 14px; }
.leader-row { min-height: 53px; border-bottom: 1px solid #2d3c465e; }
.leader-row:last-child { border-bottom: 0; }
.rank-number { width: 28px; color: var(--muted); font-size: 11px; font-weight: 800; }
.rank-1 { color: #ffd36d; }.rank-2 { color: #d0dae0; }.rank-3 { color: #d79d73; }
.leader-name { flex: 1; overflow: hidden; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.leader-row strong { color: var(--gold); font-size: 12px; white-space: nowrap; }
.shop-item { display: flex; align-items: center; gap: 11px; margin: 10px 0; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.shop-copy { min-width: 0; flex: 1; }
.shop-copy h2 { font-size: 13px; }
.shop-copy p { line-height: 1.35; }
.price-tag { display: inline-block; margin-top: 6px; color: var(--gold); font-size: 11px; font-weight: 800; }
.primary-button, .secondary-button { min-height: 43px; padding: 11px 13px; border: 0; border-radius: 12px; background: linear-gradient(130deg, #f4c86f, #dda542); color: #241a08; font-size: 12px; font-weight: 800; cursor: pointer; }
.primary-button:active, .secondary-button:active { transform: scale(.985); }
.secondary-button { background: #30434f; color: var(--text); }
.primary-button:disabled, .secondary-button:disabled, .icon-button:disabled { opacity: .5; cursor: default; }
.form-block { margin-top: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #151f27; }
label { display: block; margin-bottom: 7px; color: #e0e7eb; font-size: 12px; font-weight: 700; }
textarea, input[type="file"], input[type="url"] { width: 100%; border: 1px solid #374955; border-radius: 12px; background: #101920; color: var(--text); }
textarea { min-height: 94px; padding: 11px 12px; resize: vertical; }
textarea::placeholder { color: #768a97; }
input[type="url"] { min-height: 43px; padding: 10px 12px; font: inherit; }
input[type="url"]::placeholder { color: #768a97; }
.channel-link-field { margin-top: 13px; }
.channel-link-field small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.4; }
input[type="file"] { padding: 8px; font-size: 11px; }
input[type="file"]::file-selector-button { margin-right: 8px; padding: 7px 9px; border: 0; border-radius: 8px; background: #30434f; color: var(--text); font-size: 11px; }
.button-row { display: grid; gap: 7px; margin-top: 5px; }
.notice { margin: 10px 5px; color: var(--muted); font-size: 10px; }
.submission-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 12px 0; }
.type-card { min-height: 101px; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); text-align: left; }
.type-card:disabled { opacity: .48; cursor: not-allowed; }
.type-card.selected { border-color: #a6813d; background: #322c21; box-shadow: inset 0 0 0 1px #a6813d45; }
.type-card span { font-size: 18px; }
.type-card strong { font-size: 10px; line-height: 1.2; }
.type-card small { color: var(--muted); font-size: 9px; line-height: 1.25; }
.submit-panel label:not(:first-child) { margin-top: 12px; }
.submit-panel small { display: block; margin-top: 7px; color: var(--muted); font-size: 10px; }
.full-button { width: 100%; margin-top: 13px; }
.state-badge { flex: 0 0 auto; padding: 5px 7px; border-radius: 9px; background: #293a45; color: #c2d2dc; font-size: 9px; font-weight: 700; }
.state-approved { background: #203e31; color: #8fe0ae; }.state-rejected { background: #472b2c; color: #f2a09d; }.state-reviewing { background: #473a22; color: #f4cf78; }
.empty-row { padding: 13px 0; color: var(--muted); font-size: 11px; list-style: none; }
.toast { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 5; min-height: 0; margin: 0; padding: 0 13px; border: 0 solid transparent; border-radius: 13px; background: #263742; color: #e6eef2; font-size: 12px; opacity: 0; transform: translateY(7px); pointer-events: none; transition: .18s ease; }
.toast.visible { min-height: 42px; display: flex; align-items: center; margin-top: 10px; padding: 9px 13px; border-width: 1px; border-color: #435661; opacity: 1; transform: translateY(0); }
.toast.error { border-color: #8a4848; background: #3b272a; color: #ffc3bd; }
footer { padding: 18px 0 4px; color: #748794; font-size: 10px; text-align: center; }

@media (min-width: 520px) {
  body { padding-right: 20px; padding-left: 20px; }
  .tab-button { font-size: 12px; }
  .tank-catalog-tabs .segment { font-size: 12px; }
  .button-row { grid-template-columns: 1fr 1fr; }
  .type-card { min-height: 112px; padding: 12px; }
  .type-card strong { font-size: 11px; }
}
