@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700&family=Lato:wght@400;700&display=swap');

:root {
  --bg-color: #050505;
  --text-gold: #d4af37;
  --text-red: #ff3333;
  --ui-bg: rgba(15, 15, 20, 0.95);
}

* {
  box-sizing: border-box;
  user-select: none;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: white;
  font-family: 'Lato', sans-serif;
  overflow: hidden;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1280px;
  max-height: 960px;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
  background: #111;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* UI Layer */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* Key Styles */
.key {
  display: inline-block;
  background: #333;
  border: 1px solid #666;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-weight: bold;
  color: white;
  margin-right: 5px;
  font-size: 0.8rem;
  box-shadow: 0 2px 0 #111;
}

.highlight-gold { color: var(--text-gold); font-weight: bold; }
.highlight-red { color: var(--text-red); font-weight: bold; }

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: center;
  gap: 3rem;
  padding: 1rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent);
}

.stat-box {
  text-align: center;
  color: #aaa;
}

.stat-box .label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-box .value {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  color: var(--text-gold);
  font-weight: bold;
}

.timer-box .value {
  color: white;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.timer-critical {
  color: var(--text-red) !important;
  animation: pulse 0.5s infinite;
}

/* Messages & Modals */
#center-message, #end-screen {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--ui-bg);
  padding: 2rem;
  border: 2px solid var(--text-gold);
  text-align: center;
  border-radius: 4px;
  box-shadow: 0 0 50px rgba(0,0,0,1);
  transition: opacity 0.3s;
  min-width: 600px;
  max-width: 90%;
}

.hidden {
  opacity: 0;
  pointer-events: none !important;
  display: none;
}

h1 {
  font-family: 'Cinzel', serif;
  color: var(--text-gold);
  margin: 0 0 1.5rem 0;
  font-size: 3rem;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

#end-title {
  color: var(--text-red);
}

/* Instructions Grid */
.instructions-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 2rem;
  text-align: left;
  border-bottom: 1px solid #444;
  padding-bottom: 20px;
}

.inst-col h3 {
  font-family: 'Cinzel', serif;
  color: #aaa;
  border-bottom: 1px solid #333;
  padding-bottom: 5px;
  margin-top: 0;
  font-size: 1rem;
}

.inst-col p {
  font-size: 0.9rem;
  color: #ccc;
  line-height: 1.6;
  margin: 5px 0;
}

.mission-briefing {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: #fff;
  font-style: italic;
}

button {
  background: transparent;
  border: 1px solid var(--text-gold);
  color: var(--text-gold);
  padding: 12px 40px;
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}

button:hover {
  background: var(--text-gold);
  color: black;
  box-shadow: 0 0 20px var(--text-gold);
}

/* Floating Action Bar */
#action-bar-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 60px;
  height: 10px;
  background: #333;
  border: 1px solid #fff;
  transform: translate(-50%, -40px);
  pointer-events: none;
  z-index: 10;
}

#action-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--text-gold);
  transition: width 0.1s linear;
}

#action-text {
  position: absolute;
  top: -20px;
  width: 100%;
  text-align: center;
  font-size: 10px;
  color: white;
  text-shadow: 1px 1px 0 #000;
  white-space: nowrap;
}

@keyframes pulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
