/*
 * Silk — canvas-first chrome, liquid-glass edition.
 *
 * The drawing is the whole point: everything else is translucent glass that
 * recedes while a stroke is in progress (body.silk-active, set by the engine)
 * and for 7s after it ends (body.ui-dimmed, set by silk-ui.js). Clicking the
 * wordmark hides the chrome entirely (body.ui-hidden) — the wordmark itself
 * never dims, it is the one constant on screen.
 *
 * Layout: wordmark top-left; undo/new/colours across the top-right (the colour
 * panel grows out of that corner and covers them, closed by its own cross);
 * save/share/fullscreen bottom-right; about/language/sound bottom-left.
 *
 * Load-bearing for js/site.js — change with care:
 *   #canvii-container / #silk-1 / #silk-2 / #sparks   stacking and hit-testing
 *   .silk-canvas.active / .zeropacity / .onepacity    cross-fade between buffers
 *   .control .slider-bg   geometry is measured ONCE at DOM-ready via jQuery
 *     .position()/.width() and parseInt(css('margin-left')). Therefore:
 *       - the colour panel must stay laid out while closed (opacity/visibility,
 *         NEVER display:none — a display-swapped measure reads a bogus width);
 *       - the track keeps a FIXED px width at every viewport, and a real px
 *         margin — never auto or a percentage. Scale transforms are fine: the
 *         measure uses layout boxes, and the panel is at scale 1 whenever the
 *         slider can actually be dragged.
 *   .control .handle / .ghost-handle   positioned in px by the engine; the
 *     handle's width is read back to centre it.
 *   #selected-color-icon               engine writes the current colour into
 *     its inline `color` style — the svg fills with currentColor. silk-ui.js
 *     writes the same style when a swatch of its own is picked.
 *   #tips .tip.showing                 the engine cycles tips with .showing.
 *   MobileDetect() inline-hides `#main-controls .silk-icon` — buttons that
 *     must survive on touch carry class `icon` instead, or live elsewhere.
 */

:root {
  --ink: #f4f2f8;
  --ink-dim: rgba(244, 242, 248, 0.6);
  --ink-faint: rgba(244, 242, 248, 0.36);
  --glass: rgba(18, 18, 26, 0.3);
  --glass-strong: rgba(15, 15, 22, 0.44);
  --glass-hover: rgba(46, 46, 62, 0.4);
  --glass-edge: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 -1px 0 rgba(255, 255, 255, 0.02);
  --blur: blur(30px) saturate(1.5);
  --blur-hover: blur(30px) saturate(1.9) brightness(1.15);
  --radius: 18px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --spring: cubic-bezier(.3, 1.3, .35, 1);
  --fade: .45s var(--ease);
  /* Leaving is slow, coming back on hover is quick — see the dim rules below. */
  --fade-slow: 2.25s var(--ease);
}

* { box-sizing: border-box; }

html { background: #000; }

body {
  margin: 0;
  background: #000;
  color: var(--ink);
  font: 15px/1.5 'Inter', -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* The canvas is the interface; only real text should be selectable. */
body, .btn, .control, .tt, .label, #brand, .hotkey { -webkit-user-select: none; user-select: none; }
.about-row, .direct-link { -webkit-user-select: text; user-select: text; }

/* ===== canvas stack ===== */

#canvii-container { position: relative; left: 0; }
#silk-1, #silk-2, #sparks { position: absolute; top: 0; left: 0; }

.silk-canvas {
  z-index: 1;
  opacity: 1;
  transition: opacity .75s ease-out;
}
.silk-canvas.onepacity { opacity: 1; transition: none; }
.silk-canvas.active { z-index: 2; pointer-events: all; }
.silk-canvas.active.zeropacity { opacity: 0; transition: none; }
#sparks { z-index: 3; cursor: crosshair; }

/* ===== aurora (behind the intro) ===== */

#aurora {
  position: fixed;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.6s ease;
}
#aurora.visible { opacity: 1; }
#aurora i {
  position: absolute;
  width: 58vmax;
  height: 58vmax;
  border-radius: 50%;
  filter: blur(72px);
  mix-blend-mode: screen;
  opacity: .15;
}
#aurora .a1 { background: radial-gradient(circle, #6d5bff, transparent 62%); top: -18%; left: -12%; animation: aur-a 27s ease-in-out infinite alternate; }
#aurora .a2 { background: radial-gradient(circle, #ff5b9d, transparent 62%); bottom: -24%; right: -10%; animation: aur-b 33s ease-in-out infinite alternate; }
#aurora .a3 { background: radial-gradient(circle, #2ec8ff, transparent 62%); top: 26%; left: 38%; opacity: .1; animation: aur-a 41s ease-in-out infinite alternate-reverse; }
@keyframes aur-a { to { transform: translate(7vmax, 6vmax) scale(1.14); } }
@keyframes aur-b { to { transform: translate(-8vmax, -5vmax) scale(.9); } }

