/* All of the app's global CSS, written by hand with no build step. In order: a small reset, layout utilities, then the
   look. Colours and surfaces live in variables, reached through the .huh-* classes, so the look can change in one place.
   A utility missing from the list below does nothing, so add it here when markup needs a new one. */

/* Reset */
*, ::before, ::after {
    box-sizing: border-box;
    border: 0 solid #e5e7eb;
}

html {
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    tab-size: 4;
}

body { margin: 0; line-height: inherit; }
h1, h2, h3, h4, h5, h6 { font-size: inherit; font-weight: inherit; }
h1, h2, h3, h4, h5, h6, p, pre, figure, blockquote, dl, dd, hr { margin: 0; }
ol, ul, menu { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: inherit; }
b, strong { font-weight: bolder; }
table { text-indent: 0; border-color: inherit; border-collapse: collapse; }
dialog { padding: 0; }
textarea { resize: vertical; }
img, svg, video, canvas, audio, iframe, embed, object { display: block; vertical-align: middle; }
img, video { max-width: 100%; height: auto; }
[hidden] { display: none; }

button, input, optgroup, select, textarea {
    font: inherit;
    letter-spacing: inherit;
    color: inherit;
    margin: 0;
    padding: 0;
}
button, select { text-transform: none; }
button, input[type="button"], input[type="reset"], input[type="submit"] {
    appearance: button;
    background-color: transparent;
    background-image: none;
}
input::placeholder, textarea::placeholder { opacity: 1; color: #9ca3af; }
button, [role="button"] { cursor: pointer; }
:disabled { cursor: default; }

/* 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; }
.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 */
:root {
    --huh-bg:          #17132b;
    --huh-surface:     #231d3f;
    --huh-text:        #f1eefb;
    --huh-subtle:      #a79fc8;
    --huh-accent:      #ffc94d;
    --huh-link:        #ffd97f;
    --huh-border:      rgb(167 159 200 / 0.45);
    --huh-divider:     rgb(167 159 200 / 0.22);

    --huh-btn:           #3a3163;
    --huh-btn-ok:        #1f8a5b;
    --huh-btn-alert:     #b23a48;
    --huh-btn-alternate: #3467a8;

    --huh-alert-bg:     rgb(153 27 27 / 0.8);
    --huh-alert-border: rgb(248 113 113 / 0.6);
}

body {
    background-color: var(--huh-bg);
    color: var(--huh-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

th { text-align: left; }

a { color: var(--huh-link); }
a:hover { text-decoration: underline; }

.huh-surface { background-color: var(--huh-surface); }
.huh-border  { border-color: var(--huh-border); }
.huh-divider { border-color: var(--huh-divider); }
.huh-subtle  { color: var(--huh-subtle); }
.huh-accent  { color: var(--huh-accent); }

.huh-card {
    background-color: var(--huh-surface);
    border: 1px solid var(--huh-border);
    border-radius: 0.5rem;
}

.huh-input {
    background-color: #fff;
    color: #17132b;
    border-radius: 0.375rem;
}

.huh-btn, .huh-btn-ok, .huh-btn-alert, .huh-btn-alternate {
    color: #fff;
    transition: filter 120ms;
}
.huh-btn           { background-color: var(--huh-btn); }
.huh-btn-ok        { background-color: var(--huh-btn-ok); }
.huh-btn-alert     { background-color: var(--huh-btn-alert); }
.huh-btn-alternate { background-color: var(--huh-btn-alternate); }

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

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

.huh-alert {
    background-color: var(--huh-alert-bg);
    border-color: var(--huh-alert-border);
    color: #fff;
}

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

/* The game: big tap targets for thumbs, with the phrase as the thing to look at. */
.huh-urgent { color: #ff8a80; }

.huh-word {
    min-height: 2.75rem;
    padding: 0.25rem;
    border-radius: 0.375rem;
    background-color: var(--huh-btn);
    color: #fff;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
    touch-action: manipulation;
    transition: filter 120ms;
}
.huh-word:hover:not(:disabled) { filter: brightness(1.2); }
.huh-word-ruled-out { text-decoration: line-through; opacity: 0.45; }

.huh-phrase { min-height: 4rem; }

.huh-chip {
    padding: 0.125rem 0.625rem;
    border-radius: 0.375rem;
    background-color: var(--huh-accent);
    color: var(--huh-bg);
    font-size: 1.25rem;
    font-weight: 600;
    animation: huh-pop 180ms ease-out;
}

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

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

/* The describer's sentences, with the bin beside them. Dragging is in sentence-board.js. */
.huh-board { display: flex; gap: 0.5rem; }
.huh-sentences { display: flex; flex: 1 1 0%; flex-direction: column; gap: 0.375rem; min-width: 0; }

.huh-sentence {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    background-color: rgb(0 0 0 / 0.2);
    cursor: pointer;
}
.huh-sentence-active { box-shadow: inset 0 0 0 2px var(--huh-accent); }
.huh-sentence.huh-drop-over { background-color: rgb(255 255 255 / 0.08); }

.huh-chip-small { padding: 0.125rem 0.5rem; font-size: 1rem; }

/* A finger on a chip drags it rather than scrolling the page. */
.huh-chip-draggable { touch-action: none; user-select: none; cursor: grab; }
.huh-chip-dragging { opacity: 0.3; }

.huh-drag-ghost {
    position: fixed;
    z-index: 50;
    pointer-events: none;
    transform: translate(-50%, -120%) scale(1.1);
    box-shadow: 0 4px 12px rgb(0 0 0 / 0.4);
    animation: none;
}

.huh-drop-marker {
    position: fixed;
    z-index: 49;
    width: 3px;
    border-radius: 2px;
    background-color: var(--huh-accent);
    pointer-events: none;
}

.huh-bin {
    display: flex;
    flex: 0 0 3.25rem;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--huh-subtle);
    border-radius: 0.375rem;
    color: var(--huh-subtle);
    font-size: 1.25rem;
    opacity: 0.6;
}
.huh-bin.huh-drop-over { border-style: solid; border-color: #ff8a80; color: #ff8a80; opacity: 1; }

/* The describer's rows. A belt holds a row's words in equal slots and starts just past the right edge, sliding its whole
   length to the left over the round. Its timing comes from the server, in DescriberPanel. */
.huh-stream-row { display: flex; gap: 0.25rem; }

.huh-freeze {
    display: flex;
    flex: 0 0 3.25rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 3rem;
    border-radius: 0.375rem;
    background-color: var(--huh-surface);
    color: var(--huh-subtle);
    font-size: 0.625rem;
    line-height: 1.1;
    touch-action: manipulation;
}
.huh-freeze-on { background-color: var(--huh-accent); color: var(--huh-bg); font-weight: 600; }

.huh-stream {
    position: relative;
    flex: 1 1 0%;
    min-width: 0;
    height: 3rem;
    overflow: hidden;
    container-type: inline-size;
    border-radius: 0.375rem;
    background-color: rgb(0 0 0 / 0.2);
}
.huh-stream-frozen { box-shadow: inset 0 0 0 2px var(--huh-accent); }

.huh-stream-belt {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 100%;
    animation-name: huh-stream;
    animation-timing-function: linear;
    animation-fill-mode: both;
}

@keyframes huh-stream {
    to { transform: translateX(-100%); }
}

.huh-word.huh-stream-word {
    position: absolute;
    top: 0;
    bottom: 0;
    min-height: 0;
    border: 2px solid transparent;
    background-clip: padding-box;
}

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

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