:root {
    --bg: #f4f2ed;
    --surface: #faf9f6;
    --ink: #161616;
    --muted: #7b7973;
    --soft: #aaa79f;
    --line: #d8d5ce;
    --line-dark: #9c9991;
    --danger: #a12d26;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100%;
    margin: 0;

    color: var(--ink);
    background: var(--bg);

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

button,
input,
textarea {
    font: inherit;
}

button {
    color: inherit;
}

::selection {
    color: var(--bg);
    background: var(--ink);
}


/* ------------------------------------------------
   APP
------------------------------------------------ */

#app {
    display: flex;
    flex-direction: column;

    width: 100%;
    min-height: 100dvh;

    padding:
        max(18px, env(safe-area-inset-top))
        18px
        max(24px, env(safe-area-inset-bottom));
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;

    min-height: 34px;

    color: var(--muted);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 12px;
    text-transform: lowercase;
}

.brand {
    color: var(--ink);
}

.progress-text {
    min-width: 50px;
    text-align: right;
}

.screen {
    display: flex;
    flex: 1;
    flex-direction: column;

    width: 100%;

    padding:
        clamp(42px, 9vh, 86px)
        0
        18px;

    animation: screen-in 80ms linear;
}

@keyframes screen-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* ------------------------------------------------
   TYPE
------------------------------------------------ */

.eyebrow {
    margin: 0 0 16px;

    color: var(--muted);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 12px;
    line-height: 1.4;

    text-transform: lowercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 20px;

    font-size: clamp(43px, 13vw, 66px);
    font-weight: 500;
    line-height: 0.94;
    letter-spacing: -0.06em;
}

h2 {
    margin-bottom: 18px;

    font-size: clamp(31px, 9vw, 48px);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.05em;
}

h3 {
    font-size: 18px;
    font-weight: 500;
}

.lede {
    max-width: 480px;

    margin-bottom: 36px;

    color: var(--muted);

    font-size: 16px;
    line-height: 1.5;
    letter-spacing: -0.015em;
}

.sub {
    max-width: 520px;

    margin: -3px 0 30px;

    color: var(--muted);

    font-size: 16px;
    line-height: 1.45;
}

.tiny {
    color: var(--soft);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 12px;
    line-height: 1.45;
}

.center {
    text-align: center;
}


/* ------------------------------------------------
   FORM
------------------------------------------------ */

.field {
    display: grid;
    gap: 8px;

    margin-top: 26px;
}

.field label {
    color: var(--muted);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 12px;
    text-transform: lowercase;
}

.text-input,
.message-input {
    width: 100%;

    padding: 14px 0;

    color: var(--ink);
    background: transparent;

    border: 0;
    border-bottom: 1px solid var(--line-dark);
    border-radius: 0;

    outline: none;

    font-size: 19px;
    letter-spacing: -0.02em;
}

.text-input:focus,
.message-input:focus {
    border-bottom-color: var(--ink);
}

.text-input::placeholder,
.message-input::placeholder {
    color: var(--soft);
}

.message-input {
    min-height: 92px;

    resize: none;
    line-height: 1.4;
}


/* ------------------------------------------------
   BUTTONS
------------------------------------------------ */

.button-stack {
    display: grid;
    gap: 8px;

    margin-top: 30px;
}

.choice,
.primary,
.secondary,
.weird-button {
    appearance: none;

    width: 100%;

    border-radius: 0;

    cursor: pointer;
}

.choice {
    min-height: 56px;

    padding: 15px 16px;

    color: var(--ink);
    background: rgba(255, 255, 255, 0.22);

    border: 1px solid var(--line);

    font-size: 16px;
    line-height: 1.35;
    letter-spacing: -0.01em;

    text-align: left;

    transition:
        background 100ms ease,
        border-color 100ms ease,
        color 100ms ease;
}

.choice:active {
    color: var(--bg);
    background: var(--ink);
    border-color: var(--ink);
}

.choice.selected {
    color: var(--bg);
    background: var(--ink);
    border-color: var(--ink);
}

.choice:disabled:not(.locked) {
    cursor: default;
    opacity: 1;
}

.choice-dimmed {
    opacity: 0.34 !important;
}

.primary.selected,
.secondary.selected,
.weird-button.selected {
    color: var(--bg);
    background: var(--ink);
    border-color: var(--ink);
    text-decoration: none;
}

