/**
 * Tambola public live display — mobile layout (viewport ≤900px or mobile User-Agent).
 * Order: Header → Last number + Prizes (one row) → Drawn numbers / Draw history tabs → About drawer
 */
.public-page .board-view-tabs,
.public-page .board-history-view,
.public-page .public-credit-card {
  display: none;
}

html.game-mobile-active .public-page {
    overflow: hidden;
  }

  html.game-mobile-active .public-page .game-window {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 40%);
    grid-template-rows: auto auto minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "latest prizes"
      "board board";
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    padding: max(8px, env(safe-area-inset-top)) 10px max(56px, calc(52px + env(safe-area-inset-bottom))) 10px;
    overflow: hidden;
    gap: 8px;
  }

  html.game-mobile-active .public-page .projector-layout,
  html.game-mobile-active .public-page .draw-column {
    display: contents;
  }

  html.game-mobile-active .public-page .game-window > .app-header {
    grid-area: header;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "kicker kicker kicker"
      "logo title tools";
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    margin: 0;
    min-height: 0;
    padding: 8px 10px;
    border-radius: 14px;
  }

  html.game-mobile-active .public-page .app-brand {
    display: contents;
  }

  html.game-mobile-active .public-page .app-brand-copy {
    display: contents;
  }

  html.game-mobile-active .public-page .app-brand-logo {
    grid-area: logo;
    width: 44px;
    height: 34px;
  }

  html.game-mobile-active .public-page .app-brand-kicker {
    grid-area: kicker;
    width: 100%;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.58rem, 3.2vw, 0.82rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
  }

  html.game-mobile-active .public-page .app-brand-title {
    grid-area: title;
    font-size: 0.95rem;
    white-space: nowrap;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    -webkit-line-clamp: unset;
  }

  html.game-mobile-active .public-page .app-header-tools {
    grid-area: tools;
    position: static;
    top: auto;
    right: auto;
    width: auto;
  }

  html.game-mobile-active .public-page .live-status {
    font-size: 0.62rem;
    padding: 5px 8px;
    letter-spacing: 0.08em;
  }

  html.game-mobile-active .public-page .live-status > span:first-child {
    width: 8px;
    height: 8px;
  }

  html.game-mobile-active .public-page .next-update {
    display: none;
  }

  /* Last drawn number — remaining width (~60%) of row 2 */
  html.game-mobile-active .public-page .draw-panel.public-latest-panel {
    grid-area: latest;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  html.game-mobile-active .public-page .public-latest-panel .projector-number {
    height: 100%;
    min-height: 148px;
    max-height: 34dvh;
    padding: 8px 10px;
    border-radius: 14px;
  }

  html.game-mobile-active .public-page .public-latest-panel .projector-number span {
    font-size: 0.92rem;
    letter-spacing: 0.1em;
    font-weight: 900;
    line-height: 1.15;
  }

  html.game-mobile-active .public-page .public-latest-panel .projector-number strong {
    font-size: clamp(5.25rem, 33vw, 9.75rem) !important;
    line-height: 0.82;
  }

  html.game-mobile-active .public-page .public-latest-panel .projector-number strong.is-awaiting-first {
    font-size: clamp(1.1rem, 5.5vw, 1.65rem) !important;
    line-height: 1.15;
    letter-spacing: 0.02em;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 800;
    padding: 0 0.35rem;
    white-space: normal;
  }

  /* Prizes — 40% of screen width on row 2 */
  html.game-mobile-active .public-page .claim-panel {
    grid-area: prizes;
    width: 100%;
    min-width: 0;
    max-height: 34dvh;
    margin: 0;
    padding: 6px 8px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  html.game-mobile-active .public-page .claim-panel h2 {
    font-size: 0.78rem;
    margin: 0 0 4px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
  }

  html.game-mobile-active .public-page .prize-controls {
    display: grid;
    grid-template-rows: repeat(var(--prize-count, 7), minmax(0, 1fr));
    gap: 3px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  html.game-mobile-active .public-page .prize-control {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    max-height: none;
    border-radius: 10px;
    padding: 2px 6px;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 0;
    align-self: stretch;
    font-weight: 900;
    white-space: nowrap;
    background: radial-gradient(circle at 32% 26%, #fffdf5, #ece0c4 55%, #ddcda0 100%);
    border: 1px solid #d8c79c;
    color: #87764c;
    box-shadow: inset 0 -3px 5px #00000014, inset 0 1px 0 #ffffffb0;
  }

  html.game-mobile-active .public-page .prize-control.announced {
    background: radial-gradient(circle at 32% 24%, #d75c6d, var(--maroon) 55%, var(--maroon-deep) 100%);
    border-color: var(--maroon-deep);
    color: #fff;
    box-shadow: 0 5px 12px -3px #5c162470, inset 0 -3px 6px #00000030, inset 0 2px 3px #ffffff45;
  }

  html.game-mobile-active .public-page .prize-control .prize-label {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    text-align: center;
    white-space: nowrap;
    font-weight: 900;
    font-size: clamp(12px, 3.8vw, 16px);
    line-height: 1.1;
    letter-spacing: 0.01em;
    text-transform: none;
    opacity: 1;
  }

  /* Drawn numbers — main area */
  html.game-mobile-active .public-page .board-panel {
    grid-area: board;
    grid-column: 1 / -1;
    min-height: 0;
    margin: 0;
    padding: 8px 10px 10px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  html.game-mobile-active .public-page .board-panel .board-head {
    margin-bottom: 6px;
    flex: 0 0 auto;
    width: 100%;
  }

  html.game-mobile-active .public-page .board-head-desktop {
    display: none;
  }

  html.game-mobile-active .public-page .board-view-tabs {
    display: flex;
    width: 100%;
    gap: 3px;
    padding: 3px;
    border-radius: 999px;
    background: #efe6d0;
    border: 1px solid var(--line);
  }

  html.game-mobile-active .public-page .board-view-tab {
    flex: 1;
    margin: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 7px 8px;
    border-radius: 999px;
    color: var(--muted);
    cursor: pointer;
    pointer-events: auto;
  }

  html.game-mobile-active .public-page .board-view-tab.is-active {
    background: linear-gradient(155deg, var(--ink-2), var(--ink));
    color: var(--gold-light);
  }

  html.game-mobile-active .public-page .board-panel .number-board {
    container-type: size;
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-rows: repeat(9, minmax(0, 1fr));
    gap: var(--board-gap, 3px);
    justify-items: center;
    align-items: center;
    align-content: stretch;
    justify-content: stretch;
  }

  html.game-mobile-active .public-page .board-panel .ball {
    box-sizing: border-box;
    width: var(--ball-size, min(100%, 11.11cqb));
    height: var(--ball-size, min(100%, 10cqi));
    max-width: 100%;
    max-height: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 1;
    justify-self: center;
    align-self: center;
    font-size: var(--ball-font, min(5.8cqi, 8.6cqb, 1.15rem));
    line-height: 1;
    letter-spacing: -0.06em;
    padding: 0;
    overflow: hidden;
    border-radius: 50%;
  }

  html.game-mobile-active .public-page .board-panel.is-history .number-board {
    display: none;
  }

  html.game-mobile-active .public-page .board-history-view {
    display: none;
  }

  html.game-mobile-active .public-page .board-panel.is-history .board-history-view {
    display: grid;
    flex: 1;
    min-height: 0;
    height: 100%;
    max-height: none;
    overflow: hidden;
    container-type: size;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    grid-template-rows: repeat(9, minmax(0, 1fr));
    gap: var(--board-gap, 3px);
    justify-items: center;
    align-items: center;
    align-content: stretch;
    justify-content: stretch;
    padding: 0;
  }

  html.game-mobile-active .public-page .board-panel.is-history .board-history-view:has(.sequence-empty) {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  /* About / credits — bottom drawer, swipe up */
  html.game-mobile-active .public-page .public-history-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    width: 100%;
    max-height: min(72dvh, 520px);
    margin: 0;
    padding: 0;
    border-radius: 18px 18px 0 0;
    border: 1px solid var(--line);
    border-bottom: none;
    box-shadow: 0 -12px 40px -8px rgba(14, 38, 30, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(calc(100% - 52px - env(safe-area-inset-bottom)));
    transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    touch-action: none;
  }

  html.game-mobile-active .public-page .public-history-panel.is-open {
    transform: translateY(0);
    z-index: 210;
  }

  html.game-mobile-active .public-page .public-history-panel.is-dragging {
    transition: none;
  }

  html.game-mobile-active .public-page .sequence-head-desktop {
    display: none;
  }

  html.game-mobile-active .public-page .history-drawer-handle {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 100%;
    padding: 10px 16px 8px;
    border: 0;
    background: linear-gradient(160deg, var(--paper), #fbf4e4);
    cursor: pointer;
    font: inherit;
    color: inherit;
  }

  html.game-mobile-active .public-page .handle-bar {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: #c8b896;
  }

  html.game-mobile-active .public-page .history-handle-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
  }

  html.game-mobile-active .public-page .history-handle-label .eyebrow {
    font-size: 0.68rem;
    margin: 0;
  }

  html.game-mobile-active .public-page .history-hint {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--muted);
  }

  html.game-mobile-active .public-page .public-history-panel.is-open .history-hint::after {
    content: " · swipe down to close";
  }

  html.game-mobile-active .public-page .history-drawer-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 16px max(16px, env(safe-area-inset-bottom));
    touch-action: pan-y;
  }

  html.game-mobile-active .public-page .public-history-panel .sequence-list,
  html.game-mobile-active .public-page .sequence-head-desktop {
    display: none;
  }

  html.game-mobile-active .public-page .public-credit-card {
    display: block;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    padding: 4px 4px 12px;
    color: var(--ink);
  }

  html.game-mobile-active .public-page .public-credit-card .eyebrow {
    margin: 0 0 8px;
  }

  html.game-mobile-active .public-page .public-credit-card h2 {
    margin: 0 0 10px;
    font-size: 1.45rem;
    line-height: 1.15;
    font-family: 'Playfair Display', Georgia, serif;
  }

  html.game-mobile-active .public-page .public-credit-card p {
    margin: 0 0 10px;
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--ink);
  }

  html.game-mobile-active .public-page .public-credit-card .credit-maker {
    margin-top: 14px;
    margin-bottom: 4px;
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--maroon);
  }

  html.game-mobile-active .public-page .public-credit-card .credit-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 0.88rem;
    font-weight: 800;
  }

  html.game-mobile-active .public-page .public-credit-card .credit-links a {
    color: var(--gold-deep);
    text-decoration: none;
    pointer-events: auto;
  }

  html.game-mobile-active .public-page .public-credit-card .credit-links a:hover,
  html.game-mobile-active .public-page .public-credit-card .credit-links a:focus-visible {
    text-decoration: underline;
  }

  html.game-mobile-active .public-page .site-credit-badge {
    z-index: 160;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    font-size: 0.72rem;
    padding: 5px 10px;
  }

  html.game-mobile-active .public-page:has(.public-history-panel.is-open) .site-credit-badge {
    visibility: hidden;
  }

  html.game-mobile-active .public-page .number-reveal-card strong {
    font-size: clamp(6rem, 40vw, 14rem);
  }

@media (max-height: 640px) {
  html.game-mobile-active .public-page .public-latest-panel .projector-number {
    min-height: 128px;
    max-height: 32dvh;
  }

  html.game-mobile-active .public-page .claim-panel {
    max-height: 28dvh;
  }
}

@media (max-width: 380px) {
  html.game-mobile-active .public-page .game-window {
    padding-inline: 6px;
  }

  html.game-mobile-active .public-page .board-panel .number-board {
    gap: 2px;
  }
}
