:root {
  --bg: #1a1028;
  --fg: #f5e6ff;
  --accent: #ff6b35;
  --panel: #2a1840;
  font-family: system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
}

#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.tagline {
  opacity: 0.7;
  margin-top: 0.25rem;
}

.disclaimer {
  opacity: 0.55;
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  line-height: 1.35;
}

#menu button {
  display: block;
  width: 100%;
  margin: 0.5rem 0;
  padding: 1rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  background: var(--panel);
  color: var(--fg);
}

#menu button.primary {
  background: var(--accent);
  color: #111;
  font-weight: 700;
}

#menu button:disabled {
  opacity: 0.4;
}

.panel {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--panel);
  border-radius: 8px;
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.field {
  display: block;
  margin-bottom: 0.75rem;
}

.field span {
  display: block;
  font-size: 0.85rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}

.field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #443;
  border-radius: 6px;
  background: #1a1028;
  color: var(--fg);
  font-size: 1rem;
}

.hint {
  min-height: 1.25rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.hint.error {
  color: #f66;
  opacity: 1;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.row button {
  margin: 0;
}

.leave {
  position: absolute;
  top: 134px;
  right: 8px;
  margin: 0;
  width: auto;
  padding: 0.4rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: rgba(68, 34, 51, 0.85);
  color: var(--fg);
}

#game[hidden] { display: none; }

#game {
  position: fixed;
  inset: 0;
  background: #000; /* letterbox bars when the window is outside [4:3, 20:9] */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}

#view {
  display: block;
  background: #000;
  /* Size is set by Renderer.resize(): fills the window, aspect clamped to
     [4:3, 20:9], centered by the flex container above. */
}

#minimap {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 120px;
  height: 120px;
  background: rgba(0,0,0,0.5);
  border: 1px solid #555;
  border-radius: 4px;
}

#hud {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.6rem;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 6px;
  font-family: monospace;
}

#hud #status {
  margin-left: 0.5rem;
}

#happiness {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid #555;
  background: #111;
}

#touch-controls {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.5rem;
  align-items: end;
  touch-action: none;
}

#stick-area {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  position: relative;
  touch-action: none;
}

#stick-knob {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,107,53,0.8);
  position: absolute;
  left: 42px;
  top: 42px;
  pointer-events: none;
}

.action {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  font-size: 0.85rem;
  touch-action: none;
}

.controls-hint {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  font-size: 0.85rem;
  opacity: 0.75;
  text-align: center;
}

.controls-hint .hint-desktop { display: none; }
.controls-hint .hint-mobile { display: inline; }

@media (hover: hover) and (pointer: fine) {
  #touch-controls { display: none; }

  .controls-hint .hint-desktop { display: inline; }
  .controls-hint .hint-mobile { display: none; }
}
