/* Balls's own CSS, written by hand with no build step, on top of Hellsick.UI (its reset, the --hs-* colours in
   BallsSkin.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; }
    .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; }

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

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

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

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

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

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

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

    .balls-prompt {
        font-size: 1.5rem;
        font-weight: 700;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    .balls-answer-input { resize: vertical; font-size: 1rem; line-height: 1.4; }

    .balls-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;
    }
    .balls-progress-done { background-color: var(--hs-btn-ok); color: #fff; }

    .balls-choice {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        min-height: 3rem;
        padding: 0.625rem 0.75rem;
        border-radius: var(--hs-radius);
        background-color: var(--hs-btn-neutral);
        color: #fff;
        text-align: left;
        overflow-wrap: anywhere;
        touch-action: manipulation;
        transition: filter 120ms;
    }
    .balls-choice:hover:not(:disabled) { filter: brightness(1.2); }
    /* Disabled choices stay readable: they're still the thing everyone is looking at. */
    button.balls-choice:disabled { filter: none; cursor: default; }
    .balls-choice.balls-choice-mine { background-color: rgb(0 0 0 / 0.25); color: var(--hs-text-subtle); }
    .balls-choice.balls-choice-picked { box-shadow: inset 0 0 0 2px var(--hs-accent-1); }

    .balls-choice-tag {
        flex-shrink: 0;
        color: var(--hs-accent-1);
        font-size: 0.75rem;
        font-weight: 600;
    }

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

    .balls-truth-banner {
        padding: 0.75rem;
        border-radius: var(--hs-radius);
        background-color: var(--hs-btn-ok);
        color: #fff;
        text-align: center;
        animation: balls-pop 240ms ease-out;
    }

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

    @media (prefers-reduced-motion: reduce) {
        .balls-reveal, .balls-truth-banner { animation: none; }
    }

    /* The privacy page: a readable column of prose. */
    .balls-privacy { max-width: 40rem; line-height: 1.6; }
    .balls-privacy > * + * { margin-top: 1rem; }
    .balls-privacy h2 { margin-top: 2rem; font-size: 1.2rem; font-weight: 600; line-height: inherit; }
    .balls-privacy ul { padding-left: 1.25rem; list-style: disc; }
    .balls-privacy li + li { margin-top: 0.5rem; }
    .balls-privacy a:not(.balls-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. */
    .balls-test-seat { width: 22.5rem; }

    /* QR codes need a light, high-contrast backing to scan. */
    .balls-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)); }
    }
}
