/* Link's own CSS, written by hand with no build step, on top of Hellsick.UI (its reset, the --hs-* colours in
   LinkSkin.cs, .hs-card, .hs-alert and friends). Everything is in the game layer, so it beats the shared styles without
   fighting their specificity. In order: layout utilities, then the look. A utility missing from the list below does
   nothing, so add it here when markup needs a new one. */
@layer game {
    /* Layout utilities */
    .fixed { position: fixed; }
    .top-0 { top: 0; }
    .z-40 { z-index: 40; }

    .inline-block { display: inline-block; }
    .flex { display: flex; }
    .grid { display: grid; }
    .flex-1 { flex: 1 1 0%; }
    .flex-row { flex-direction: row; }
    .flex-col { flex-direction: column; }
    .flex-wrap { flex-wrap: wrap; }
    .shrink-0 { flex-shrink: 0; }
    .grow { flex-grow: 1; }
    .items-end { align-items: flex-end; }
    .items-center { align-items: center; }
    .justify-start { justify-content: flex-start; }
    .justify-center { justify-content: center; }
    .justify-between { justify-content: space-between; }
    .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .gap-2 { gap: 0.5rem; }
    .gap-3 { gap: 0.75rem; }

    .space-x-2 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.5rem; }
    .space-x-3 > :not([hidden]) ~ :not([hidden]) { margin-left: 0.75rem; }
    .space-x-4 > :not([hidden]) ~ :not([hidden]) { margin-left: 1rem; }
    .space-y-1 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.25rem; }
    .space-y-2 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.5rem; }
    .space-y-3 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.75rem; }
    .space-y-4 > :not([hidden]) ~ :not([hidden]) { margin-top: 1rem; }
    .space-y-5 > :not([hidden]) ~ :not([hidden]) { margin-top: 1.25rem; }

    .h-8 { height: 2rem; }
    .h-10 { height: 2.5rem; }
    .min-h-5 { min-height: 1.25rem; }
    .min-h-screen { min-height: 100vh; }
    .w-8 { width: 2rem; }
    .w-24 { width: 6rem; }
    .w-65-percent { width: 65%; }
    .w-75-percent { width: 75%; }
    .w-full { width: 100%; }
    .w-max { width: max-content; }
    .max-w-xs { max-width: 20rem; }
    .max-w-4xl { max-width: 56rem; }

    .mx-auto { margin-left: auto; margin-right: auto; }
    .my-4 { margin-top: 1rem; margin-bottom: 1rem; }
    .mb-4 { margin-bottom: 1rem; }
    .ml-1 { margin-left: 0.25rem; }
    .mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
    .my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
    .mr-1 { margin-right: 0.25rem; }
    .mr-2 { margin-right: 0.5rem; }
    .px-4 { padding-left: 1rem; padding-right: 1rem; }
    .mt-2 { margin-top: 0.5rem; }
    .mt-3 { margin-top: 0.75rem; }

    .p-2 { padding: 0.5rem; }
    .p-3 { padding: 0.75rem; }
    .p-6 { padding: 1.5rem; }
    .px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
    .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
    .py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
    .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
    .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
    .py-20 { padding-top: 5rem; padding-bottom: 5rem; }
    .pt-4 { padding-top: 1rem; }

    .overflow-x-auto { overflow-x: auto; }
    .rounded-md { border-radius: 0.375rem; }
    .border { border-width: 1px; }
    .border-t { border-top-width: 1px; }
    .border-b { border-bottom-width: 1px; }
    .border-b-2 { border-bottom-width: 2px; }
    .shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
    .opacity-50 { opacity: 0.5; }

    /* Text utilities */
    .text-left { text-align: left; }
    .text-center { text-align: center; }
    .text-right { text-align: right; }
    .text-xs { font-size: 0.75rem; line-height: 1rem; }
    .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
    .text-xl { font-size: 1.25rem; line-height: 1.75rem; }
    .text-2xl { font-size: 1.5rem; line-height: 2rem; }
    .text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
    .font-medium { font-weight: 500; }
    .font-semibold { font-weight: 600; }
    .font-bold { font-weight: 700; }
    .font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
    .italic { font-style: italic; }
    .uppercase { text-transform: uppercase; }
    .tabular-nums { font-variant-numeric: tabular-nums; }
    .leading-none { line-height: 1; }
    .tracking-widest { letter-spacing: 0.1em; }
    .no-underline { text-decoration-line: none; }
    .whitespace-nowrap { white-space: nowrap; }
    .break-all { word-break: break-all; }

    /* The look: colours come from the skin tokens. */
    th { text-align: left; }

    a { text-decoration: none; }
    a:hover { text-decoration: underline; }

    .link-divider { border-color: var(--hs-divider); }

    .link-input {
        background-color: var(--hs-bg-input);
        color: var(--hs-text-input);
        border-radius: var(--hs-radius);
    }

    /* Link's buttons keep their own sizes (set by utilities in the markup), so they take only the colours. */
    .link-btn, .link-btn-ok, .link-btn-alert, .link-btn-alternate {
        color: var(--hs-btn-text);
        transition: filter 120ms;
    }
    .link-btn           { background-color: var(--hs-btn-neutral); }
    .link-btn-ok        { background-color: var(--hs-btn-ok); }
    .link-btn-alert     { background-color: var(--hs-btn-alert); }
    .link-btn-alternate { background-color: var(--hs-btn-alternate); }

    .link-btn:hover:not(:disabled), .link-btn-ok:hover:not(:disabled), .link-btn-alert:hover:not(:disabled),
    .link-btn-alternate:hover:not(:disabled) { filter: brightness(1.15); }

    button:disabled { filter: saturate(0.3) brightness(0.65); cursor: not-allowed; }

    .link-table th, .link-table td { padding: 0.25rem 0.5rem; }

    /* The game: the grid is the thing to look at, and its words are big tap targets for thumbs. */
    .link-good { color: #7ee2a8; }
    .link-bad { color: #ff8a80; }

    .link-clue-input { font-size: 1rem; text-transform: lowercase; }

    /* A clue, shown the way the guesser reads it. */
    .link-clue {
        font-size: 1.75rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--hs-accent-1);
        overflow-wrap: anywhere;
    }
    .link-clue-small { font-size: 1.125rem; }

    .link-progress {
        padding: 0.125rem 0.5rem;
        border-radius: 999px;
        background-color: rgb(0 0 0 / 0.2);
        color: var(--hs-text-subtle);
        font-size: 0.75rem;
    }
    .link-progress-done { background-color: var(--hs-btn-ok); color: #fff; }

    .link-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.375rem;
    }
    .link-grid-small { gap: 0.25rem; }

    .link-word {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 3.25rem;
        padding: 0.25rem 0.125rem;
        border-radius: var(--hs-radius);
        background-color: var(--hs-btn-neutral);
        color: var(--hs-text);
        font-size: 0.75rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        text-transform: uppercase;
        text-align: center;
        line-height: 1.1;
        overflow-wrap: anywhere;
        touch-action: manipulation;
        transition: filter 120ms, box-shadow 120ms;
    }
    .link-grid-small .link-word { min-height: 2.25rem; font-size: 0.625rem; }
    button.link-word:hover:not(:disabled) { filter: brightness(1.2); }
    /* A locked-in grid stays readable: it's still the thing everyone is looking at. */
    button.link-word:disabled { filter: none; cursor: default; }

    /* The two words to link: filled with the accent. */
    .link-word.link-word-lit { background-color: var(--hs-accent-1); color: var(--hs-bg-page); }
    /* A pick while guessing, and at the reveal a pick that missed: an accent ring. */
    .link-word.link-word-picked { box-shadow: inset 0 0 0 3px var(--hs-accent-1); background-color: #4a5299; color: #fff; }
    .link-word.link-word-hit { box-shadow: inset 0 0 0 3px #7ee2a8; }
    .link-word.link-word-miss { box-shadow: inset 0 0 0 3px #ff8a80; }
    .link-word-mark { position: absolute; top: 0.125rem; right: 0.25rem; font-size: 0.625rem; }
    .link-word-hit .link-word-mark { color: #0f5132; }
    .link-word-miss .link-word-mark { color: #ff8a80; }

    .link-reveal {
        padding: 0.75rem;
        border-radius: var(--hs-radius-lg);
        background-color: var(--hs-bg-card);
        overflow-wrap: anywhere;
        animation: link-pop 240ms ease-out both;
    }
    .link-reveal-scored { box-shadow: inset 0 0 0 2px #7ee2a8; }

    @keyframes link-pop {
        from { transform: scale(0.95); opacity: 0; }
        to   { transform: scale(1); opacity: 1; }
    }

    @media (prefers-reduced-motion: reduce) {
        .link-reveal { animation: none; }
    }

    /* The privacy page: a readable column of prose. */
    .link-privacy { max-width: 40rem; line-height: 1.6; }
    .link-privacy > * + * { margin-top: 1rem; }
    .link-privacy h2 { margin-top: 2rem; font-size: 1.2rem; font-weight: 600; line-height: inherit; }
    .link-privacy ul { padding-left: 1.25rem; list-style: disc; }
    .link-privacy li + li { margin-top: 0.5rem; }
    .link-privacy a:not(.link-btn) { color: var(--hs-link); text-decoration: underline; }

    /* A seat in a developer's test table: about a phone's width, to show what a player would see. */
    .link-test-seat { width: 22.5rem; }

    /* QR codes need a light, high-contrast backing to scan. */
    .link-qr { background-color: #fff; }

    /* Static-SSR error page exception dump. */
    .error-detail {
        white-space: pre-wrap;
        word-break: break-word;
        font-size: 0.8rem;
    }

    /* Wider screens */
    @media (min-width: 768px) {
        .md-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }
}
