@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Work+Sans:wght@400;500&display=swap');

:root {
  --paper: #eaf0f6;
  --paper-alt: #DCE6EF;
  --ink: #14243A;
  --ink-soft: #4A5C71;
  --grid-line: #C3D3E1;
  --accent-blue: #2F6FED;
  --accent-yellow: #F5C518;

  --mono: 'JetBrains Mono', monospace;
  --sans: 'Work Sans', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

body {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* --- Viewer / home player page --- */

.viewer-body {
  overflow: hidden;
}

.viewer-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 24px 28px 18px 28px;
  background: linear-gradient(to bottom, rgba(234, 240, 246, 0.88) 0%, rgba(234, 240, 246, 0.88) 60%, transparent 100%);
  pointer-events: none;
}

.viewer-header a,
.viewer-header select {
  pointer-events: auto;
}

.back-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  display: inline-block;
  margin-bottom: 14px;
}

.back-link:hover { color: var(--accent-blue); }

.home-brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.home-brand span {
  color: var(--accent-blue);
}

.sketch-select {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 7px 10px;
  cursor: pointer;
}

.sketch-select:hover,
.sketch-select:focus {
  border-color: var(--accent-blue);
  outline: none;
}

.viewer-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.viewer-title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 30px;
  margin: 0;
}

.viewer-index {
  font-family: var(--mono);
  color: var(--accent-blue);
  font-size: 13px;
  margin: 6px 0 0 0;
}

.viewer-desc {
  color: var(--ink-soft);
  font-size: 14.5px;
  max-width: 560px;
  margin: 10px 0 0 0;
  line-height: 1.5;
}

.viewer-stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-canvas-wrap {
  line-height: 0;
}

.viewer-canvas-wrap canvas {
  touch-action: none;
}

@media (max-width: 640px) {
  .viewer-title { font-size: 22px; }
}

.mute-btn {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 10;
  height: 42px;
  padding: 0 16px 0 12px;
  border-radius: 21px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.mute-btn-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.mute-btn:hover,
.mute-btn:focus-visible {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  outline: none;
}

.mute-btn.is-muted {
  color: var(--ink-soft);
}

.mute-btn-icon.icon-off { display: none; }
.mute-btn.is-muted .icon-on { display: none; }
.mute-btn.is-muted .icon-off { display: block; }

.sound-hint {
  position: fixed;
  left: 24px;
  bottom: 76px;
  z-index: 10;
  padding: 8px 14px;
  border-radius: 16px;
  border: 1px solid var(--grid-line);
  background: var(--paper-alt);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0.95;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.sound-hint.is-hidden {
  opacity: 0;
  transform: translateY(6px);
}

@media (prefers-reduced-motion: reduce) {
  .sound-hint { transition: opacity 0.15s linear; }
}
