/*
 * Style E — Mid-Century Office. Flat colour, no outlines, Jost for anything
 * set small and DM Serif Display for anything that is a name.
 */

:root {
  --charcoal: #2A2623;
  --cream: #F8F1E4;
  --paper: #F2E7D3;
  --mustard: #E1A23A;
  --mustard-light: #F3D59A;
  --teal: #2E7A77;
  --teal-dark: #2A6E6B;
  --tomato: #D4553A;
  --tomato-dark: #B9442B;
  --olive: #8C8A3C;
  --plum: #7A4A6B;
  --walnut: #8A5A3B;
  --blush: #EAB9A3;
  --ink-soft: #4A443F;

  --sans: Jost, Futura, 'Century Gothic', 'Avenir Next', sans-serif;
  --serif: 'DM Serif Display', 'Didot', Georgia, serif;

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--charcoal);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  /* No rubber-banding, no long-press callouts, no text selection mid-drag. */
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--mustard);
  outline-offset: 2px;
}

/*
 * The frame fills the screen inside the safe areas; the stage inside it is
 * the 390×844 design, scaled and positioned by main.js.
 */
.frame {
  position: fixed;
  inset: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
}

.stage {
  position: absolute;
  top: 0;
  left: 0;
  width: 390px;
  height: 844px;
  transform-origin: 0 0;
}

.frame[data-screen="screen-start"] .stage {
  display: none;
}

/* While the board is up, a drag anywhere steers it — never scrolls or zooms. */
.frame[data-screen="screen-play"] {
  touch-action: none;
}

/*
 * The surround. On a screen wider than the board — a tablet, a laptop, a phone
 * with its toolbars showing — mid-century wallpaper fills either side, hung
 * off the stage so it scales and moves with the board, and the board's edges
 * become the room's walnut frame. The board itself stays 390 wide everywhere.
 */
.stage::before,
.stage::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2400px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Crect width='96' height='96' fill='%23EBDDC3'/%3E%3Cg fill='none' stroke='%23D9C5A3' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M24 12v24M12 24h24M15.5 15.5l17 17M15.5 32.5l17-17'/%3E%3Cpath d='M72 60v24M60 72h24M63.5 63.5l17 17M63.5 80.5l17-17'/%3E%3C/g%3E%3Ccircle cx='24' cy='24' r='3.4' fill='%23E1A23A' fill-opacity='.55'/%3E%3Ccircle cx='72' cy='72' r='3.4' fill='%232E7A77' fill-opacity='.45'/%3E%3Cpath d='M72 17l5 7-5 7-5-7zM24 65l5 7-5 7-5-7z' fill='%23DCC8A6'/%3E%3C/svg%3E") 0 0 / 96px 96px;
}

.stage::before {
  right: 100%;
  background-position: right top;
  box-shadow: inset -6px 0 0 var(--walnut), inset -22px 0 18px -14px rgba(42, 38, 35, .35);
}

.stage::after {
  left: 100%;
  background-position: left top;
  box-shadow: inset 6px 0 0 var(--walnut), inset 22px 0 18px -14px rgba(42, 38, 35, .35);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.is-active {
  display: block;
}

/* ------------------------------------------------------------ buttons --- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: none;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2.2px;
  text-transform: uppercase;
}

.btn-primary {
  background: var(--tomato-dark);
  color: var(--cream);
}

.btn-secondary {
  background: transparent;
  color: var(--charcoal);
  box-shadow: inset 0 0 0 2px var(--charcoal);
}

.btn-link {
  background: none;
  min-height: 44px;
  padding: 0 8px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .4px;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--charcoal);
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 24px;
  background: var(--charcoal);
  color: var(--cream);
}

.btn-icon .sound-on { display: none; }
.btn-icon.is-on .sound-on { display: inline; }
.btn-icon.is-on .sound-off { display: none; }

/* -------------------------------------------------------------- toast --- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: min(360px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 16px;
  transform: translate(-50%, 12px);
  border-radius: 2px;
  background: var(--charcoal);
  color: var(--cream);
  font-size: 14px;
  white-space: pre-line;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.is-showing {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
