* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-dark: #1a1a2e;
  --bg-panel: #16213e;
  --accent: #e94560;
  --accent-soft: #533483;
  --text: #eaeaea;
  --text-dim: #a0a0b8;
  --pixel-border: #0f3460;
  --highlight: #ffd700;
  --sky-top: #5c94fc;
  --sky-bottom: #c8e8ff;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-dark);
  color: var(--text);
  font-family: 'Press Start 2P', monospace;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
}

#title-bar {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 4px solid var(--pixel-border);
  background: var(--bg-panel);
  flex-shrink: 0;
}

#title-bar h1 {
  font-size: clamp(10px, 2vw, 16px);
  color: var(--highlight);
  letter-spacing: 2px;
}

#title-bar .subtitle {
  font-size: clamp(6px, 1.2vw, 9px);
  color: var(--text-dim);
  margin-top: 8px;
}

#game-container {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
  border-left: 4px solid var(--pixel-border);
  border-right: 4px solid var(--pixel-border);
}

#game-canvas {
  flex: 1;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  cursor: default;
}

#hud {
  width: 420px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 4px solid var(--pixel-border);
  padding: 18px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.8;
}

#hud.hidden {
  display: none;
}

.hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}

.hud-badge {
  background: var(--accent);
  color: #fff;
  padding: 5px 10px;
  font-size: 11px;
}

.hud-dates {
  color: var(--highlight);
  font-size: 11px;
}

#hud-title {
  font-size: 14px;
  color: var(--highlight);
  margin-bottom: 8px;
  line-height: 1.6;
}

#hud-company {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 10px;
}

.hud-meta {
  color: var(--text-dim);
  font-size: 11px;
  margin-bottom: 14px;
}

.hud-summary {
  color: var(--text);
  font-size: 11px;
  line-height: 1.9;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px dashed var(--pixel-border);
}

.hud-section h4 {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 10px;
}

#hud-highlights {
  list-style: none;
  margin-bottom: 18px;
}

#hud-highlights li {
  font-size: 11px;
  color: var(--text);
  padding: 5px 0 5px 16px;
  position: relative;
  line-height: 1.7;
}

#hud-highlights li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--highlight);
}

.hud-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.hud-stack span {
  background: var(--accent-soft);
  color: var(--text);
  padding: 5px 8px;
  font-size: 10px;
  border: 2px solid var(--pixel-border);
}

#controls-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 33, 62, 0.9);
  border: 2px solid var(--pixel-border);
  padding: 8px 14px;
  font-size: 7px;
  color: var(--text-dim);
  pointer-events: none;
  white-space: nowrap;
}

#controls-hint kbd {
  background: var(--bg-dark);
  border: 2px solid var(--pixel-border);
  padding: 2px 6px;
  margin: 0 2px;
  font-family: inherit;
  font-size: 7px;
  color: var(--highlight);
}

#contact-screen,
#achievement-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.hidden,
.contact-link.hidden,
#contact-screen.hidden,
#achievement-screen.hidden,
#hud.hidden {
  display: none !important;
}

.achievement-bonus {
  font-size: 9px;
  color: var(--highlight);
  margin: 8px 0 4px;
  text-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

#achievement-screen .contact-label {
  font-size: 10px;
}

#achievement-screen .contact-panel h2 {
  margin-bottom: 22px;
}

#achievement-screen .contact-desc {
  font-size: 9px;
  line-height: 1.9;
}

.contact-panel {
  background: var(--bg-panel);
  border: 4px solid var(--highlight);
  padding: 32px 40px;
  text-align: center;
  max-width: 480px;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.2);
}

.contact-label {
  font-size: 8px;
  color: var(--accent);
  margin-bottom: 16px;
}

.contact-panel h2 {
  font-size: 14px;
  color: var(--highlight);
  margin-bottom: 12px;
}

.contact-desc {
  font-size: 7px;
  color: var(--text-dim);
  margin-bottom: 24px;
  line-height: 1.8;
}

.contact-link {
  display: block;
  font-size: 8px;
  color: var(--sky-top);
  text-decoration: none;
  margin: 12px 0;
  padding: 8px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.contact-link:hover {
  border-color: var(--sky-top);
}

#restart-btn,
#achievement-continue-btn {
  margin-top: 20px;
  font-family: inherit;
  font-size: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 4px solid #a03050;
}

#restart-btn:active,
#achievement-continue-btn:active {
  border-bottom-width: 2px;
  transform: translateY(2px);
}

@media (max-width: 900px) {
  #game-container {
    flex-direction: column;
  }

  #hud {
    width: 100%;
    max-height: 35vh;
    border-left: none;
    border-top: 4px solid var(--pixel-border);
  }

  #controls-hint {
    font-size: 6px;
    bottom: auto;
    top: 8px;
    transform: translateX(-50%);
  }
}
