:root {
  --bg: #1c1410;
  --panel: #2a201a;
  --ink: #f4ece0;
  --muted: #b8a890;
  --accent: #e0a23c;
  --accent-2: #7fb069;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

.site-header {
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}

.site-header h1 {
  margin: 0;
  font-size: 2.75rem;
  letter-spacing: 0.4rem;
  color: var(--accent);
}

.tagline {
  margin: 0.25rem 0 0;
  color: var(--muted);
}

main {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  align-items: flex-start;
  padding: 1.5rem 1rem;
}

:root {
  /* Keep in sync with DISPLAY_W / DISPLAY_H in index.html (exact window size) */
  --display-w: 1312px;
  --display-h: 932px;
}

.stage-wrap {
  position: relative;
  width: var(--display-w);
  max-width: 100%;
  height: var(--display-h);
  background: #000;
  border: 2px solid var(--panel);
  border-radius: 8px;
  /* Display is bigger than the Greenfoot window, so nothing overflows. */
  overflow: hidden;
}

/* CheerpJ display renders at its native pixel size inside the stage */
.game-display {
  width: var(--display-w);
  height: var(--display-h);
}

.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--muted);
  text-align: center;
  padding: 1rem;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(224, 162, 60, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.controls {
  width: min(320px, 100%);
  background: var(--panel);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}

.controls h2 {
  margin-top: 0;
  color: var(--accent-2);
}

.control-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.player {
  flex: 1 1 120px;
}

.player h3 {
  margin: 0 0 0.5rem;
}

.player ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.1em 0.4em;
  margin: 0 0.1em;
  text-align: center;
  background: #11110d;
  border: 1px solid #000;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.85em;
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.hint.small {
  font-size: 0.85rem;
  font-style: italic;
}

.site-footer {
  text-align: center;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--panel);
}
