/* Insane Pour, web and Reddit editions. The board is the app's own guest view (src/host/render.ts draws it with
   React Native's layout defaults, below); this sheet styles only the bar, the mode tabs and the sheets around it,
   in the Crux palette and type (src/design/tokens.ts, typography.ts). */
@font-face {
  font-family: Grotesk;
  src: url('fonts/SpaceGrotesk-Regular.ttf');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Grotesk;
  src: url('fonts/SpaceGrotesk-Bold.ttf');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Fraunces;
  src: url('fonts/Fraunces-Regular.ttf');
  font-weight: 400;
  font-display: swap;
}
:root {
  color-scheme: light dark;
  --bg: #faf8f5;
  --board: #faf8f5;
  --surface: #f0eeea;
  --ink: #161616;
  --muted: #5c5c5c;
  --line: #d8d4cd;
  --gold: #e0a92e;
  --gold-ink: #171310;
  --correct: #327028;
  --amber: #8a5212;
  --red: #c7002a;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: Grotesk, system-ui, sans-serif;
  color: var(--ink);
  background: var(--board);
  font-synthesis: none;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0d0d0d;
    --board: #0d0d0d;
    --surface: #161616;
    --ink: #ffffff;
    --muted: #9a9a9a;
    --line: #2a2a2a;
    --correct: #6faf5e;
    --amber: #e0a92e;
    --red: #ff4d5e;
  }
}
:root[data-theme='dark'] {
  --bg: #0d0d0d;
  --board: #0d0d0d;
  --surface: #161616;
  --ink: #ffffff;
  --muted: #9a9a9a;
  --line: #2a2a2a;
  --correct: #6faf5e;
  --amber: #e0a92e;
  --red: #ff4d5e;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--board);
  overscroll-behavior: none;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: default;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}
