body { overscroll-behavior: none; }
.screen { min-height: 100dvh; }
.center { display: grid; place-items: center; padding: 16px; }
.loginbox { width: min(440px, 100%); }
.loginbox input[type=password] { font-size: 28px; letter-spacing: 10px; text-align: center; }
.err { color: var(--bad); font-weight: 600; min-height: 1.2em; }
.banner { padding: 10px 14px; font-size: .95em; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.banner.warn { background: #fff3cd; color: #5c4400; }
.banner.bad { background: var(--bad); color: #fff; font-weight: 600; }
.banner.info { background: color-mix(in srgb, var(--info) 15%, var(--surface)); }

.main { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(6px + env(safe-area-inset-top)) 12px 6px; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 1.05em; margin: 0; }
.chip { border: 2px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .85em; min-height: 40px; cursor: pointer; max-width: 55vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.ok { border-color: var(--ok); color: var(--ok); }
.chip.wait { border-color: var(--warn); color: var(--warn); }
.chip.off { border-color: var(--muted); color: var(--muted); }
.layout { flex: 1; min-height: 0; position: relative; display: grid; grid-template-columns: 1fr; }
.mapbox { position: absolute; inset: 0; }
.panel { position: absolute; inset: 0; background: var(--bg); overflow: auto; padding: 12px 12px 90px; -webkit-overflow-scrolling: touch; }
.panel.closed { display: none; }
.mapctl { position: fixed; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; z-index: 20; }
.bottomnav { display: flex; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); z-index: 30; }
.bottomnav button { flex: 1; border: 0; background: none; min-height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 20px; cursor: pointer; color: var(--muted); }
.bottomnav button span { font-size: 12px; font-weight: 600; }
.bottomnav button[aria-current="page"] { color: var(--accent); }

@media (min-width: 900px) {
  .layout { grid-template-columns: 1fr 420px; }
  .mapbox { position: relative; inset: auto; }
  .panel { position: relative; inset: auto; border-left: 1px solid var(--border); padding-bottom: 20px; }
  .panel.closed { display: block; }
  .bottomnav button[data-tab="map"] { display: none; }
  .mapctl { right: 440px; bottom: 24px; }
  .sheet { left: auto !important; right: 430px !important; width: 420px; bottom: 16px !important; border-radius: 16px !important; }
  .formview { left: auto !important; width: min(640px, 60vw); border-left: 1px solid var(--border); box-shadow: var(--shadow); }
}

.listtools { position: sticky; top: -12px; background: var(--bg); padding: 4px 0 8px; z-index: 2; }
.listtools input { flex: 1; min-width: 160px; }
.listtools select { width: auto; }
.objlist { list-style: none; margin: 0; padding: 0; }
.objlist li { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 8px; cursor: pointer; min-height: 60px; }
.objlist li .pin { flex: none; }
.objlist .t1 { font-weight: 700; }
.objlist .t2 { font-size: .85em; color: var(--muted); }
.objlist .dist { margin-left: auto; font-weight: 700; white-space: nowrap; }
.sect { font-weight: 700; margin: 12px 0 6px; }

.sheet { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: 0 -4px 20px rgba(0,0,0,.25); z-index: 40;
  padding: 16px; max-height: 70dvh; overflow: auto; }
.sheet .close { position: absolute; right: 10px; top: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .95em; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.note { background: #fff3cd; color: #5c4400; padding: 8px 10px; border-radius: 8px; margin: 6px 0; font-weight: 600; }
.signref { background: color-mix(in srgb, var(--info) 12%, var(--surface)); padding: 8px 10px; border-radius: 8px; margin: 6px 0; }

.formview { position: fixed; inset: 0; background: var(--bg); z-index: 60; display: flex; flex-direction: column; }
.formhead { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: var(--surface); border-bottom: 1px solid var(--border); }
.formhead h2 { margin: 0; font-size: 1.05em; flex: 1; }
.formbody { flex: 1; overflow: auto; padding: 12px 12px 120px; -webkit-overflow-scrolling: touch; }
.formfoot { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
.fsec { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.fsec h3 { font-size: 1em; margin: 0 0 8px; }
.fitem { padding: 10px 0; border-top: 1px solid var(--border); }
.fitem:first-of-type { border-top: 0; }
.fitem .lbl { font-weight: 600; margin-bottom: 6px; display: flex; gap: 6px; align-items: flex-start; }
.fitem .lbl .req { color: var(--bad); }
.fitem.missing { background: color-mix(in srgb, var(--bad) 10%, transparent); border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.help { border: 0; background: var(--surface-2); border-radius: 50%; width: 26px; height: 26px; font-weight: 700; flex: none; cursor: pointer; }
.helptext { font-size: .9em; color: var(--muted); margin: 4px 0 6px; }
.safety { background: #fff3cd; color: #5c4400; border-radius: 8px; padding: 8px 10px; font-weight: 600; margin-bottom: 8px; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.nums label { font-size: .8em; color: var(--muted); display: block; text-align: center; }
.nums input { text-align: center; font-size: 20px; padding: 6px; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; }
.photo { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo button { position: absolute; right: 2px; top: 2px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-weight: 700; cursor: pointer; }
.addphoto { width: 96px; height: 96px; border-radius: 10px; border: 2px dashed var(--border); background: none; font-size: 30px; cursor: pointer; color: var(--muted); }
.nfbtn { border-color: var(--warn); color: var(--warn); }
.taskq { font-weight: 600; margin-bottom: 6px; }
.optrow { display: flex; gap: 6px; flex-wrap: wrap; }
.optrow button { flex: 1 1 140px; min-height: 48px; border: 2px solid var(--border); background: var(--surface); border-radius: 10px; font-weight: 600; cursor: pointer; padding: 6px 10px; }
.optrow button[aria-pressed="true"] { background: var(--info); color: #fff; border-color: var(--info); }
.summary { color: var(--bad); font-weight: 600; margin-bottom: 8px; }

.welldone { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.welldone .card { width: min(420px, 100%); text-align: center; position: relative; overflow: hidden; }
.welldone h2 { font-size: 2em; margin: 8px 0; }
.welldone .pts { font-size: 2.4em; font-weight: 800; color: var(--accent); }
.bar { height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 10px 0; }
.bar > div { height: 100%; border-radius: 999px; }
.bounce { animation: bounce .7s ease-out; }
@keyframes bounce { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
.confetti { position: absolute; top: -10px; width: 8px; height: 14px; opacity: .9; animation: fall 2.2s linear forwards; }
@keyframes fall { to { transform: translateY(520px) rotate(540deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bounce, .confetti { animation: none; } .confetti { display: none; } }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; }
.rank li.me { border: 3px solid var(--accent); }
.rank .pos { font-size: 1.3em; font-weight: 800; width: 28px; text-align: center; }
.rank .pts { margin-left: auto; text-align: right; font-weight: 800; font-size: 1.2em; }
.badges { font-size: .85em; }
.winner { text-align: center; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, #ffe082, #ffca28); color: #3e2a00; font-weight: 800; margin-bottom: 10px; }

.dialogwrap { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100; display: grid; place-items: center; padding: 16px; }
.dialog { width: min(460px, 100%); max-height: 90dvh; overflow: auto; }
.dialog .btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.queue li { font-size: .9em; }

.screen.overlay { position: fixed; inset: 0; z-index: 200; background: var(--bg); }
#teamBadge { flex-wrap: nowrap; min-width: 0; }
#teamBadge h1 { white-space: nowrap; }
#teamBadge .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.panel { z-index: 10; }
.banner { font-size: .85em; }
