/* ── Brutalist ────────────────────────────────────────────── */

:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --surface: #141414;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-dim: #666666;
  --accent: #ff3d00;
  --accent-dim: rgba(255, 61, 0, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
  font-family: "IBM Plex Mono", monospace;
  background: var(--bg);
  color: var(--text);
  cursor: crosshair;
  -webkit-font-smoothing: antialiased;
}

/* Noise grain overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px;
}

button, input { font: inherit; }

.app-shell {
  position: relative;
  min-height: 100vh;
}

.particle-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
}

/* ── Frame Marker (top-right) ────────────────────────────── */
.frame-marker {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.frame-marker span {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

.frame-marker::before,
.frame-marker::after {
  content: "";
  display: block;
  background: var(--border);
}

.frame-marker::before {
  width: 24px;
  height: 1px;
}

.frame-marker::after {
  width: 1px;
  height: 24px;
  position: absolute;
  top: -12px;
  right: 0;
}

/* ── Coordinate Readout ──────────────────────────────────── */
.coord-readout {
  position: fixed;
  top: 3.5rem;
  right: 1.5rem;
  z-index: 10;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ── UI Panel (bottom-left, brutalist) ───────────────────── */
.ui-panel {
  position: fixed;
  left: 1.5rem;
  bottom: 1.5rem;
  z-index: 10;
  width: min(24rem, calc(100vw - 3rem));
  padding: 1.2rem 1.4rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.ui-panel h1 {
  margin: 0 0 1rem;
  font-family: "Instrument Serif", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1;
  color: var(--text);
}

/* ── Input ───────────────────────────────────────────────── */
.word-form { margin: 0; }

.word-input {
  width: 100%;
  padding: 0.7rem 0;
  border: none;
  border-bottom: 2px solid var(--accent);
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
  caret-color: var(--accent);
  transition: border-color 0.15s;
}

.word-input::placeholder {
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

.word-input:focus {
  border-bottom-color: var(--accent);
}

/* Keystroke flash */
.word-input.flash {
  box-shadow: 0 2px 0 0 var(--accent), 0 0 12px var(--accent-dim);
}

/* ── Panel entrance animation ────────────────────────────── */
.ui-panel {
  animation: panel-in 0.4s cubic-bezier(0, 0, 0.2, 1) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 720px) {
  .ui-panel {
    left: 1rem;
    bottom: 1rem;
    width: min(100vw - 2rem, 22rem);
    padding: 1rem 1.2rem;
  }

  .frame-marker { top: 1rem; right: 1rem; }
  .coord-readout { top: 2.8rem; right: 1rem; }
}
