/* Webinator — all styles. */

@font-face {
  font-family: "ChicagoFLF";
  src: url("/assets/ChicagoFLF.ttf") format("truetype");
  font-display: swap;
}

/* ---- Theme + shell ---- */

:root {
  --bg: #1e1e22;
  --panel: #2a2a30;
  --ink: #e6e6ea;
  --muted: #9a9aa5;
  --accent: #4f9cff;
  --border: #3a3a42;
  --grid-line: #3a3a42;
  --black: #111;
  --white: #f4f4f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  padding: 32px 16px;
  min-height: 100vh;
}

.app {
  width: 100%;
  max-width: 840px;
}

h1,
h2 {
  font-family: "ChicagoFLF", Chicago, "Charcoal", sans-serif;
  font-weight: normal;
}

h1 {
  font-size: 22px;
  margin: 0 0 16px;
}

.sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.sub a {
  color: var(--accent);
}

/* ---- Shared nav header ---- */

.nav {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.masthead {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav .brand {
  font-family: "ChicagoFLF", Chicago, "Charcoal", sans-serif;
  font-size: 24px;
  font-weight: normal;
  color: var(--ink);
  text-decoration: none;
}

.nav .sub {
  margin: 0;
}

.nav-links {
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 6px;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 8px;
}

.nav-links a:hover {
  color: var(--ink);
  background: var(--panel);
}

.nav-links a.active {
  color: var(--ink);
  background: var(--panel);
}

/* ---- Landing page ---- */

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px;
  min-height: 168px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .12s, transform .12s, background .12s;
}

a.tile:hover {
  border-color: var(--accent);
  background: #30303a;
  transform: translateY(-2px);
}

.tile .icon {
  font-size: 40px;
  line-height: 1;
}

.tile .title {
  font-family: "ChicagoFLF", Chicago, "Charcoal", sans-serif;
  font-size: 20px;
  font-weight: normal;
}

.tile .desc {
  color: var(--muted);
  font-size: 13px;
}

.tile.disabled {
  cursor: not-allowed;
  opacity: .55;
}

.badge {
  margin-top: auto;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Boot icon editor ---- */

.panels {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 16px;
}

.editor-card {
  flex: 1 1 420px;
}

.preview-card {
  flex: 0 0 auto;
}

.card {
  background: var(--panel);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

/* 16x10 pixel grid */
#grid {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 1px;
  background: var(--grid-line);
  border: 1px solid var(--grid-line);
  width: 100%;
  aspect-ratio: 16 / 10;
  user-select: none;
  touch-action: none;
  cursor: crosshair;
}

.cell {
  width: 100%;
  height: 100%;
}

.cell.white {
  background: var(--white);
}

.cell.black {
  background: var(--black);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

button,
.filebtn {
  appearance: none;
  border: 1px solid #44444e;
  background: #34343c;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

button:hover,
.filebtn:hover {
  background: #3e3e48;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

button:disabled:hover {
  background: #34343c;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06203f;
  font-weight: 600;
}

button.primary:hover {
  filter: brightness(1.08);
}

#file {
  display: none;
}

.status {
  color: var(--muted);
  font-size: 13px;
  margin-top: 12px;
  min-height: 1.2em;
}

.status.warn {
  color: #ffb454;
}

.preview-card h2 {
  font-size: 16px;
  margin: 0 0 2px;
}

#preview {
  width: 264px;
  /* (25 + 4*2) * 8 */
  height: 320px;
  /* (32 + 4*2) * 8 */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #fff;
  border-radius: 6px;
  display: block;
}

.legend {
  color: var(--muted);
  font-size: 12px;
  margin-top: 14px;
}

.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: middle;
  margin: 0 4px 0 10px;
  border: 1px solid var(--grid-line);
}

.swatch.w {
  background: var(--white);
}

.swatch.b {
  background: var(--black);
}

/* ---- Startup sound editor ---- */

#wave {
  display: block;
  width: 100%;
  height: 140px;
  margin-top: 16px;
  background: #1a1a1e;
  border-radius: 8px;
  cursor: pointer;
}

.sound-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.sound-controls input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

#startval {
  min-width: 56px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card h2 {
  font-size: 16px;
  margin: 0;
}

.sample-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.sample {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
}

.sample-icon {
  font-size: 22px;
  line-height: 1;
}

.sample-name {
  font-size: 14px;
}