/* ===== chrome scaffolding ===== */

/* Containers never intercept the canvas themselves — only their visible,
   interactive children do. Hidden panels stay in layout (the engine measures
   them) yet can never eat a stroke. */
.controls-container {
  position: fixed;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  transition: opacity var(--fade);
}

#main-controls   { top: 18px; right: 20px; align-items: flex-end; }
#corner-actions  { bottom: 18px; right: 20px; align-items: flex-end; }
#sound-and-about { bottom: 18px; left: 20px; align-items: flex-start; }

.row { display: flex; align-items: center; justify-content: center; gap: 8px; }
/* One strip along the top edge, reading undo → new → colours. The colour panel
   opens underneath it from the same corner, so the strip stays a single row at
   every width — three 44px buttons never need to wrap. */
.dock-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  transition: opacity .3s var(--ease);
}
/* The colour panel covers the dock it opened from — don't let the buttons
   glow through the glass while it is up. */
#main-controls:has(.color-and-symmetry-row.visible) .dock-row { opacity: 0; pointer-events: none; }

/* Resting opacity is .8; hovering an element takes it to 1 (per element).
   While drawing — and for a short while after — the chrome recedes to a
   quarter, still findable but out of the way. The wordmark is exempt: it never
   dims.

   The fade is deliberately asymmetric. Receding is slow (--fade-slow), so it
   never yanks attention away from the stroke; a pointer arriving on the chrome
   brings it back at the base --fade, which is what the base rule already does.
   When the post-stroke timer runs out on its own, silk-ui.js sets
   .ui-undim-slow for the length of that transition so the chrome drifts back
   at the same pace it left. */
body.silk-active .controls-container,
body.ui-dimmed .controls-container {
  opacity: .25;
  transition: opacity var(--fade-slow);
}
body.ui-undim-slow .controls-container { transition: opacity var(--fade-slow); }

body.silk-active .controls-container,
body.silk-active .controls-container *,
body.silk-active #brand { pointer-events: none !important; }
body.mouse-down-on-slider .toggle.control { pointer-events: none !important; }
body.mouse-over-previewable-controls #sparks,
body.mouse-down-on-slider #sparks { pointer-events: none; }

/* Wordmark click hides everything but itself. */
body.ui-hidden .controls-container,
body.ui-hidden #tips,
body.ui-hidden #replay-thumbnail,
body.ui-hidden #intro-center,
body.ui-hidden #intro-draw-something,
body.ui-hidden #intro-mute-option { opacity: 0 !important; }
body.ui-hidden .controls-container,
body.ui-hidden .controls-container *,
body.ui-hidden #replay-thumbnail,
body.ui-hidden #intro-mute-option * { pointer-events: none !important; }

/* Touch devices: the chrome never auto-hides. There is no hover to bring it
   back, and a stroke comes from a finger that would otherwise dim everything —
   so every button stays visible while drawing. Only the wordmark toggle
   (body.ui-hidden) puts it away. body.touch is set by silk-ui.js. */
body.touch:not(.ui-hidden) .controls-container { opacity: 1 !important; }
body.touch:not(.ui-hidden) .btn { opacity: .82; pointer-events: auto; }
body.touch:not(.ui-hidden) .btn:active { opacity: 1; }

/* ===== glass panels =====
   Laid out even while closed — see the header note. Panels grow out of the
   corner they belong to (transform-origin set per panel below). */
