@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../assets/fonts/heebo-hebrew-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

@font-face {
  font-family: 'Heebo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../assets/fonts/heebo-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Assistant';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../assets/fonts/assistant-hebrew-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}

@font-face {
  font-family: 'Assistant';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('../assets/fonts/assistant-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Design tokens. Surfaces are a four-step ramp rather than the two the game
   started with, so a control sitting on a panel sitting on the board reads as
   three separate things without needing three separate border colours. */
:root {
  -webkit-locale: "und";
  --font-ui: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Arial Rounded MT Bold', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --font-technical: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Cascadia Mono', Menlo, Consolas, monospace;
  --board-bg: #071225;
  --surface-1: #0c1a32;
  --surface-2: #112442;
  --surface-3: #183154;
  --surface-hover: #20416c;

  /* Panels over the board are translucent; the board's grid showing faintly
     through is what keeps them feeling attached to it. */
  --panel-bg: rgba(12, 26, 50, 0.94);
  --panel-bg-raised: #183154;
  --line: #1d395f;
  --line-soft: rgba(133, 176, 255, 0.1);
  --line-strong: #315888;

  --text: #f5f7ff;
  --text-muted: #a8bbd8;
  --text-faint: #7188aa;

  --accent: #31d7f4;
  --accent-ink: #041521;
  --accent-dim: #176c85;
  --accent-soft: rgba(49, 215, 244, 0.14);
  --accent-line: rgba(49, 215, 244, 0.42);

  --play-blue: #5b72ff;
  --play-blue-soft: rgba(91, 114, 255, 0.18);
  --play-pink: #ff4f8b;
  --play-pink-soft: rgba(255, 79, 139, 0.16);

  /* The world outside the circuit has its own colour, so a switch that changes
     the weather is never mistaken for one that changes the board. Everything on
     the ring that opens off the World button wears it: the disc that opens it,
     the circles, their names and the reading under each knob. */
  --world: #7ee787;
  --world-ink: #05220b;
  --world-line: rgba(126, 231, 135, 0.5);
  --world-soft: rgba(126, 231, 135, 0.16);

  --warm: #ffdc4d;
  --warm-soft: rgba(255, 220, 77, 0.15);
  --danger: #ff5e7e;
  --danger-soft: rgba(255, 94, 126, 0.15);
  --danger-line: rgba(255, 94, 126, 0.48);

  --radius-lg: 24px;
  --radius: 17px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --pill: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 6px 18px -6px rgba(0, 0, 0, 0.55);
  --shadow-3: 0 24px 60px -18px rgba(0, 0, 0, 0.75);

  --ease: cubic-bezier(0.32, 0.72, 0.28, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* The language switch is fixed to the top-right corner of the viewport, so it
     is not in any screen's layout and nothing can flow around it. These say how
     much of that corner it takes; any header with something of its own up there
     keeps `--corner-lane` clear on its right. */
  --corner-w: 42px;
  --corner-h: 34px;
  --corner-inset: 10px;
  --corner-lane: calc(var(--corner-w) + var(--corner-inset) + 8px);
}

:root[data-lang='he'] {
  -webkit-locale: "he";
  --font-ui: 'Heebo', 'Assistant', system-ui, sans-serif;
  --font-display: 'Heebo', 'Assistant', system-ui, sans-serif;
  --font-technical: 'Heebo', 'Assistant', system-ui, sans-serif;
}

:root[data-lang='ar'] {
  -webkit-locale: "ar";
  --font-ui: 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-display: 'Segoe UI', Tahoma, Arial, sans-serif;
  --font-technical: 'Segoe UI', Tahoma, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--board-bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button,
select,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  color: inherit;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
  opacity: 0.42;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

#app {
  position: fixed;
  inset: 0;
  /* A phone browser draws its own bar over the bottom of the viewport that
     `inset: 0` measures against, and this page cannot scroll — so the last
     thing in the layout ends up behind that bar with no way to reach it. It
     was the dial's own button that disappeared. `dvh` is the height actually
     on screen; the `inset` above is the fallback where it is not understood. */
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Immediate app-shell paint while catalogs and the optional account service
   settle. The first frame is deliberately wordless — the name arrives with the
   catalogs, so it cannot flash the wrong language — and the game's own mark,
   a chip with its legs out, carries the screen until it does. */
.boot-shell {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(49, 215, 244, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(49, 215, 244, 0.025) 1px, transparent 1px),
    var(--board-bg);
  background-size: 32px 32px;
}

.boot-chip {
  position: relative;
  width: 72px;
  height: 44px;
  border: 1px solid var(--accent-line);
  border-radius: 6px;
  box-shadow: 5px 5px 0 rgba(255, 79, 139, 0.22);
}

.boot-chip i {
  position: absolute;
  top: 12px;
  width: 12px;
  height: 3px;
  background: #9b643c;
  box-shadow: 0 16px 0 #9b643c;
}

/* The name, once there is a language to say it in. Set the way silkscreen is:
   small, spaced out, and quiet enough that a fast boot showing nothing here
   looks like the same screen rather than a different one. */
.boot-name {
  position: absolute;
  top: calc(50% + 52px);
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-technical);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .34em;
  text-indent: .34em;
  color: var(--accent);
  opacity: .75;
}

.boot-chip i:nth-child(1) { left: -12px; }
.boot-chip i:nth-child(2) { right: -12px; }
.boot-chip i:nth-child(3) { left: -12px; transform: translateY(8px); }
.boot-chip i:nth-child(4) { right: -12px; transform: translateY(8px); }

.boot-trace {
  position: absolute;
  width: 150px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: boot-current 1.1s ease-in-out infinite;
}

@keyframes boot-current {
  0%, 100% { opacity: 0.2; transform: translateX(-24px); }
  50% { opacity: 0.95; transform: translateX(24px); }
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

/* Numbers that change in place — counts, sensor readouts — shouldn't shuffle
   the things next to them as they tick. */
.tnum {
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* The document never becomes RTL. Only leaf nodes containing translated text
   receive directionality, which keeps every layout coordinate invariant — the
   canvas, the wire router and the dial all measure from the left, and there is
   no left to measure from in a document that flips. What does turn round in
   Hebrew is the chrome, one row at a time: see the block at the end of
   layout.css. */
[data-i18n] {
  unicode-bidi: isolate;
}

:root:is([data-lang='he'], [data-lang='ar']) [data-i18n] {
  direction: rtl;
  text-align: right;
}

[data-i18n-align='center'],
:root:is([data-lang='he'], [data-lang='ar']) [data-i18n-align='center'] {
  text-align: center;
}

[data-i18n-align='left'],
:root:is([data-lang='he'], [data-lang='ar']) [data-i18n-align='left'] {
  text-align: left;
}

.language-switch {
  position: fixed;
  z-index: 30;
  top: calc(var(--corner-inset) + var(--safe-top));
  right: calc(var(--corner-inset) + var(--safe-right));
  width: var(--corner-w);
  height: var(--corner-h);
}
.language-trigger {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel-bg-raised);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow-2);
}
.language-options {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  display: none;
  min-width: 138px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(10, 16, 28, .97);
  box-shadow: var(--shadow-3);
}
.language-switch.is-open .language-options { display: grid; gap: 2px; }
.language-options button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-muted);
  text-align: start;
}
.language-options button:hover,
.language-options button.is-current { color: var(--accent); background: var(--accent-soft); }
.language-options button.is-current::after { content: '•'; float: right; }
.language-switch.is-hosted .language-trigger { display: none; }
.language-switch.is-hosted .language-options {
  position: static;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.ui-icon {
  width: 1.2em;
  height: 1.2em;
  display: block;
  flex: none;
}

/* Scrollbars: visible enough to say "there is more this way" on a desktop,
   invisible enough not to draw a line down the middle of a panel. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--pill);
}
*::-webkit-scrollbar-track {
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
