:root {
  color-scheme: dark;
  --ink: #0b0f14;
  --salt: #e9e4d8;
  --muted: #8b97a3;
  --line: #1e2833;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(120% 80% at 50% 0%, #111a22 0%, var(--ink) 55%, #06080b 100%);
  color: var(--salt);
  font-family: ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  padding: 2.2rem 1.2rem 3rem;
}

header, main, footer {
  width: min(920px, 100%);
}

h1 {
  margin: 0 0 .35rem;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 600;
  letter-spacing: -.02em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.loom-frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #0a0d11;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9), inset 0 0 0 1px rgba(255, 255, 255, .02);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 8 / 5;
  cursor: crosshair;
  touch-action: manipulation;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: .7rem;
  transform: translateX(-50%);
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(233, 228, 216, .5);
  pointer-events: none;
  transition: opacity .5s ease;
  opacity: 1;
}

.hint.gone { opacity: 0; }

#controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: center;
  margin-top: 1rem;
}

#controls label {
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

input[type="text"] {
  flex: 1 1 12rem;
  min-width: 8rem;
  padding: .6rem .75rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #0e141b;
  color: var(--salt);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

input[type="text"]:focus,
button:focus-visible {
  outline: 2px solid #6fb3c9;
  outline-offset: 2px;
}

button {
  padding: .6rem .95rem;
  border-radius: 9px;
  border: 1px solid #2a3946;
  background: #16202a;
  color: var(--salt);
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

button:hover { background: #1d2a36; border-color: #3a5063; }
button:active { transform: translateY(1px); }

.readout {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  margin: 1.1rem 0 0;
  font-size: .85rem;
  color: var(--muted);
}

.readout div { display: flex; gap: .45rem; align-items: baseline; }
.readout dt { letter-spacing: .1em; text-transform: uppercase; font-size: .7rem; }
.readout dd { margin: 0; color: var(--salt); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }

footer {
  margin-top: 1.4rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.6;
}

footer a { color: #8fc7d8; }

.deployment {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: .74rem;
  word-break: break-all;
  color: #6d7b88;
}

@media (max-width: 520px) {
  body { padding: 1.4rem .8rem 2rem; }
  .readout { gap: .7rem; }
}