h1,
h2,
p {
  margin: 0;
}
#app {
  height: 100dvh;
  min-height: 460px;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.loading {
  margin: auto;
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}
.wordmark {
  font-size: 13px;
  letter-spacing: 5px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

/* One bar: Crux and the name, Daily / Endless, sound, help. */
.bar {
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 14px;
}
.brand {
  display: grid;
  line-height: 1;
  gap: 3px;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  min-width: 0;
}
.brand .wordmark {
  font-size: 9px;
  letter-spacing: 3.5px;
}
.brand .title {
  font-family: Fraunces, Georgia, serif;
  font-weight: 400;
  font-size: 20px;
  letter-spacing: -0.4px;
  white-space: nowrap;
}
.icon {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--ink);
}
.icon:active,
.mode:active {
  transform: scale(0.96);
}
.modes {
  flex-shrink: 0;
  display: flex;
  padding: 3px;
  gap: 2px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.mode {
  min-height: 36px;
  min-width: 64px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 4px 10px;
  transition:
    background 180ms var(--ease),
    color 180ms var(--ease),
    transform 120ms var(--ease);
}
.mode b {
  font-size: 14px;
}
.mode-sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.mode-sub:empty {
  display: none;
}
.mode.on {
  background: var(--ink);
  color: var(--bg);
}
.mode.on .mode-sub {
  color: inherit;
  opacity: 0.75;
}
@media (max-width: 359px) {
  .brand .wordmark {
    display: none;
  }
  .brand .title {
    font-size: 17px;
  }
  .mode {
    min-width: 0;
    padding: 4px 8px;
  }
}
.notice {
  margin: 4px 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}
.notice[hidden] {
  display: none;
}

/* The guest's board fills the rest. */
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.guest {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* The guest view's own primitives, with React Native's defaults (game-maker gen/frame.mjs). */
.gv {
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
  flex-shrink: 0;
  min-width: 0;
  min-height: 0;
  align-items: stretch;
  border-style: solid;
  border-width: 0;
  border-color: transparent;
}
.gt {
  display: block;
  box-sizing: border-box;
  flex-shrink: 0;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: #000;
  font-size: 14px;
  font-family:
    system-ui, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;
}
.gsvg {
  display: block;
  overflow: visible;
  flex-shrink: 0;
}
.gv[role='button'] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.gv[role='button']:focus-visible {
  box-shadow: 0 0 0 3px var(--amber);
  border-radius: 12px;
}
.gv[aria-disabled='true'] {
  cursor: default;
}

/* Sheets: the result and how to play. */
.sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: min(100%, 520px);
  max-height: 92dvh;
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 -8px 40px rgb(0 0 0 / 0.18);
}
.sheet::backdrop {
  background: rgb(0 0 0 / 0.42);
}
@media (min-width: 640px) and (min-height: 640px) {
  .sheet {
    margin: auto;
    border-radius: 24px;
  }
}
.sheet-body {
  position: relative;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  overflow: auto;
  max-height: 92dvh;
}
.sheet-close {
  position: absolute;
  top: 10px;
  right: 10px;
}
.results,
.help {
  display: grid;
  gap: 14px;
  justify-items: center;
  text-align: center;
}
.results h2,
.help h2 {
  font-family: Fraunces, Georgia, serif;
  font-weight: 400;
  font-size: 34px;
  letter-spacing: -0.8px;
  line-height: 1.1;
}
.sheet h2:focus {
  outline: none;
}
.results h2.won {
  color: var(--correct);
}
.results .sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: -8px;
}
.sil {
  display: grid;
  grid-template-columns: repeat(var(--cols), 18px);
  gap: 4px;
  padding: 4px;
}
.sil i {
  width: 18px;
  height: 18px;
  border-radius: 5px;
}
.sil i.on {
  background: linear-gradient(180deg, #7aa7f0, #4a78d6);
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.12);
}
.nums,
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
  gap: 8px;
}
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.num,
.stat {
  display: grid;
  gap: 2px;
  padding: 10px 4px;
  border-radius: 14px;
  background: var(--surface);
}
.num b {
  font-size: 28px;
  line-height: 1.1;
}
.stat b {
  font-size: 20px;
}
.num span,
.stat span {
  font-size: 12px;
  color: var(--muted);
}
.line {
  font-size: 15px;
}
.status {
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
}
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.primary,
.secondary {
  min-height: 48px;
  border-radius: 14px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 16px;
  transition: transform 120ms var(--ease);
}
.primary {
  border: 0;
  background: var(--gold);
  color: var(--gold-ink);
}
.secondary {
  border: 1px solid var(--line);
  background: transparent;
}
.primary:not(:disabled):active,
.secondary:not(:disabled):active {
  transform: scale(0.97);
}
.primary:disabled {
  opacity: 0.55;
}
.copy {
  width: 100%;
  font:
    13px / 1.4 ui-monospace,
    Menlo,
    monospace;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  resize: none;
}
.ranks {
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rank;
  display: grid;
  gap: 4px;
  text-align: left;
}
.ranks li {
  counter-increment: rank;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
}
.ranks li::before {
  content: counter(rank);
  font-weight: 700;
  width: 1.5em;
}
.ranks li.me {
  outline: 2px solid var(--gold);
}
.ranks .who {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranks .pours {
  color: var(--muted);
}
.ranks[hidden] {
  display: none;
}
.app-promo {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.app-promo p {
  font-size: 13px;
  line-height: 1.35;
}
.app-promo-link {
  flex: none;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: transform 120ms var(--ease);
}
.app-promo-link:active {
  transform: scale(0.97);
}
.help {
  text-align: left;
  justify-items: start;
}
.help p {
  font-size: 15px;
  line-height: 1.45;
}
.toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 15px;
  min-height: 44px;
}
.toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--correct);
}
.credit a {
  color: var(--muted);
  font-size: 13px;
}

/* Reddit's feed card. */
.feed {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px 14px;
}
.feed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.edition {
  font-size: 11px;
  letter-spacing: 1.3px;
  color: var(--muted);
  text-transform: uppercase;
}
.feed-title {
  font-family: Fraunces, Georgia, serif;
  font-weight: 400;
  font-size: 30px;
  letter-spacing: -0.8px;
}
.feed-sub,
.feed-mine,
.feed-board-line {
  font-size: 14px;
  color: var(--muted);
}
.feed-mine {
  color: var(--correct);
  font-weight: 700;
}
.feed-board {
  flex: 1;
  min-height: 120px;
  pointer-events: none;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}
.feed-still {
  position: absolute;
  inset: 0 0 auto;
  height: calc(100% + 60px);
}
.feed > .primary {
  width: 100%;
}
@media (prefers-reduced-motion: reduce) {
  .mode,
  .primary,
  .secondary,
  .app-promo-link {
    transition: none;
  }
}