.controls-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
  width: min(320px, calc(100vw - 32px));
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius);
  box-shadow: var(--glass-edge), 0 26px 60px -28px rgba(0, 0, 0, .9);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.55);
  transform-origin: center;
  transition: opacity .4s var(--ease), transform .5s var(--spring),
              background var(--fade), backdrop-filter var(--fade),
              visibility 0s .4s;
}
.controls-row.visible {
  opacity: .85;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition: opacity .4s var(--ease), transform .5s var(--spring),
              background var(--fade), backdrop-filter var(--fade),
              visibility 0s;
}
.controls-row.visible:hover {
  opacity: 1;
  background: rgba(30, 30, 42, 0.38);
  backdrop-filter: var(--blur-hover);
  -webkit-backdrop-filter: var(--blur-hover);
}

/* ===== buttons ===== */

.btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 15px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  box-shadow: var(--glass-edge), 0 12px 32px -16px rgba(0, 0, 0, .8);
  color: var(--ink-dim);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--fade), color var(--fade), background var(--fade),
              backdrop-filter var(--fade),
              transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn.visible { opacity: .8; pointer-events: auto; }
.btn.visible:hover {
  opacity: 1;
  color: var(--ink);
  background: var(--glass-hover);
  backdrop-filter: var(--blur-hover);
  -webkit-backdrop-filter: var(--blur-hover);
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 16px 36px -16px rgba(0, 0, 0, .9);
}
.btn:active { transform: scale(.94); }
.btn:focus-visible { outline: 2px solid var(--ink-dim); outline-offset: 2px; }

.btn.silk-icon, .btn.icon { width: 44px; padding: 0; }
.btn.mini { width: 36px; min-width: 36px; height: 36px; padding: 0; border-radius: 12px; }
.btn.hide { opacity: 0; pointer-events: none; }
.btn.disabled { opacity: .35; pointer-events: none; }

.btn svg { width: 17px; height: 17px; display: block; }
.btn .contents { display: grid; place-items: center; line-height: 1; }
/* Undo doubles as redo — the engine flips the icon rather than swapping it. */
.btn.flip-icon svg { transform: scaleX(-1); }

/* ===== tooltips =====
   Three orientations — above the button (default), below it (the top-right
   dock) and beside it (the wordmark). Each keeps its offsets in --tt-dx/--tt-dy
   so silk-ui.js can slide a bubble back inside the viewport without knowing
   which orientation it is in; --tt-slide is the little travel on appearance.
   The chevron subtracts the same shift, so it keeps aiming at its button. */

.tt {
  --tt-dx: 0px;
  --tt-dy: 0px;
  --tt-slide: 3px;
  --tt-bg: rgba(12, 12, 18, .82);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(calc(-50% + var(--tt-dx)), calc(var(--tt-dy) + var(--tt-slide)));
  padding: 6px 10px;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--ink);
  background: var(--tt-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 9px;
  box-shadow: var(--glass-edge);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}
/* Chevron: a border triangle, so it butts against the bubble instead of
   overlapping it — two translucent layers would show as a darker diamond. */
.tt::after {
  content: '';
  position: absolute;
  top: 100%;
  left: calc(50% - var(--tt-dx));
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-top-color: var(--tt-bg);
  transform: translateX(-50%);
}

/* The top-right dock sits under the screen edge, so its tips drop below. */
.dock-row .tt { top: calc(100% + 10px); bottom: auto; --tt-slide: -3px; }
.dock-row .tt::after {
  top: auto;
  bottom: 100%;
  border-top-color: transparent;
  border-bottom-color: var(--tt-bg);
}

.btn:hover > .tt { opacity: 1; --tt-slide: 0px; }
@media (hover: none) { .tt { display: none; } }

/* ===== wordmark (top-left) — the one thing that never dims ===== */

#brand {
  position: fixed;
  top: 20px;
  left: 24px;
  z-index: 12;
  font-size: 19px;
  font-weight: 200;
  letter-spacing: .34em;
  color: var(--ink);
  cursor: pointer;
  opacity: .9;
  transition: letter-spacing .5s var(--ease);
}
#brand:hover { letter-spacing: .42em; }
#brand:focus-visible { outline: 2px solid var(--ink-dim); outline-offset: 4px; }
/* Speech-bubble to the right of the wordmark, with a little chevron pointing
   back at it. */
