/* Cards Against Gielinor. Builds on /games/trivia/trivia.css (buttons, chips,
   lobby, QR, toast) and adds the cards. Phone first: a column of cards you
   scroll with a thumb, and the one button that matters kept in reach. */

/* iOS zooms into any text box under 16px and does not zoom back out, which
   leaves the page wider than the screen and the buttons off the side of it. */
.cah-home input, .cah-home .idpick-name { font-size: max(16px, 1em); }

.cah-title { margin: 0.25rem 0 1rem; }
.cah-title .cah-black { transform: rotate(-2deg); max-width: 19rem; }

.or { display: flex; align-items: center; gap: 0.75rem; color: var(--dim); margin: 1rem 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ------------------------------------------------------------ the cards */

.cah-black, .cah-white {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 700; letter-spacing: -0.01em; line-height: 1.3;
    border-radius: 14px; overflow-wrap: anywhere;
}

.cah-black {
    position: relative; background: #0d0d0f; color: #fff;
    border: 1px solid #2c2f38; padding: 1.1rem 1.1rem 2.2rem;
    font-size: clamp(1.15rem, 5vw, 1.45rem); min-height: 8.5rem;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45); margin: 0.5rem 0 1rem;
}
.cah-black p { margin: 0; line-height: 1.3; }
.cah-black .blank { color: #8b8f99; }
.cah-black .fill { color: var(--gold-bright, #f3c26b); }
.cah-black.is-won { border-color: var(--gold, #e0a244); }
.cah-black.is-small { font-size: 0.98rem; min-height: 0; padding: 0.8rem 0.9rem 1.9rem; margin: 0; }
.cah-brand {
    position: absolute; left: 1.1rem; bottom: 0.7rem;
    font-size: 0.68rem; font-weight: 600; color: #8b8f99; letter-spacing: 0.02em;
}
.cah-brand b { color: #fff; }

.cah-white {
    display: block; background: #fafafa; color: #111;
    padding: 0.85rem 0.95rem; font-size: 1.02rem; text-align: left;
    border: 2px solid transparent; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

/* What was played, for the Czar to judge and everybody to read. */
.cah-plays { display: grid; gap: 0.8rem; margin: 0.75rem 0 1rem; }
.cah-play {
    appearance: none; display: grid; gap: 0.35rem; padding: 0.4rem;
    background: var(--card-2, #262b36); border: 2px solid var(--line, #38404f);
    border-radius: 16px; font: inherit; color: inherit; text-align: left;
    width: 100%; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
button.cah-play:not(:disabled) { cursor: pointer; }
.cah-play.is-picked, .cah-play.is-winner { border-color: var(--gold, #e0a244); box-shadow: 0 0 0 3px rgba(224, 162, 68, 0.25); }
.cah-plays.is-revealed .cah-play:not(.is-winner) { opacity: 0.7; }
.cah-by { font-size: 0.85rem; color: var(--dim); padding: 0 0.3rem 0.1rem; }
.cah-play.is-winner .cah-by { color: var(--gold-bright, #f3c26b); font-weight: 700; }

.cah-role { font-size: 1rem; line-height: 1.5; margin: 0 0 0.4rem; }
.cah-winner { font-size: 1.2rem; text-align: center; margin: 0.25rem 0 0.75rem; }

/* The button that matters, kept on screen at the bottom of the page -- sticky
   rather than fixed, so it stays inside the page and never ends up under a
   browser toolbar or a keyboard. */
.cah-foot {
    position: sticky; bottom: 0; z-index: 10;
    padding: 0.75rem 0 calc(0.75rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(20, 22, 28, 0), var(--bg-quiz, #14161c) 30%);
    display: grid; gap: 0.35rem;
}
.cah-foot.dock-two { display: flex; }
.link.small { font-size: 0.85rem; justify-self: center; }

/* ------------------------------------------------------------ scores */

.cah-board { margin: 1rem 0 0; border-top: 1px solid var(--line); padding-top: 0.5rem; }
.cah-board summary { cursor: pointer; color: var(--gold); padding: 0.5rem 0; font-weight: 700; }
.cah-scores { list-style: none; margin: 0.25rem 0 0; padding: 0; display: grid; gap: 0.3rem; }
.cah-scores li {
    display: flex; align-items: center; gap: 0.5rem;
    background: var(--card-2, #262b36); border-radius: 10px; padding: 0.4rem 0.6rem;
}
.cah-scores li.is-me { outline: 1px solid var(--gold); }
.cah-scores .who { display: flex; align-items: center; gap: 0.45rem; flex: 1; min-width: 0; }
.cah-scores .who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cah-scores .tags em {
    font-style: normal; font-size: 0.72rem; padding: 0.1rem 0.45rem; border-radius: 999px;
    background: rgba(224, 162, 68, 0.18); color: var(--gold-bright, #f3c26b); margin-left: 0.25rem;
}
.cah-scores .tags em.ok { background: rgba(80, 200, 120, 0.16); color: #7fdc9c; }
.cah-scores .tags em.wait { background: rgba(255, 255, 255, 0.06); color: var(--dim); }
.cah-scores .pts { font-size: 1.1rem; min-width: 1.5rem; text-align: right; }

.cah-over .cah-scores { margin-bottom: 1rem; }
.cah-history { display: grid; gap: 0.75rem; }
.cah-hist .cah-by { display: block; margin-top: 0.25rem; }

.chip.is-spicy.is-on { background: #7a1f2b; border-color: #c2414f; color: #fff; }

/* ------------------------------------------------------------ the TV */

.cah-tv .cah-black { font-size: clamp(1.6rem, 3.2vw, 2.6rem); max-width: 60rem; margin: 1rem auto; }
.cah-tv .cah-plays { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); max-width: 80rem; margin: 1rem auto; }
.cah-tv .cah-white { font-size: clamp(1rem, 1.6vw, 1.4rem); }

/* ------------------------------------------------------------ the table */

.cah-round { padding-bottom: 0; }

/* Who's at the table: names and scores, never their cards. */
.cah-seats {
    list-style: none; margin: 0 0 0.6rem; padding: 0;
    display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center;
}
.cah-seats li {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--card-2, #262b36); border: 1px solid var(--line, #38404f);
    border-radius: 999px; padding: 0.2rem 0.6rem 0.2rem 0.25rem; font-size: 0.85rem;
}
.cah-seats li.is-me { border-color: var(--gold, #e0a244); }
.cah-seats li.is-czar { background: rgba(224, 162, 68, 0.14); }
.seat-name { max-width: 7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-score { color: var(--gold-bright, #f3c26b); }
.seat-tag { font-size: 0.8rem; color: var(--dim); }
.seat-tag.is-done { color: #7fdc9c; }

.cah-table {
    background: radial-gradient(120% 90% at 50% 20%, rgba(224, 162, 68, 0.07), transparent 60%), var(--card, #1d212a);
    border: 1px solid var(--line, #38404f); border-radius: 20px;
    padding: 0.9rem 0.9rem 1.1rem; margin-bottom: 0.75rem;
}
.cah-status { text-align: center; margin: 0 0 0.6rem; font-size: 0.98rem; line-height: 1.45; }
.cah-table .cah-black { max-width: 22rem; margin: 0 auto 1rem; }
.cah-empty { text-align: center; color: var(--dim); font-size: 0.85rem; margin: 0.5rem 0 0; }

/* Played cards: face down, dropped on top of each other; yours face up. */
.cah-stack { display: flex; justify-content: center; align-items: flex-start; padding: 0.25rem 0 0.5rem; min-height: 7.5rem; }
.cah-back, .cah-mine { flex: none; transform: rotate(var(--tilt, 0deg)); }
.cah-stack > * + * { margin-left: -3.4rem; }
.cah-back {
    width: 5.6rem; height: 7.4rem; border-radius: 10px;
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 6px, transparent 6px 12px),
        linear-gradient(160deg, #1a1c22, #0b0c0f);
    border: 2px solid #f4f2ee; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    display: grid; place-items: center; padding: 0.4rem;
}
.cah-back span { color: #f4f2ee; font: 700 0.62rem/1.2 "Helvetica Neue", Helvetica, Arial, sans-serif; text-align: center; }
.cah-mine { display: grid; gap: 0.2rem; width: 7.2rem; position: relative; }
.cah-mine em { position: absolute; top: -1.2rem; left: 0; right: 0; font-style: normal; font-size: 0.72rem; color: var(--gold-bright, #f3c26b); text-align: center; }
.cah-small { font-size: 0.82rem; padding: 0.55rem 0.6rem; border-radius: 10px; }

/* Judging and the reveal: turned over so they can be read. */
.cah-table .cah-plays { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); margin: 0; }

/* ------------------------------------------------------------ your hand */

.cah-handwrap {
    position: sticky; bottom: 0; z-index: 20;
    margin: 0 -1rem; padding: 0.4rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(20, 22, 28, 0), var(--bg-quiz, #14161c) 22%);
}
.cah-handwrap.is-static { position: relative; }
.cah-handbar { display: flex; align-items: center; justify-content: center; gap: 0.75rem; min-height: 2.6rem; padding: 0 0.5rem 0.45rem; }
.cah-handbar .btn { min-height: 44px; padding: 0.6rem 1.4rem; }

/* The card being read, in full, above the hand. */
.cah-peek {
    position: absolute; left: 0; right: 0; bottom: calc(100% - 0.5rem); z-index: 70;
    display: flex; justify-content: center; padding: 0 1rem; pointer-events: none;
}
.cah-peek .cah-white { max-width: 20rem; font-size: 1.1rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55); border-color: var(--gold, #e0a244); }

.cah-fan {
    display: grid; grid-template-columns: repeat(var(--n1, 9), minmax(0, 2.6rem)) max-content;
    justify-content: center; align-items: end; padding: 1.4rem 1rem 0; height: 9.2rem;
    overflow-x: clip; overflow-clip-margin: 0; overflow-y: visible;
}
.cah-hc {
    appearance: none; flex: none; position: relative;
    width: 6.6rem; height: 8.6rem; padding: 0.55rem 0.5rem;
    background: #fafafa; color: #111; border: 2px solid #d9d9d9; border-radius: 10px;
    font: 700 0.74rem/1.25 "Helvetica Neue", Helvetica, Arial, sans-serif; text-align: left;
    box-shadow: -3px 2px 8px rgba(0, 0, 0, 0.35);
    transform: translateY(var(--drop, 0)) rotate(var(--tilt, 0deg)); transform-origin: 50% 100%;
    transition: transform 0.12s ease, border-color 0.12s ease;
    cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.hc-text { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cah-hc.is-peek { transform: translateY(-1.4rem) rotate(0deg) scale(1.04); border-color: #b9b9b9; }
.cah-hc.is-picked { transform: translateY(-1.1rem) rotate(0deg); border-color: var(--gold, #e0a244); background: #fff6e3; }
.cah-hc.is-picked.is-peek { transform: translateY(-1.8rem) rotate(0deg) scale(1.04); }
.cah-order {
    position: absolute; top: -0.65rem; left: -0.35rem;
    width: 1.6rem; height: 1.6rem; border-radius: 50%;
    background: var(--gold, #e0a244); color: #191308; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    display: grid; place-items: center; font-size: 0.9rem;
}
.cah-fan.is-idle .cah-hc { filter: saturate(0.7) brightness(0.8); }
@media (hover: hover) {
    .cah-hc:hover { transform: translateY(-1.4rem) rotate(0deg) scale(1.04); z-index: 60 !important; }
}
@media (min-width: 640px) {
    .screen.cah-round { max-width: 58rem; }
    .cah-table { padding: 1.4rem 1.4rem 1.6rem; }
    .cah-table .cah-black { max-width: 26rem; }
    .cah-hc { width: 8.4rem; height: 10.6rem; font-size: 0.84rem; }
    .cah-fan { height: 11.4rem; grid-template-columns: repeat(var(--n1, 9), minmax(0, 5rem)) max-content; }
    .cah-back { width: 6.4rem; height: 8.4rem; }
}

/* ------------------------------------------------------------ the Card Maker */

.mk-tabs { display: flex; gap: 0.4rem; margin: 0.5rem 0 1rem; flex-wrap: wrap; }
.mk-input {
    width: 100%; font: inherit; font-size: max(16px, 1rem); line-height: 1.45;
    background: var(--card-2, #262b36); color: var(--ink); border: 1px solid var(--line, #38404f);
    border-radius: 12px; padding: 0.75rem 0.85rem; margin: 0.5rem 0 0.6rem; resize: vertical;
}
.mk-input:focus { outline: 2px solid var(--gold); outline-offset: -2px; }
.mk-list { display: grid; gap: 0.8rem; margin: 0.75rem 0 1rem; }
.mk-card { background: var(--card, #1d212a); border: 1px solid var(--line, #38404f); border-radius: 14px; padding: 0.7rem; display: grid; gap: 0.5rem; }
.mk-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.mk-match { font-size: 0.85rem; color: #f3c26b; background: rgba(224, 162, 68, 0.1); border-radius: 10px; padding: 0.5rem 0.6rem; display: grid; gap: 0.2rem; }
.mk-match.is-dupe { color: #ff9aa5; background: rgba(194, 65, 79, 0.15); }
.mk-m i { color: var(--dim); font-style: normal; font-size: 0.78rem; }
.mk-result { margin: 0; font-size: 0.88rem; }
.mk-result.is-ok { color: #7fdc9c; }
.mk-result.is-bad { color: #ff9aa5; }
.mk-status { margin: 0; font-size: 0.85rem; color: var(--dim); }
.mk-status.is-approved { color: #7fdc9c; }
.mk-status.is-denied, .mk-status.is-removed { color: #ff9aa5; }
.mk-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.5rem 0; }
.mk-pick { display: flex; align-items: center; gap: 0.45rem; font-size: 0.88rem; color: var(--dim); }
.mk-pick input, .mk-bulk input { width: 20px; height: 20px; }
.mk-decide { display: flex; gap: 0.5rem; }
.mk-decide .btn { flex: 1; min-height: 44px; }

/* ------------------------------------------------------------ the clock */

.cah-clock {
    position: relative; height: 1.5rem; margin: -0.2rem auto 0.8rem; max-width: 22rem;
    border-radius: 999px; overflow: hidden;
    background: var(--card-2, #262b36); border: 1px solid var(--line, #38404f);
}
.cah-clock i {
    position: absolute; inset: 0 auto 0 0; width: 100%;
    background: linear-gradient(90deg, rgba(224, 162, 68, 0.55), rgba(243, 194, 107, 0.75));
    transition: width 0.25s linear;
}
.cah-clock.is-low i { background: linear-gradient(90deg, rgba(194, 65, 79, 0.7), rgba(240, 110, 120, 0.8)); }
.cah-clock b {
    position: relative; display: block; text-align: center; line-height: 1.45rem;
    font-size: 0.82rem; font-variant-numeric: tabular-nums; color: var(--ink);
}

/* Somebody who has gone away: still at the table, not waited for. */
.lobby-list li.is-away, .cah-seats li:has(.seat-tag[title^="Away"]) { opacity: 0.55; }

.mk-search { margin-top: 0.75rem; }

/* The categories in the lobby: tiles like Party's game picker. */
.cah-decks { display: grid; gap: 0.5rem; margin: 0.25rem 0 0.5rem; }
.cah-decks .gametile {
    display: grid; grid-template-columns: 1fr auto; gap: 0.7rem; align-items: center;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 0.75rem;
    cursor: pointer; text-align: left; color: inherit; font: inherit; appearance: none; width: 100%;
    touch-action: manipulation;
}
.cah-decks .gametile.is-on { border-color: var(--gold); background: #2b3040; }
.cah-decks .gametile b { display: block; font-size: 0.95rem; }
.cah-decks .gametile span span { color: var(--dim); font-size: 0.8rem; line-height: 1.35; }
.cah-decks .g-tick {
    width: 1.5rem; height: 1.5rem; border-radius: 6px; border: 1px solid var(--line);
    display: grid; place-items: center; color: transparent; font-weight: 700;
}
.cah-decks .gametile.is-on .g-tick { background: var(--gold); border-color: var(--gold); color: #15181f; }
.mk-select {
    font: inherit; font-size: max(16px, 0.9rem); color: var(--ink);
    background: var(--card-2, #262b36); border: 1px solid var(--line, #38404f);
    border-radius: 999px; padding: 0.35rem 0.75rem; min-height: 38px;
}
