:root {
  color: #171714;
  background: #e7dfc8;
  font-family: "Courier New", Courier, monospace;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html,
body { overflow-x: clip; }
body { margin: 0; min-width: 320px; min-height: 100vh; min-height: 100dvh; background: #e7dfc8; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.play-mode-nav { position: fixed; z-index: 1000; top: 14px; right: 14px; display: flex; border: 3px solid #171714; background: #f7f0db; box-shadow: 4px 4px 0 #171714; }
.play-mode-nav a { padding: 8px 12px; color: #171714; font-size: 10px; font-weight: 900; letter-spacing: .12em; text-decoration: none; text-transform: uppercase; }
.play-mode-nav a + a { border-left: 3px solid #171714; }
.play-mode-nav a.active { background: #f7d91e; }
html[data-runtime="desktop"] .web-only { display: none; }

.online-landing {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
}

.online-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3rem, 8vw, 9rem);
  background: #171714;
  color: #f7f0db;
}

.online-kicker { letter-spacing: .18em; font-size: .72rem; font-weight: 800; }
.online-intro h1 { margin: 1rem 0; font-family: Impact, sans-serif; font-size: clamp(4rem, 10vw, 9rem); line-height: .78; letter-spacing: -.03em; }
.online-intro h1 span, .online-logo span { color: #e42b25; }
.online-intro h1 i { color: #f7d91e; font: inherit; font-style: normal; letter-spacing: .08em; }
.online-intro > p:not(.online-kicker) { max-width: 35rem; font-size: 1.1rem; line-height: 1.55; }
.online-intro a { color: #f7d91e; font-weight: 800; margin-top: 2rem; }

.online-entry {
  align-self: center;
  display: grid;
  gap: 1rem;
  padding: clamp(2rem, 7vw, 7rem);
}

.online-entry label { display: grid; gap: .45rem; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.online-entry input { width: 100%; border: 3px solid #171714; background: #f7f0db; padding: 1rem; font-size: 1rem; box-shadow: 5px 5px 0 #171714; }
.online-entry button, .invite-actions button, .game-actions button, .start-game { border: 3px solid #171714; background: #f7f0db; color: #171714; padding: 1rem 1.25rem; font-weight: 900; text-transform: uppercase; box-shadow: 5px 5px 0 #171714; }
.online-entry button.primary, .invite-actions button.primary, .game-actions button.primary, .start-game.primary { background: #f7d91e; }
.online-entry button:active, .invite-actions button:active, .game-actions button:active, .start-game:active { box-shadow: none; transform: translate(4px, 4px); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #e42b25; outline-offset: 3px; }
.or { margin: .75rem 0; border-top: 2px solid #171714; text-align: center; }
.or span { position: relative; top: -.65rem; background: #e7dfc8; padding: 0 1rem; font-size: .72rem; text-transform: uppercase; }
.invite-ticket { display: flex; align-items: center; justify-content: space-between; gap: 1rem; border: 3px dashed #171714; padding: .75rem 1rem; background: #f7d91e; transform: rotate(-1deg); }
.invite-ticket span { font-size: .66rem; font-weight: 900; letter-spacing: .12em; }
.invite-ticket strong { color: #e42b25; font-family: Impact, sans-serif; font-size: 1.75rem; letter-spacing: .12em; }

.online-shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1rem 0 4rem; }
.online-header { min-height: 74px; display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid #171714; }
.online-header > div { text-align: right; }
.online-header small, .online-header b { display: block; }
.online-header small { letter-spacing: .14em; text-transform: uppercase; }
.online-logo { color: #171714; font-family: Impact, sans-serif; font-size: 2rem; text-decoration: none; letter-spacing: -.03em; }

.lobby-card { width: min(650px, 100%); margin: clamp(3rem, 9vh, 7rem) auto; border: 3px solid #171714; background: #f7f0db; padding: clamp(1.5rem, 4vw, 3rem); box-shadow: 12px 12px 0 #171714; }
.room-code { border: 0; background: transparent; padding: 0; font-family: Impact, sans-serif; font-size: clamp(4rem, 14vw, 8rem); letter-spacing: .08em; line-height: 1; color: #e42b25; }
.invite-caption { max-width: 34rem; margin: .6rem 0 1.25rem; line-height: 1.5; }
.invite-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: .8rem; }
.invite-actions button { min-width: 0; }
.invite-actions button span { display: inline-block; margin-right: .25rem; font-size: 1.1em; }
.invite-url { overflow: hidden; margin: 1rem 0 0; padding: .65rem .8rem; border: 1px dashed #706c60; color: #706c60; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.invite-url span { margin-right: .75rem; color: #171714; font-weight: 900; letter-spacing: .1em; }
.lobby-capacity { margin: 1.5rem 0 0; font-size: .78rem; }
.seat-list { display: grid; gap: .6rem; margin: 2rem 0; }
.seat { display: flex; gap: .75rem; align-items: center; min-height: 48px; border-bottom: 1px dashed #706c60; }
.seat em { font-size: .68rem; text-transform: uppercase; background: #f7d91e; padding: .2rem .4rem; }
.seat.empty { color: #8c8779; }
.connection { margin-left: auto; font-size: .68rem; text-transform: uppercase; }
.connection.online { color: #1b7651; }
.connection.offline { color: #a42a25; }
.start-game { width: 100%; }
.waiting-copy { text-align: center; }

.player-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin: 1rem 0; }
.player-chip { position: relative; border: 2px solid #171714; padding: .65rem .8rem; background: #f7f0db; }
.player-chip span, .player-chip b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-chip b { font-size: .7rem; margin-top: .25rem; }
.player-chip.current { background: #f7d91e; transform: translateY(3px); }
.player-chip.you { border-width: 3px; }
.presence { position: absolute; width: 8px; height: 8px; border-radius: 50%; right: .6rem; top: .6rem; background: #a42a25; }
.presence.online { background: #1b7651; }

.online-table { min-height: 290px; display: flex; align-items: center; justify-content: center; gap: clamp(1rem, 4vw, 3rem); border: 3px solid #171714; background: #315d46; box-shadow: inset 0 0 0 8px #274c3a; color: #f7f0db; }
.pile { width: 110px; aspect-ratio: .68; display: flex; flex-direction: column; justify-content: center; align-items: center; border: 3px solid #171714; background: #f7f0db; color: #171714; box-shadow: 6px 6px 0 #171714; }
.pile.deck { background: repeating-linear-gradient(45deg, #171714 0 7px, #f7d91e 7px 10px); color: #f7f0db; text-shadow: 2px 2px #171714; }
.pile > span { font-size: 2.4rem; font-weight: 900; }
.pile > strong { font-size: 3rem; }
.pile.red { color: #d32721; }
.active-suit-banner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: .75rem 0;
  border: var(--online-line, 3px solid #171714);
  border-radius: var(--online-radius, 0);
  padding: .7rem 1rem;
  background: var(--online-accent, #f7d91e);
  color: var(--online-accent-ink, #171714);
  box-shadow: var(--online-shadow, 5px 5px 0 #171714);
}
.active-suit-banner small { font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.active-suit-banner b { font-family: var(--online-display, Impact, sans-serif); font-size: clamp(1.5rem, 5vw, 2.4rem); letter-spacing: .04em; text-transform: uppercase; }
.active-suit-banner b span { margin-right: .5rem; font-family: Georgia, serif; }
.active-suit-banner.is-red b span { color: var(--online-danger, #d32721); }

.your-zone { border: 3px solid #171714; border-top: 0; background: #f7f0db; padding: 1.25rem; }
.hand-heading { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.hand-heading span { font-weight: 900; text-transform: uppercase; }
.online-hand { display: flex; align-items: end; overflow-x: auto; min-height: 160px; padding: 12px 6px 18px; }
.playing-card { flex: 0 0 92px; height: 138px; margin-left: -18px; border: 3px solid #171714; background: #fffdf6; box-shadow: 4px 4px 0 #171714; text-align: left; padding: .45rem; color: #171714; transition: transform .12s ease; }
.playing-card:first-child { margin-left: 0; }
.playing-card span, .playing-card strong { display: block; font-size: 1.45rem; }
.playing-card strong { font-size: 2.4rem; text-align: center; margin-top: 1rem; }
.playing-card.red { color: #d32721; }
.playing-card.selected { transform: translateY(-12px) rotate(-1deg); background: #fff6a7; }

.call-row, .game-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.call-row label { border: 2px solid #171714; padding: .6rem; }
.suit-choice { margin: 1rem 0 0; border: var(--online-thin-line, 2px solid #171714); padding: .65rem; }
.suit-choice legend { padding: 0 .45rem; font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.suit-choice.is-required { border: var(--online-line, 3px solid #171714); background: color-mix(in srgb, var(--online-accent, #f7d91e) 28%, transparent); }
.suit-choice-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.suit-choice-button { min-width: 0; min-height: 52px; display: grid; grid-template-columns: auto 1fr; place-items: center; gap: .3rem; border: var(--online-thin-line, 2px solid #171714); border-radius: var(--online-radius, 0); background: var(--online-paper, #f7f0db); color: var(--online-ink, #171714); box-shadow: none; }
.suit-choice-button b { font: 700 1.65rem/1 Georgia, serif; }
.suit-choice-button span { overflow: hidden; font-size: .7rem; font-weight: 900; text-overflow: ellipsis; text-transform: uppercase; }
.suit-choice-button.is-red b { color: var(--online-danger, #d32721); }
.suit-choice-button.is-active { background: var(--online-accent, #f7d91e); color: var(--online-accent-ink, #171714); box-shadow: var(--online-shadow, 4px 4px 0 #171714); transform: translateY(-2px); }
.turn-message { padding: 1rem; background: #e7dfc8; text-align: center; }
.game-log { list-style-position: inside; border: 3px solid #171714; border-top: 0; margin: 0; padding: 1rem 1.5rem; background: #e7dfc8; }
.game-log li { padding: .35rem 0; border-bottom: 1px dotted #706c60; }
.game-log .bad { color: #a42a25; }
.game-log .good, .game-log .shout { font-weight: 900; }
.game-over { text-align: center; }
.online-notice { border: 3px solid #171714; background: #e42b25; color: white; padding: .8rem 1rem; font-weight: 800; }
.online-notice.floating { position: fixed; right: 1rem; bottom: 1rem; max-width: min(440px, calc(100% - 2rem)); box-shadow: 5px 5px 0 #171714; }
.is-connecting button { pointer-events: none; }

@media (max-width: 720px) {
  .online-landing { grid-template-columns: 1fr; }
  .online-intro {
    min-height: 48dvh;
    justify-content: end;
    padding: calc(78px + env(safe-area-inset-top, 0px)) 1.25rem 2rem;
  }
  .online-intro h1 { font-size: clamp(4rem, 21vw, 6.6rem); }
  .online-intro > p:not(.online-kicker) { margin-bottom: 0; font-size: 1rem; }
  .online-intro a { min-height: 44px; display: inline-flex; align-items: center; margin-top: 1rem; }
  .online-entry { padding: 1.5rem 1.25rem calc(2rem + env(safe-area-inset-bottom, 0px)); }
  .online-entry input { min-height: 56px; font-size: 16px; }
  .online-entry button { min-height: 56px; }
  .online-landing.has-invite .online-intro { min-height: 36vh; }
  .online-shell { width: 100%; padding: calc(58px + env(safe-area-inset-top, 0px)) 10px calc(2rem + env(safe-area-inset-bottom, 0px)); }
  .online-header { min-height: 62px; padding-inline: 4px; }
  .online-logo { font-size: 1.65rem; }
  .lobby-card { margin: 1.25rem auto; padding: 1.25rem; box-shadow: 7px 8px 0 #171714; }
  .room-code { min-height: 64px; font-size: clamp(3.5rem, 19vw, 6rem); }
  .invite-actions { grid-template-columns: 1fr; }
  .invite-actions button,
  .start-game { min-height: 54px; }
  .invite-url { white-space: normal; overflow-wrap: anywhere; }
  .player-rail {
    display: flex;
    overflow-x: auto;
    margin: 10px -10px;
    padding: 0 10px 8px;
    scroll-padding-inline: 10px;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .player-rail::-webkit-scrollbar { display: none; }
  .player-chip { flex: 0 0 128px; scroll-snap-align: start; }
  .online-table { min-height: 220px; gap: 1.5rem; }
  .pile { width: 82px; }
  .active-suit-banner { position: sticky; z-index: 30; top: calc(8px + env(safe-area-inset-top, 0px)); min-height: 58px; }
  .active-suit-banner b { font-size: 1.45rem; }
  .your-zone { padding: 1rem 10px calc(1rem + env(safe-area-inset-bottom, 0px)); }
  .online-hand {
    margin-inline: -10px;
    padding: 14px 12px 20px;
    scroll-padding-inline: 12px;
    scroll-snap-type: x proximity;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .online-hand::-webkit-scrollbar { display: none; }
  .online-hand .playing-card { scroll-snap-align: center; }
  .suit-choice-grid { grid-template-columns: repeat(2, 1fr); }
  .suit-choice-button { min-height: 56px; }
  .suit-choice.is-required {
    position: fixed;
    z-index: 100;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    margin: 0;
    background: var(--online-paper, #f7f0db);
    box-shadow: var(--online-large-shadow, 8px 8px 0 #171714);
  }
  .playing-card { flex-basis: 76px; height: 116px; }
  .hand-heading small { display: none; }
  .call-row { display: grid; grid-template-columns: 1fr 1fr; }
  .call-row label { min-height: 48px; display: flex; align-items: center; justify-content: center; }
  .game-actions {
    position: sticky;
    z-index: 20;
    bottom: calc(4px + env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .55rem;
    border: 2px solid #171714;
    border-radius: 12px;
    padding: .55rem;
    background: #f7f0db;
    box-shadow: 0 8px 24px rgba(23, 23, 20, .28);
  }
  .game-actions button { min-width: 0; min-height: 52px; padding: .75rem .6rem; box-shadow: none; }
  .game-actions button.primary:last-child { grid-column: 1 / -1; }
  .game-log { padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); }
  .online-notice.floating { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); left: 12px; max-width: none; }
}

@media (max-width: 370px) {
  .online-intro h1 { font-size: 3.85rem; }
  .online-table { gap: 1rem; }
  .pile { width: 76px; }
}