#brand .tt {
  left: calc(100% + 15px);
  right: auto;
  bottom: auto;
  top: 50%;
  --tt-slide: -4px;
  transform: translate(calc(var(--tt-dx) + var(--tt-slide)), calc(-50% + var(--tt-dy)));
}
#brand .tt::after {
  top: calc(50% - var(--tt-dy));
  bottom: auto;
  left: auto;
  right: 100%;
  border-top-color: transparent;
  border-right-color: var(--tt-bg);
  transform: translateY(-50%);
}
#brand:hover .tt { opacity: 1; --tt-slide: 0px; }
#brand .tt-show { display: none; }
body.ui-hidden #brand .tt-hide { display: none; }
body.ui-hidden #brand .tt-show { display: inline; }

/* ===== colour + symmetry: compact corner modal ===== */

/* Sits exactly over the dock it was opened from; its cross lands where the
   opening button was. Grows out of the top-right corner. */
.color-and-symmetry-row {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 264px;
  padding: 18px 20px 20px;
  gap: 16px;
  background: var(--glass-strong);
  transform-origin: top right;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  overflow-x: hidden;
}

.btn-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  color: var(--ink-faint);
  cursor: pointer;
  transition: color .2s, background .2s;
}
.btn-close:hover { color: var(--ink); background: rgba(255, 255, 255, .08); }
.btn-close:focus-visible { outline: 2px solid var(--ink-dim); outline-offset: 2px; }
.btn-close svg { width: 15px; height: 15px; display: block; }

/* The engine lays the swatches out at fixed coordinates (a hex cluster with a
   second ring of half-size in-between swatches, which silk-ui.js drops again —
   seven blendable circles read far better than nineteen), sized to fit them. */
.picker-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
#colorpicker { display: block; width: 190px; height: 176px; }
/* The engine's own mark for the chosen circle. The stroke is clipped by the
   swatch's clip-path, so half of it lands inside the circle; the glow is what
   carries outside. Both ride the path itself, so a re-render keeps them. */
#colorpicker path.selected {
  stroke: rgba(255, 255, 255, .92);
  stroke-width: 5;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, .45));
}

/* Second palette: bright, saturated, none of them in the hex cluster above. */
.mini-swatches { display: flex; justify-content: center; gap: 9px; padding: 2px 0 0; }
.mini-swatch {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sw);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32), 0 3px 8px -3px rgba(0, 0, 0, .9);
  cursor: pointer;
  transition: transform .22s var(--spring), box-shadow .22s var(--ease);
}
.mini-swatch:hover { transform: translateY(-2px) scale(1.14); }
.mini-swatch:active { transform: scale(.9); }
.mini-swatch:focus-visible { outline: 2px solid var(--ink-dim); outline-offset: 3px; }
/* Ring sits outside the circle so the colour itself stays unobstructed. */
.mini-swatch.selected {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .32),
              0 0 0 2px rgba(10, 10, 16, .85), 0 0 0 3.5px var(--ink),
              0 0 12px -1px var(--sw);
}

.label {
  font-size: 11px;
  line-height: 1.1;
  color: var(--ink-faint);
  letter-spacing: .02em;
  text-align: center;
}
/* Swatches read as buttons. */
#colorpicker path { cursor: pointer; }

#symmetry-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}
.sym-slider-block { display: flex; flex-direction: column; gap: 2px; }
.sym-toggles { display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* Geometry here is read back by the engine — see the header note. The track is
   a fixed 224px at every viewport so the width measured at load stays true. */
.slider.control {
  position: relative;
  width: 224px;
  height: 30px;
  margin: 0 auto;
  cursor: pointer;
}
.slider .slider-bg {
  position: relative;
  margin-left: 0;
  width: 100%;
  height: 4px;
  top: 13px;
  background: rgba(255, 255, 255, .13);
  border-radius: 2px;
}
/* The engine still writes a fill width here; the design shows none. */
.slider .slider-bg-pc { display: none; }
/* Seven dots — one per detent of the snap grid. */
.slider .ticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}
.slider .tick { width: 2px; height: 2px; border-radius: 50%; background: rgba(255, 255, 255, .38); }

