:root {
    --yellow: #ffe562;
    --yellow-soft: #fff2a8;
    --ink: #111111;
    --paper: #fffdf2;
    --white: #ffffff;
    --muted: #625d49;
    --border: #111111;
    --danger: #a31621;
    --success: #116530;
    --shadow: 8px 8px 0 rgba(17, 17, 17, 0.95);
    --radius: 18px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--yellow);
    color: var(--ink);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.45), transparent 28rem),
        repeating-linear-gradient(135deg, transparent 0 18px, rgba(17, 17, 17, 0.025) 18px 20px),
        var(--yellow);
    line-height: 1.55;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration-thickness: 2px;
    text-underline-offset: 0.18em;
}

a:hover {
    text-decoration-thickness: 4px;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.7rem 1.1rem;
    border: 3px solid var(--border);
    border-radius: 999px;
    background: var(--ink);
    color: var(--white);
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 4px 4px 0 rgba(17, 17, 17, 0.22);
}

button:hover,
.button:hover {
    transform: translate(-1px, -1px);
    box-shadow: 6px 6px 0 rgba(17, 17, 17, 0.22);
}

.button.secondary,
button.secondary {
    background: var(--white);
    color: var(--ink);
}

.button.danger,
button.danger {
    background: var(--danger);
}

.button.small,
button.small {
    min-height: 38px;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
}

.skip-link {
    position: absolute;
    top: -5rem;
    left: 1rem;
    z-index: 999;
    padding: 0.75rem;
    background: var(--white);
    border: 3px solid var(--ink);
}

.skip-link:focus {
    top: 1rem;
}

.site-header,
.admin-header {
    border-bottom: 4px solid var(--ink);
    background: rgba(255, 212, 0, 0.94);
    backdrop-filter: blur(8px);
}

.site-header__inner,
.admin-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.85rem 1rem;
}

.brand {
    font-size: clamp(1.15rem, 4vw, 1.65rem);
    font-weight: 950;
    text-decoration: none;
    letter-spacing: -0.04em;
}

.brand span {
    font-size: 0.55em;
    vertical-align: super;
}

.site-header nav,
.admin-header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 1rem;
    font-weight: 800;
}

.page-shell,
.admin-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.3rem 0 4rem;
}

.hero {
    display: grid;
    grid-template-columns: minmax(190px, 330px) minmax(0, 1fr);
    gap: clamp(1.2rem, 5vw, 4rem);
    align-items: center;
    padding: clamp(1rem, 4vw, 2.5rem) 0;
}

.hero__image {
    display: block;
    width: 100%;
    filter: drop-shadow(10px 12px 0 rgba(17, 17, 17, 0.16));
}

