@font-face {
    font-family: 'Atkinson Hyperlegible Next';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('/vendor/fonts/atkinson-hyperlegible-next-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
        U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Atkinson Hyperlegible Next';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('/vendor/fonts/atkinson-hyperlegible-next-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
        U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --forest: #0f3d2a;
    --forest-soft: #1b5a40;
    --mint: #19d98a;
    --leaf: #e8f8e3;
    --leaf-deep: #d3efcb;
    --paper: #ffffff;
    --ink: #10261b;
    --muted: #4d6156;
    --line: #cfdfd3;
    --danger: #b3261e;
    --amber: #ffb703;

    --shadow: 0 8px 28px rgb(15 61 42 / 0.2), 0 1px 3px rgb(15 61 42 / 0.14);
    --shadow-low: 0 2px 10px rgb(15 61 42 / 0.2);
    --font: 'Atkinson Hyperlegible Next', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --edge: 10px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --dock-h: 0px;
    --keyboard: 0px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    overflow: hidden;
    overscroll-behavior: none;
    background: var(--leaf);
    color: var(--ink);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.4;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
    margin: 0;
}

button,
input {
    font: inherit;
    color: inherit;
}

button {
    touch-action: manipulation;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

:focus-visible {
    outline: 3px solid var(--mint);
    outline-offset: 2px;
}

/* Map */

.map {
    position: fixed;
    inset: 0;
    background: var(--leaf);
}

.maplibregl-map {
    font-family: var(--font);
}

.maplibregl-ctrl-bottom-left {
    bottom: calc(var(--dock-h) + 2px);
    left: calc(var(--safe-left) + 2px);
}

.me-dot {
    width: 20px;
    height: 20px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 1.5px var(--forest), var(--shadow-low);
}

/* Reticle: the square frame of a tree pit, used as the aiming mark. */

.reticle {
    position: fixed;
    left: 50%;
    top: calc((100% - var(--dock-h)) / 2);
    z-index: 2;
    width: 72px;
    height: 72px;
    transform: translate(-50%, -50%);
    pointer-events: none;
    --stamp: var(--amber);
}

.reticle svg {
    display: block;
    overflow: visible;
}

.reticle-halo,
.reticle-line {
    fill: none;
    stroke-linecap: round;
}

.reticle-halo {
    stroke: #fff;
    stroke-width: 8;
}

.reticle-line {
    stroke: var(--forest);
    stroke-width: 4;
}

.reticle-halo-dot {
    fill: #fff;
}

.reticle-dot {
    fill: var(--forest);
}

.reticle.is-far .reticle-line {
    stroke: var(--danger);
}

.reticle.is-far .reticle-dot {
    fill: var(--danger);
}

.reticle-stamp {
    fill: var(--stamp);
    opacity: 0;
    transform-origin: 36px 36px;
}

.reticle.is-stamping .reticle-stamp {
    animation: stamp 420ms ease-out;
}

@keyframes stamp {
    0% {
        opacity: 0.95;
        transform: scale(1.25);
    }
    100% {
        opacity: 0;
        transform: scale(0.55);
    }
}

/* Top bar */

.topbar {
    position: fixed;
    top: calc(var(--safe-top) + var(--edge));
    left: calc(var(--safe-left) + var(--edge));
    right: calc(var(--safe-right) + var(--edge));
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.topbar > * {
    pointer-events: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 14px 0 9px;
    border-radius: 15px;
    background: var(--paper);
    box-shadow: var(--shadow-low);
}

.brand-mark {
    flex: none;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--forest);
}

.brand-count {
    padding: 2px 9px;
    border-radius: 9px;
    background: var(--leaf-deep);
    color: var(--forest);
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.is-loading .brand-mark {
    animation: breathe 900ms ease-in-out infinite alternate;
}

@keyframes breathe {
    to {
        opacity: 0.45;
    }
}

.net {
    padding: 6px 11px;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.topbar .tile-btn {
    margin-left: auto;
}

/* Square buttons that float over the map */

.tile-btn {
    display: grid;
    place-items: center;
    flex: none;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 15px;
    background: var(--paper);
    color: var(--forest);
    box-shadow: var(--shadow-low);
}

.tile-btn:active {
    background: var(--leaf);
}

.tile-btn.is-signed,
.tile-btn[aria-pressed='true'],
.tile-btn.is-active {
    background: var(--forest);
    color: #fff;
}

.tile-btn.is-busy svg {
    animation: breathe 700ms ease-in-out infinite alternate;
}

.fabs {
    position: fixed;
    right: calc(var(--safe-right) + var(--edge));
    bottom: calc(var(--dock-h) + 12px);
    z-index: 3;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: bottom 160ms ease;
}

.has-toast .fabs {
    bottom: calc(var(--dock-h) + 12px + 64px);
}

.only-fine {
    display: none;
}

@media (pointer: fine) {
    .only-fine {
        display: grid;
    }
}

/* Dock */

.dock {
    position: fixed;
    left: calc(var(--safe-left) + var(--edge));
    right: calc(var(--safe-right) + var(--edge));
    bottom: calc(var(--safe-bottom) + var(--edge));
    z-index: 4;
    display: grid;
    gap: 12px;
    max-width: 460px;
    margin-inline: auto;
    padding: 14px;
    border-radius: 24px;
    background: var(--paper);
    box-shadow: var(--shadow);
}

.dock:empty {
    display: none;
}

.dock-lead {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
    text-wrap: balance;
}

.dock-note,
.dock-hint {
    color: var(--muted);
    font-size: 15px;
    line-height: 1.3;
}

.dock-note {
    margin-top: -6px;
}

.dock-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 28px;
}

.badge {
    flex: none;
    padding: 3px 9px;
    border-radius: 9px;
    background: var(--leaf-deep);
    color: var(--forest);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.badge.is-warn {
    background: #ffe7a8;
    color: #5a3f00;
}

.pulse {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 10px;
    border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 0 0 rgb(25 217 138 / 0.6);
    animation: pulse 1.4s ease-out infinite;
}

@keyframes pulse {
    to {
        box-shadow: 0 0 0 12px rgb(25 217 138 / 0);
    }
}

.types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.type {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 6px;
    min-height: 96px;
    padding: 10px 4px;
    border: 2px solid var(--line);
    border-radius: 18px;
    background: var(--paper);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.1;
    transition: transform 90ms ease, background-color 90ms ease;
}

.type:active {
    transform: scale(0.96);
    border-color: var(--forest);
    background: var(--leaf);
}

.type:disabled {
    opacity: 0.38;
    cursor: default;
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    padding: 10px 18px;
    border: 0;
    border-radius: 16px;
    background: var(--leaf-deep);
    color: var(--forest);
    font-size: 17px;
    font-weight: 700;
    text-align: center;
}

.btn.primary {
    background: var(--forest);
    color: #fff;
}

.btn.danger {
    background: var(--danger);
    color: #fff;
}

.btn.quiet {
    background: transparent;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.btn:disabled {
    opacity: 0.55;
}

.row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 8px;
}

/* Toast */

.toast {
    position: fixed;
    left: calc(var(--safe-left) + var(--edge));
    right: calc(var(--safe-right) + var(--edge));
    bottom: calc(var(--dock-h) + 10px);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 460px;
    min-height: 54px;
    margin-inline: auto;
    padding: 8px 8px 8px 16px;
    border-radius: 16px;
    background: var(--ink);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    box-shadow: var(--shadow);
    animation: rise 160ms ease-out;
}

.toast span {
    flex: 1;
    padding-block: 6px;
}

.toast button {
    flex: none;
    min-height: 40px;
    padding: 0 14px;
    border: 0;
    border-radius: 11px;
    background: var(--mint);
    color: var(--ink);
    font-weight: 800;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

/* Sheet */

.sheet {
    position: fixed;
    inset: auto 0 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    max-height: min(88dvh, 760px);
    margin: 0 auto var(--keyboard);
    padding: 26px 20px calc(20px + var(--safe-bottom));
    overflow-y: auto;
    border: 0;
    border-radius: 26px 26px 0 0;
    background: var(--paper);
    color: var(--ink);
    box-shadow: var(--shadow);
}

.sheet:not([open]) {
    display: none;
}

.sheet[open] {
    display: block;
    animation: rise 180ms ease-out;
}

.sheet::backdrop {
    background: rgb(10 30 20 / 0.48);
}

#sheet-body {
    display: grid;
    gap: 14px;
}

.sheet h2 {
    padding-right: 44px;
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--forest);
    text-wrap: balance;
}

.sheet h3 {
    margin-top: 6px;
    font-size: 17px;
    font-weight: 800;
}

.sheet-close {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 13px;
    background: var(--leaf);
    color: var(--forest);
}

.sheet form {
    display: grid;
    gap: 8px;
}

.sheet label {
    font-size: 15px;
    font-weight: 700;
}

.sheet input {
    width: 100%;
    min-height: 54px;
    padding: 10px 14px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    font-size: 18px;
}

.sheet input:focus {
    border-color: var(--forest);
    outline: none;
}

.code-input {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.3em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.sheet form .btn {
    margin-top: 6px;
}

.form-error {
    color: var(--danger);
    font-size: 15px;
    font-weight: 600;
}

.note,
.fineprint {
    color: var(--muted);
    font-size: 15px;
}

.fineprint {
    font-size: 14px;
}

.callout {
    padding: 12px 14px;
    border-radius: 14px;
    background: #ffe7a8;
    color: #3d2b00;
    font-size: 15px;
    font-weight: 600;
}

.steps {
    display: grid;
    gap: 10px;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps li {
    position: relative;
    min-height: 32px;
    padding-left: 44px;
    counter-increment: step;
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--forest);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
}

.who {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    font-size: 18px;
}

.who span {
    color: var(--muted);
    font-size: 15px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.stats div {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--leaf);
}

.stats dt {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.2;
}

.stats dd {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--forest);
    font-variant-numeric: tabular-nums;
}

.legend {
    display: grid;
    gap: 10px;
    padding: 0;
    list-style: none;
}

.legend li,
.pit-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.legend svg,
.pit-head svg {
    flex: none;
}

.legend div {
    display: grid;
    line-height: 1.25;
}

.legend span,
.pit-head p {
    color: var(--muted);
    font-size: 15px;
}

.own-line {
    padding: 10px 14px;
    border-radius: 14px;
    background: var(--leaf);
    color: var(--forest);
    font-weight: 700;
}

.links {
    display: grid;
    gap: 4px;
}

.links a {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--forest);
    font-weight: 700;
    text-underline-offset: 3px;
}

/* With room beside the centred dock, the map credits and the map buttons
   go to the bottom corners instead of floating at the height of the dock. */

@media (min-width: 560px) {
    .maplibregl-ctrl-bottom-left {
        bottom: calc(var(--safe-bottom) + 2px);
    }

    .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib.maplibregl-compact-show {
        box-sizing: border-box;
        max-width: calc((100vw - 460px) / 2 - 24px);
    }

    .fabs,
    .has-toast .fabs {
        bottom: calc(var(--safe-bottom) + var(--edge));
    }
}

/* Wider screens: the sheet becomes a centred dialog. */

@media (min-width: 720px) {
    .sheet {
        inset: 0;
        margin: auto;
        height: fit-content;
        border-radius: 26px;
        padding-bottom: 24px;
    }
}

/* Phones held sideways: keep the map visible above a shorter dock. */

@media (max-height: 480px) {
    .dock {
        gap: 8px;
        max-width: 420px;
        padding: 10px;
    }

    .type {
        grid-auto-flow: column;
        align-items: center;
        justify-content: center;
        min-height: 56px;
        font-size: 15px;
    }

    .toast {
        max-width: 420px;
    }

    /* The dock is narrower than the screen here, so the map buttons
       sit beside it instead of above it. */
    .fabs,
    .has-toast .fabs {
        bottom: calc(var(--safe-bottom) + var(--edge));
    }

    .maplibregl-ctrl-bottom-left {
        bottom: 2px;
    }

    .type svg {
        width: 32px;
        height: 32px;
    }

    .dock-hint {
        font-size: 14px;
    }
}

@media (max-width: 359px) {
    .brand-name {
        font-size: 16px;
    }

    .type {
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}

/* 404 and no-script fallbacks */

.plain-page {
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 24px;
    text-align: center;
}

.plain-page h1 {
    margin-bottom: 12px;
    color: var(--forest);
}

.noscript {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--leaf);
    text-align: center;
}