.slider .handle,
.slider .ghost-handle {
  position: absolute;
  top: 7px;
  width: 16px;
  height: 16px;
  margin: 0;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 8px rgba(0, 0, 0, .55), 0 0 0 4px rgba(255, 255, 255, .07);
  pointer-events: none;
  transition: left .16s var(--ease);
}
.slider .ghost-handle { opacity: .25; box-shadow: none; }

.slider-legend {
  display: flex;
  justify-content: space-between;
  width: 224px;
  margin: 0 auto;
  font-size: 10.5px;
  color: var(--ink-faint);
}

.toggle.control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 15px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
  cursor: pointer;
  transition: background var(--fade), box-shadow var(--fade);
}
.toggle.control:hover { background: rgba(255, 255, 255, .09); }
.toggle.control .description { font-size: 12.5px; color: var(--ink-dim); transition: color var(--fade); }
.toggle.control .state {
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  transition: color var(--fade);
}
.toggle.control .state-on { display: none; }
.toggle.control .state-off { display: inline; }
.toggle.control.on {
  background: rgba(255, 255, 255, .13);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
}
.toggle.control.on .description,
.toggle.control.on .state { color: var(--ink); }
.toggle.control.on .state-on { display: inline; }
.toggle.control.on .state-off { display: none; }

/* ===== share (bottom-right, above the action buttons) ===== */

#share-wrap { position: relative; display: flex; align-items: center; gap: 8px; }

/* Sized to its contents, unlike the fixed-width panels — a row of icon buttons
   plus the link field is wider than 320px and would otherwise spill out. */
#share-row { width: auto; max-width: calc(100vw - 24px); transform-origin: bottom right; }

#share-options { display: none; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
#share-options.show-share-options { display: flex; }

.direct-link {
  width: 190px;
  height: 36px;
  padding: 0 12px;
  font: inherit;
  font-size: 12px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .06);
  border: 0;
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
  outline: none;
}
.direct-link:focus { color: var(--ink); background: rgba(255, 255, 255, .09); }

/* Indeterminate progress while the picture uploads. */
.loading-stripes {
  position: absolute;
  inset: auto 9px 7px;
  height: 2px;
  border-radius: 2px;
  opacity: 0;
  background: linear-gradient(90deg, transparent, var(--ink), transparent);
  background-size: 60% 100%;
  background-repeat: no-repeat;
}
.btn.loading .loading-stripes { opacity: 1; animation: silk-stripes 1.1s linear infinite; }
@keyframes silk-stripes {
  from { background-position: -60% 0; }
  to   { background-position: 160% 0; }
}

.share-status {
  min-height: 16px;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}
.share-status.error { color: #ff9a9a; }

/* ===== about + hotkeys (bottom-left, above the buttons) ===== */

.about-panels {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.about-row {
  width: min(300px, calc(100vw - 32px));
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-dim);
  text-align: left;
  align-items: flex-start;
  gap: 10px;
  transform-origin: bottom left;
}
/* The About card holds still fully lit the whole time it is open — no need to
   hover it to read it. (The hotkeys card keeps the default hover-to-brighten.) */
.about-row.visible {
  opacity: 1;
  background: rgba(30, 30, 42, 0.38);
  backdrop-filter: var(--blur-hover);
  -webkit-backdrop-filter: var(--blur-hover);
}
.about-row p { margin: 0; }
.about-row .about-license { font-size: 10.5px; line-height: 1.2; color: var(--ink-faint); }
.about-row a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--ink-faint); }
.about-row a:hover { color: var(--ink); border-bottom-color: var(--ink); }

