:root {
  --bg: #121a14; --card: #1c2a1f; --line: #2e4232; --text: #eef3e8; --muted: #9fb39f;
  --acc: #e8a33d; --red: #e56b6f; --blue: #5aa9e6;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.35 system-ui, -apple-system, sans-serif; }
body { padding: calc(env(safe-area-inset-top) + 56px) 0 calc(env(safe-area-inset-bottom) + 150px); overscroll-behavior-y: none; }
h1, h2, h3 { margin: 0; }
h2 { font-size: 20px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 4px 8px; }
small { display: block; font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 13px; }
.grow { flex: 1; min-width: 0; }

header { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: rgba(18, 26, 20, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
header h1 { font-size: 20px; }
.net { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: #25402b; color: #9ee6a8; border: 0; }
.net.off { background: #3d3222; color: var(--acc); }
.net.warn { background: #4a2224; color: #ffb3b5; }

main { max-width: 560px; margin: 0 auto; padding: 12px 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; }

button, .btn { font: inherit; color: var(--text); background: #2a3d2e; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
button:active, .btn:active { transform: scale(.97); }
.primary { background: var(--acc); color: #1d1406; border-color: transparent; font-weight: 700; }
.ghost { background: transparent; }
.danger { background: #4a2224; border-color: #6b3033; width: 100%; }
.ico { background: none; border: 0; padding: 6px; font-size: 18px; text-decoration: none; }
input, select { font: inherit; color: var(--text); background: #0f1611; border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; width: 100%; }
select { margin-bottom: 10px; }
.num { width: 90px; text-align: center; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chip { flex: none; border-radius: 99px; padding: 8px 14px; white-space: nowrap; }
.chip.on { background: var(--c, var(--acc)); color: #111; border-color: transparent; font-weight: 700; }

#fab { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 76px); z-index: 6; max-width: 528px; margin: 0 auto;
  padding: 16px; font-size: 18px; font-weight: 800; border-radius: 99px; background: var(--acc); color: #1d1406; border: 0;
  box-shadow: 0 8px 30px rgba(232, 163, 61, .35); }
#tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: rgba(18, 26, 20, .96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(env(safe-area-inset-bottom) + 6px); }
#tabs button { flex: 1; flex-direction: column; gap: 2px; background: none; border: 0; font-size: 11px; color: var(--muted); padding: 4px 0; }
#tabs button span { font-size: 22px; }
#tabs button.on { color: var(--acc); }

.hero { text-align: center; padding: 30px 20px; }
.hero p { color: var(--muted); }
.big { font-size: 72px; line-height: 1; }

.me { border-color: var(--c); background: linear-gradient(160deg, color-mix(in srgb, var(--c) 18%, var(--card)), var(--card) 60%); }
.me-top { display: flex; align-items: center; gap: 12px; }
.avatar { font-size: 34px; line-height: 1; }
.rank { font-size: 28px; font-weight: 800; color: var(--c); }
.pos { font-size: 24px; width: 30px; text-align: center; font-weight: 800; }
.score { text-align: right; } .score b { font-size: 22px; }
.kpis { display: flex; gap: 8px; margin: 14px 0 12px; }
.kpis > div { flex: 1; text-align: center; }
.kpis b { font-size: 28px; display: block; }
.card.kpis { margin: 0 0 10px; }

.bar { position: relative; height: 26px; background: #0f1611; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--acc); border-radius: 99px; transition: width .4s; }
.bar span { position: relative; font-size: 13px; font-weight: 600; line-height: 26px; padding-left: 12px; text-shadow: 0 1px 2px #000; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 22px; }
.badges .off { filter: grayscale(1); opacity: .2; }
.legend div { padding: 4px 0; }
.player .me-top { margin-bottom: 6px; }

.seg { display: flex; background: #0f1611; border-radius: 12px; padding: 4px; margin-bottom: 10px; }
.seg button { flex: 1; background: none; border: 0; }
.seg button.on { background: var(--card); color: var(--acc); font-weight: 700; }

.carcard { display: flex; align-items: center; gap: 14px; }
#arrow { width: 56px; height: 56px; flex: none; fill: var(--acc); transition: transform .3s; }
.dist { font-size: 22px; color: var(--text); }

.find { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; }
.find img, .noimg { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; }
.noimg { display: grid; place-items: center; background: #0f1611; font-size: 26px; }
.find b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { font-style: italic; }

.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .emo { font-size: 16px; fill: initial; }
.chart polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.chart .grid { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .hbar { fill: var(--acc); }
.map .chart { background: radial-gradient(circle, #1f3324, #131d16); border-radius: 12px; }
.chart .pt { stroke: #111; stroke-width: 1.5; cursor: pointer; }
.chart .pt.sel { stroke: #fff; stroke-width: 3; }
.chart .me { fill: var(--blue); stroke: #fff; stroke-width: 2; }
.chart .halo { fill: var(--blue); opacity: .25; }
.chart .scale { stroke: var(--text); stroke-width: 2; }
.chart .n { fill: var(--text); font-weight: 700; }
.chart .nfill { fill: var(--red); }

.award { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.award:last-child { border: 0; }
.award > span:first-child { font-size: 26px; }
.award > span:last-child { font-size: 14px; font-weight: 600; white-space: nowrap; }

dialog { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 22px; padding: 16px; width: min(560px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
#addBody h2 { margin-bottom: 12px; }
#addBody > * + * { margin-top: 10px; }
.photos { display: flex; gap: 8px; align-items: center; }
.photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 12px; }
.photos .btn { flex: 1; padding: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.sp { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 12px; text-align: center; min-height: 78px; }
.sp span { font-size: 22px; }
.sp.on { background: var(--acc); color: #1d1406; font-weight: 700; }
.sp.on small { color: #3a2a0c; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper span { flex: 1; color: var(--muted); }
.stepper b { font-size: 24px; min-width: 36px; text-align: center; }
.stepper button { width: 48px; height: 44px; font-size: 20px; }
.gps { font-size: 13px; color: var(--muted); }
#photo { padding: 0; background: #000; width: auto; }
#photo img { display: block; max-width: 94vw; max-height: 86vh; }

#party { position: fixed; inset: 0; z-index: 20; display: none; place-items: center; background: rgba(0, 0, 0, .55); pointer-events: none; overflow: hidden; }
#party.on { display: grid; }
.boom { text-align: center; background: var(--card); border: 2px solid var(--acc); border-radius: 24px; padding: 24px 30px; max-width: 86vw; animation: pop .45s cubic-bezier(.2, 1.6, .4, 1); }
.boom h2 { font-size: 40px; color: var(--acc); }
.newbadge { margin-top: 10px; background: #3d3222; border-radius: 12px; padding: 8px 12px; }
#party i { position: absolute; top: -50px; font-style: normal; animation: fall 1.8s ease-in forwards; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 150px); transform: translate(-50%, 20px); z-index: 30;
  background: #eef3e8; color: #111; padding: 10px 16px; border-radius: 99px; font-weight: 600; opacity: 0; transition: .25s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.title { margin: 4px 4px 12px; }
.who { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 14px; }
.who button { flex-direction: column; padding: 14px 8px; font-weight: 700; border-color: var(--c); }
.who button span { font-size: 34px; }
header .ico { font-size: 20px; padding: 4px; }
[hidden] { display: none !important; }
.sp { white-space: normal; }
.lvup { margin-top: 10px; background: linear-gradient(90deg, #e8a33d, #f2d65c); color: #1d1406; border-radius: 12px; padding: 10px; font-weight: 800; font-size: 18px; animation: pop .6s .2s both cubic-bezier(.2, 1.6, .4, 1); }
.next { margin-top: 6px; }
.goals .bar { height: 30px; }
.goals .bar span { line-height: 30px; display: flex; width: 100%; padding-right: 12px; }
.fr { margin-left: auto; }
.levels { columns: 2; font-size: 13px; }
.levels div { break-inside: avoid; }
.rank small { display: inline; font-size: 14px; }
.bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