.primary,
.secondary {
    min-height: 56px;

    margin-top: 32px;
    padding: 15px 18px;

    border: 1px solid var(--ink);

    font-size: 15px;
    font-weight: 500;

    text-transform: lowercase;
}

.primary {
    color: var(--bg);
    background: var(--ink);
}

.secondary {
    color: var(--ink);
    background: transparent;
}

.primary:active,
.secondary:active {
    opacity: 0.72;
}

.weird-button {
    margin-top: 18px;
    padding: 12px 0;

    color: var(--muted);
    background: transparent;

    border: 0;

    text-align: left;
    text-decoration: underline;
    text-underline-offset: 4px;

    font-size: 14px;
}


/* ------------------------------------------------
   NUMBER
------------------------------------------------ */

.number-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;

    margin-top: 30px;
}

.number-choice {
    min-height: 74px;

    font-size: 22px;
    text-align: center;
}


/* ------------------------------------------------
   ORIENTATION
------------------------------------------------ */

.orientation-scene {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
}

.orientation-scene h2 {
    margin: 0;
}


/* ------------------------------------------------
   INTERLUDE
------------------------------------------------ */

.interlude {
    display: flex;
    flex: 1;
    flex-direction: column;

    justify-content: center;
}

.interlude h2 {
    margin: 0;
}


/* ------------------------------------------------
   WORM FIND
------------------------------------------------ */

.worm-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);

    gap: 6px;

    margin-top: 22px;
}

.worm-cell {
    display: grid;
    place-items: center;

    min-height: 48px;

    padding: 0;

    color: var(--ink);
    background: transparent;

    border: 0;

    cursor: pointer;
}

.worm-cell span {
    display: inline-block;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 26px;
    line-height: 1;

    transform: rotate(var(--rotation));
}

.worm-cell:active {
    opacity: 0.35;
}

.worm-feedback {
    min-height: 26px;

    margin-top: 20px;

    color: var(--ink);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 13px;
}


/* ------------------------------------------------
   TAP ZONE
------------------------------------------------ */

.tap-zone {
    display: flex;
    flex: 1;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    min-height: 55dvh;

    border: 1px solid var(--line);

    cursor: pointer;

    user-select: none;
    touch-action: manipulation;
}

.tap-zone p {
    margin: 0;

    color: var(--muted);

    font-size: 16px;
}

.tap-verdict {
    font-size: clamp(42px, 13vw, 70px);
    font-weight: 500;
    letter-spacing: -0.055em;
}


/* ------------------------------------------------
   DRAG
------------------------------------------------ */

.drag-wrap {
    margin-top: 38px;
}

.drag-lane {
    position: relative;

    width: 100%;
    height: 96px;

    border-bottom: 1px solid var(--line);
}

.drag-worm {
    position: absolute;
    bottom: 13px;
    left: 0;

    display: grid;
    place-items: center;

    width: 52px;
    height: 52px;

    padding: 0;

    color: var(--ink);
    background: transparent;

    border: 1px solid var(--line);
    border-radius: 50%;

    cursor: grab;

    touch-action: none;
    user-select: none;

    font-family:
        Georgia,
        "Times New Roman",
        serif;

    font-size: 28px;
}

.drag-worm:active {
    cursor: grabbing;
}

.distance-readout {
    margin-top: 15px;

    color: var(--muted);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 13px;
}


/* ------------------------------------------------
   RESTAURANT
------------------------------------------------ */

.restaurant-list {
    display: grid;
    gap: 8px;

    margin-top: 28px;
}

.restaurant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 54px;

    padding: 0 15px;

    border: 1px solid var(--line);
}

.restaurant-row button {
    flex: 1;

    padding: 16px 0;

    color: var(--ink);
    background: transparent;

    border: 0;

    font-size: 16px;
    text-align: left;

    cursor: pointer;
}

.restaurant-no {
    color: var(--muted);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 13px;
}

.fire-flash {
    display: grid;
    flex: 1;
    place-items: center;

    font-size: min(35vw, 150px);

    animation: fire-pop 500ms ease;
}

