:root {
  --bg: #000000;
  --panel: #141414;
  --frame: #2e2e2e;
  --text: #ffffff;
  --text-muted: #9a9a9a;
  --accent: #ffffff;
  --accent-dim: #4d4d4d;
  --complete: #ffffff;
  --error: #d0d0d0;
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: clamp(8px, 2vh, 20px);
  padding: clamp(12px, 3vh, 28px) clamp(14px, 4vw, 40px);
}

/* ---------- Stand / image ---------- */

#stand {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.5vh, 14px);
}

#page-frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 900px;
  background: var(--panel);
  border: 1px solid var(--frame);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#page-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #f2f2f2;
}

#page-image[src=""] { display: none; }

#load-error {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--error);
  gap: 6px;
  background: var(--panel);
}

#load-error:not([hidden]) {
  display: flex;
}

#load-error .hint {
  color: var(--text-muted);
  font-size: 0.85rem;
  max-width: 40ch;
}

#load-error code {
  color: var(--text);
}

#caption {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.8vw, 1.6rem);
  color: var(--text);
  margin: 0;
  text-align: center;
  min-height: 1.4em;
}

/* ---------- Transport ---------- */

#transport {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.transport-btn {
  border: 1px solid var(--frame);
  background: var(--panel);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.transport-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.transport-btn:hover {
  border-color: var(--accent-dim);
}

.transport-btn:active {
  transform: scale(0.94);
}

.transport-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.transport-btn.primary {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-color: var(--accent);
  color: #000000;
}

.transport-btn.primary svg {
  width: 14px;
  height: 14px;
}

.transport-btn.primary:hover {
  filter: brightness(1.08);
}

/* ---------- Small screens ---------- */

@media (prefers-reduced-motion: reduce) {
  .transport-btn { transition: none; }
}
