/**
 * Offline organizer — mobile layout (viewport ≤900px or mobile User-Agent).
 * Mirrors public live display: Header → Last number + Prizes → Board tabs → Draw drawer
 */
.offline-page .board-view-tabs,
.offline-page .board-history-view,
.offline-page .history-drawer-handle {
  display: none;
}

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

html.game-mobile-active .offline-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 .offline-page .projector-layout,
html.game-mobile-active .offline-page .draw-column,
html.game-mobile-active .offline-page .offline-board-panel {
  display: contents;
}

html.game-mobile-active .offline-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 .offline-page .app-brand {
  display: contents;
}

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

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

html.game-mobile-active .offline-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 .offline-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;
}

html.game-mobile-active .offline-page .app-header-tools {
  grid-area: tools;
  position: static;
  top: auto;
  right: auto;
  width: auto;
  justify-content: flex-end;
  gap: 6px;
}

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

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

html.game-mobile-active .offline-page .menu-toggle-button {
  width: 38px;
  height: 38px;
  padding: 7px;
}

html.game-mobile-active .offline-page .offline-latest-panel {
  grid-area: latest;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

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

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

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

html.game-mobile-active .offline-page .offline-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 .offline-page .offline-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 .offline-page .offline-claim-panel .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 .offline-page .prize-control {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  border-radius: 10px;
  padding: 2px 6px;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  align-self: stretch;
  font-weight: 900;
  white-space: nowrap;
}

html.game-mobile-active .offline-page .prize-control .prize-label {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  white-space: nowrap;
  font-weight: 900;
  line-height: 1.1;
  text-transform: none;
  opacity: 1;
}

html.game-mobile-active .offline-page .offline-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 .offline-page .offline-board-panel .board-head {
  margin-bottom: 6px;
  flex: 0 0 auto;
  width: 100%;
}

html.game-mobile-active .offline-page .offline-board-panel .board-head-draw {
  display: none;
}

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

html.game-mobile-active .offline-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 .offline-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;
}

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

html.game-mobile-active .offline-page .offline-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;
}

html.game-mobile-active .offline-page .offline-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;
  font-size: var(--ball-font, min(5.8cqi, 8.6cqb, 1.15rem));
  line-height: 1;
  padding: 0;
  border-radius: 50%;
}

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

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

html.game-mobile-active .offline-page .offline-board-panel.is-history .board-history-view {
  display: grid;
  flex: 1;
  min-height: 0;
  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;
  padding: 0;
}

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

html.game-mobile-active .offline-page .offline-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 .offline-page .offline-history-panel.is-open {
  transform: translateY(0);
  z-index: 210;
}

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

html.game-mobile-active .offline-page .history-drawer-handle {
  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 .offline-page .handle-bar {
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #c8b896;
}

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

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

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

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

html.game-mobile-active .offline-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 .offline-page .sequence-head-desktop,
html.game-mobile-active .offline-page .offline-history-panel .sequence-list {
  display: none;
}

html.game-mobile-active .offline-page .offline-drawer-tools-slot .offline-draw-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 8px;
}

html.game-mobile-active .offline-page .offline-draw-tools .draw-number-form {
  flex-direction: column;
  gap: 8px;
}

html.game-mobile-active .offline-page .offline-draw-tools .draw-number-form input {
  width: 100%;
  min-height: 48px;
  font-size: clamp(1.4rem, 7vw, 2rem);
}

html.game-mobile-active .offline-page .offline-draw-tools .draw-number-form button,
html.game-mobile-active .offline-page .offline-draw-tools .random-draw-button {
  width: 100%;
  min-height: 44px;
  font-size: 0.85rem;
  white-space: normal;
  line-height: 1.15;
}

html.game-mobile-active .offline-page .offline-draw-tools .random-draw-button[hidden] {
  display: none;
}

html.game-mobile-active .offline-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 .offline-page:has(.offline-history-panel.is-open) .site-credit-badge {
  visibility: hidden;
}

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

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

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

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