@keyframes fire-pop {
    0% {
        opacity: 0;
        transform: scale(0.4);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}


/* ------------------------------------------------
   BIRD
------------------------------------------------ */

.bird-stage {
    position: relative;

    width: 100%;
    height: 180px;

    margin-top: 28px;

    overflow: hidden;

    border-bottom: 1px solid var(--line);

    touch-action: manipulation;
}

.bird-worm {
    position: absolute;
    bottom: 24px;
    left: 8%;

    font-size: 29px;
}

.bird {
    position: absolute;
    bottom: 23px;
    left: 80%;

    padding: 10px;

    background: transparent;
    border: 0;

    font-size: 44px;

    cursor: pointer;
    touch-action: manipulation;
}

.bird-timer {
    margin-top: 14px;

    color: var(--muted);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 13px;
}


/* ------------------------------------------------
   EMAIL
------------------------------------------------ */

.email-shell {
    margin-top: 26px;

    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.email-meta {
    display: grid;
    gap: 5px;

    padding: 16px 0;

    color: var(--muted);

    border-bottom: 1px solid var(--line);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 12px;
}

.email-body {
    padding: 30px 0;

    font-size: 21px;
    line-height: 1.35;
    letter-spacing: -0.03em;
}

.creator-note {
    margin-bottom: 20px;

    color: var(--danger);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 15px;
    line-height: 1.4;
}


/* ------------------------------------------------
   RESULTS
------------------------------------------------ */

.result-list {
    margin-top: 38px;

    border-top: 1px solid var(--line);
}

.result-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 20px;

    padding: 15px 0;

    border-bottom: 1px solid var(--line);

    font-size: 14px;
    line-height: 1.35;
}

.result-row span:first-child {
    color: var(--muted);
}

.result-row span:last-child {
    max-width: 180px;
    text-align: right;
}

.tampered {
    margin-top: 42px;
    padding: 18px 0;

    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.tampered-label {
    margin-bottom: 10px;

    color: var(--soft);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 12px;
}

.tampered-old {
    margin-bottom: 7px;

    color: var(--soft);

    font-size: 14px;
    text-decoration: line-through;
}

.tampered-new {
    display: flex;
    align-items: baseline;
    justify-content: space-between;

    gap: 20px;

    font-size: 19px;
}

.final-line {
    margin-top: 38px;

    font-size: 24px;
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.choice.locked {
    cursor: default;
    pointer-events: none;

    opacity: 0.42;

    color: var(--ink);
    background: transparent;
    border-color: var(--line);
}

.choice.selected.locked {
    opacity: 0.55;

    color: var(--ink);
    background: #dedbd4;
    border-color: #c5c1b8;
}


/* ------------------------------------------------
   DESKTOP — ONLY AN ENHANCEMENT
------------------------------------------------ */

@media (min-width: 700px) {
    #app {
        max-width: 560px;
        margin: 0 auto;

        padding-left: 0;
        padding-right: 0;
    }

    .screen {
        padding-top: 80px;
    }
}


/* ============================================================
   MOBILE TYPE — ACTUALLY READABLE THIS TIME
============================================================ */

body {
    font-size: 17px;
}


/* very small UI text */

.topbar {
    font-size: 14px;
}

.progress-text {
    font-size: 14px;
}


.eyebrow,
.field label,
.tiny,
.email-meta,
.tampered-label {
    font-size: 14px;
    line-height: 1.45;
}


/* normal supporting text */

.lede,
.sub {
    font-size: 18px;
    line-height: 1.45;
}


/* answer buttons */

.choice,
.restaurant-row button,
.tap-zone p {
    font-size: 17px;
    line-height: 1.4;
}


/* main buttons */

.primary,
.secondary {
    font-size: 16px;
}


/* imagine dragons deserves to be readable */

.weird-button {
    font-size: 16px;
    line-height: 1.4;
}


/* little reaction/status text */

.worm-feedback,
.distance-readout,
.restaurant-no,
.bird-timer {
    font-size: 14px;
    line-height: 1.45;
}


/* IMPORTANT COMMUNICATION */

.creator-note {
    margin-bottom: 22px;

    font-size: 16px;
    line-height: 1.45;
}


/* results */

.result-row {
    font-size: 15px;
    line-height: 1.4;
}


/* orientation fallback shouldn't look like
   a giant normal CTA */

.orientation-fallback {
    margin-top: 34px;

    color: var(--muted);

    background: transparent;

    border-color: var(--line);

    font-size: 15px;
}