.eyebrow {
    margin: 0 0 0.4rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1,
h2,
h3 {
    line-height: 1.05;
    letter-spacing: -0.045em;
}

h1 {
    margin: 0 0 1rem;
    font-size: clamp(2.0rem, 9vw, 6.0rem);
}

h2 {
    margin-top: 2.2rem;
    font-size: clamp(1.7rem, 5vw, 3rem);
}

h3 {
    font-size: 1.25rem;
}

.lede {
    max-width: 62ch;
    font-size: clamp(1.05rem, 2.3vw, 1.35rem);
    font-weight: 650;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.panel,
.card,
.stat-card,
.empty-state,
.notice,
.admin-card {
    border: 4px solid var(--border);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.panel {
    padding: clamp(1rem, 4vw, 2rem);
    margin: 1.5rem 0;
}

.panel.narrow {
    max-width: 760px;
    margin-inline: auto;
}

.card-grid,
.stats-grid,
.admin-grid,
.duck-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 1rem;
}

.card,
.admin-card {
    padding: 1.15rem;
}

.card h3,
.admin-card h2,
.admin-card h3 {
    margin-top: 0;
}

.stats-grid {
    margin: 1rem 0;
}

.stat-card {
    display: flex;
    flex-direction: column;
    min-height: 150px;
    padding: 1rem;
}

.stat-card__label {
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card__value {
    margin: auto 0;
    font-size: clamp(1.8rem, 6vw, 3rem);
    line-height: 1.05;
}

.stat-card__help {
    color: var(--muted);
}

.emoji-scale {
    letter-spacing: 0.06em;
    white-space: nowrap;
    font-family: system-ui, sans-serif;
}

.notice {
    padding: 1rem 1.15rem;
    margin: 1rem 0;
    background: var(--white);
}

.notice.success {
    border-color: var(--success);
}

.notice.danger {
    border-color: var(--danger);
}

.notice strong {
    display: block;
    margin-bottom: 0.2rem;
}

form {
    margin: 1rem 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.field {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.field.full {
    grid-column: 1 / -1;
}

label {
    font-weight: 900;
}

input,
select,
textarea {
    width: 100%;
    min-height: 48px;
    padding: 0.72rem 0.8rem;
    border: 3px solid var(--ink);
    border-radius: 10px;
    background: var(--white);
    color: var(--ink);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: auto;
    accent-color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
    outline: 4px solid var(--white);
    outline-offset: 3px;
}

.help-text {
    color: var(--muted);
    font-size: 0.92rem;
}

.leaderboard {
    overflow: hidden;
    border: 4px solid var(--ink);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow);
}

.leaderboard__row {
    display: grid;
    grid-template-columns: 70px minmax(150px, 1.4fr) minmax(105px, 0.8fr) minmax(220px, 1fr) minmax(220px, 1fr);
    gap: 0.8rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--ink);
}

.leaderboard__row:last-child {
    border-bottom: 0;
}

.leaderboard__head {
    background: var(--ink);
    color: var(--white);
    font-weight: 900;
}

.leaderboard__row.is-you {
    background: var(--yellow-soft);
}

.rank {
    font-size: 1.35rem;
    font-weight: 950;
}

.you-label {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--white);
    font-size: 0.75rem;
}

.duck-card {
    display: grid;
    gap: 0.5rem;
    border: 3px solid var(--ink);
    border-radius: 14px;
    padding: 1rem;
    background: var(--white);
}

.duck-card h3 {
    margin: 0;
}

.duck-card__numbers {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.duck-result {
    text-align: center;
}

.duck-result .hero__image {
    width: min(280px, 75vw);
    margin-inline: auto;
}

.site-footer {
    padding: 1.5rem 1rem 2.5rem;
    border-top: 4px solid var(--ink);
    text-align: center;
    font-size: 0.9rem;
}

.site-footer p {
    margin: 0.3rem 0;
}

.admin-body {
    background: #ececec;
}

.admin-header {
    max-width: none;
    background: var(--ink);
    color: var(--white);
    align-items: flex-start;
}

.admin-header > div {
    display: grid;
}

.admin-user {
    font-size: 0.8rem;
    opacity: 0.8;
}

.admin-shell {
    width: min(1320px, calc(100% - 2rem));
}

.admin-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.admin-title h1 {
    font-size: clamp(2rem, 5vw, 4rem);
}

.admin-card {
    box-shadow: 5px 5px 0 rgba(17, 17, 17, 0.28);
}

.table-wrap {
    overflow-x: auto;
    border: 3px solid var(--ink);
    border-radius: 12px;
    background: var(--white);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.7rem;
    border-bottom: 1px solid #b8b8b8;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--ink);
    color: var(--white);
}

tr:last-child td {
    border-bottom: 0;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
}

.inline-form input,
.inline-form select {
    min-height: 38px;
    width: auto;
}

.copy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

.copy-row input {
    font-size: 0.82rem;
}

.code-box {
    overflow-wrap: anywhere;
    padding: 0.75rem;
    border: 2px dashed var(--ink);
    background: #f6f6f6;
}

.badge {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    border-radius: 999px;
    background: var(--ink);
    color: var(--white);
    font-size: 0.8rem;
    font-weight: 800;
}

.badge.off {
    background: var(--danger);
}

.danger-zone {
    border-color: var(--danger);
}

.danger-zone h2,
.danger-zone h3 {
    color: var(--danger);
}

.empty-state {
    padding: 2rem;
    text-align: center;
}

@media (max-width: 850px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero__image {
        width: min(290px, 72vw);
        margin-inline: auto;
    }

    .hero .actions {
        justify-content: center;
    }

    .leaderboard__head {
        display: none;
    }

    .leaderboard__row {
        grid-template-columns: 54px 1fr;
        gap: 0.35rem 0.8rem;
    }

    .leaderboard__row > :nth-child(n+3) {
        grid-column: 2;
    }

    .leaderboard__row > :nth-child(3)::before {
        content: "Score: ";
        font-weight: 900;
    }

    .leaderboard__row > :nth-child(4)::before {
        content: "Collection: ";
        font-family: var(--font, inherit);
        font-weight: 900;
    }

    .leaderboard__row > :nth-child(5)::before {
        content: "Today: ";
        font-family: var(--font, inherit);
        font-weight: 900;
    }

    .site-header__inner,
    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-header nav {
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .page-shell,
    .admin-shell {
        width: min(100% - 1rem, 1180px);
    }

    .panel,
    .card,
    .admin-card {
        border-width: 3px;
        box-shadow: 5px 5px 0 rgba(17, 17, 17, 0.9);
    }

    .copy-row {
        grid-template-columns: 1fr;
    }

    .actions > * {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