.hotkeys-row {
  width: auto;
  align-items: stretch;
  gap: 8px;
  padding: 16px 18px;
  transform-origin: bottom left;
  transition-delay: .07s;
}
.hotkey {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.hotkey kbd {
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -1px 0 rgba(0, 0, 0, .3);
  font: 600 10.5px/1.4 inherit;
  font-family: inherit;
  letter-spacing: .04em;
  color: var(--ink);
  text-align: center;
  text-transform: uppercase;
}
/* Keyboard tips make no sense without a keyboard. */
@media (hover: none) { .hotkeys-row { display: none; } }

/* ===== language ===== */

#lang-wrap { position: relative; }
/* Opens upward from the bottom-left cluster and grows out of its corner;
   items follow one after another in a small cascade (--i set per item). */
#lang-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 172px;
  /* Tall enough for all nine languages so there is no inner scrollbar — a
     scroll gutter here flashes a page scrollbar while the panel scales open. */
  max-height: min(84vh, 470px);
  overflow: hidden;
  padding: 6px;
  background: var(--glass-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: 14px;
  box-shadow: var(--glass-edge), 0 26px 60px -28px rgba(0, 0, 0, .9);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.6);
  transform-origin: bottom left;
  transition: opacity .35s var(--ease), transform .45s var(--spring), visibility 0s .35s;
}
#lang-menu::-webkit-scrollbar { width: 0; height: 0; }
#lang-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition: opacity .35s var(--ease), transform .45s var(--spring), visibility 0s;
}
#lang-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 0;
  border-radius: 9px;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  opacity: 0;
  transform: translateY(7px);
  transition: opacity .3s var(--ease) calc(var(--i, 0) * 36ms),
              transform .35s var(--spring) calc(var(--i, 0) * 36ms),
              background .15s ease 0s, color .15s ease 0s;
}
#lang-menu.open button { opacity: 1; transform: none; }
#lang-menu button:hover { background: rgba(255, 255, 255, .08); color: var(--ink); }
#lang-menu button[aria-selected="true"] { color: var(--ink); font-weight: 600; }
#lang-menu button[aria-selected="true"]::after {
  content: '';
  width: 5px;
  height: 5px;
  margin-left: auto;
  border-radius: 50%;
  background: currentColor;
  opacity: .9;
}
#lang-menu img { width: 20px; height: 14px; flex: 0 0 auto; object-fit: cover; border-radius: 3px; }

#lang-code { font-size: 12px; font-weight: 600; letter-spacing: .04em; }

/* ===== intro ===== */

#intro-center,
#intro-draw-something,
#intro-mute-option {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s var(--ease);
}
#intro-center.visible,
#intro-draw-something.visible,
#intro-mute-option.visible { opacity: 1; }

#intro-center { top: 50%; transform: translate(-50%, -50%); }
.silk-wordmark {
  margin: 0;
  font-size: clamp(46px, 11vw, 96px);
  font-weight: 200;
  letter-spacing: .3em;
  text-indent: .3em;
  color: var(--ink);
  text-shadow: 0 0 48px rgba(150, 140, 255, .4);
  animation: word-breathe 6s ease-in-out infinite alternate;
}
@keyframes word-breathe {
  from { opacity: .86; transform: scale(1); }
  to   { opacity: 1; transform: scale(1.02); }
}
#intro-draw-something {
  top: calc(50% + 46px);
  font-size: 14px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink);
}
#intro-mute-option {
  bottom: 92px;
  font-size: 12.5px;
  color: var(--ink-faint);
  pointer-events: auto;
}
#intro-mute-option a {
  color: var(--ink-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-faint);
  cursor: pointer;
}
#intro-mute-option a:hover { color: var(--ink); }

/* ===== tips ===== */

#tips {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 6;
  text-align: center;
  pointer-events: none;
  transition: opacity var(--fade);
}
#tips .tip {
  display: none;
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: .02em;
}
#tips .tip.showing { display: block; animation: tip-in .6s var(--ease); }
@keyframes tip-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
#tips .tip b { color: var(--ink-dim); font-weight: 600; }

/* ===== shared picture thumbnail ===== */

#replay-thumbnail {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 11;
  display: none;
  padding: 6px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: 12px;
  box-shadow: var(--glass-edge), 0 18px 44px -20px rgba(0, 0, 0, .9);
  cursor: pointer;
  transition: opacity var(--fade);
}
#replay-thumbnail.visible { display: block; }
#replay-thumbnail img { display: block; border-radius: 8px; }

/* ===== small screens ===== */

@media (max-width: 720px) {
  #brand { top: 14px; left: 16px; font-size: 16px; }
  #main-controls { top: 12px; right: 12px; }
  #corner-actions { bottom: 12px; right: 12px; }
  #sound-and-about { bottom: 12px; left: 12px; }
  .direct-link { width: 130px; }
  #tips { bottom: 70px; }
  #intro-mute-option { bottom: 116px; }

  .color-and-symmetry-row { width: min(272px, calc(100vw - 24px)); max-height: calc(100vh - 80px); }
  .about-panels { flex-direction: column-reverse; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
}
