/* style.css */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh; /* Full viewport height */
  overflow-x: hidden; /* Prevent horizontal scroll */
  font-family: sans-serif;
  background: #f0f0f0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

body {
  min-height: 100vh; /* Ensure body takes full height */
  display: flex;
  flex-direction: column;
}

#header {
  width: 100%;
  max-width: 480px; /* Keep max-width for larger screens */
  margin: 0 auto; /* Center on larger screens */
  padding: 10px;
  box-sizing: border-box;
  flex-shrink: 0; /* Prevent header from shrinking */
  position: relative; /* For positioning speech toggle */
}

#game-container {
  width: 100%;
  max-width: 480px; /* Keep max-width for larger screens */
  margin: 0 auto; /* Center on larger screens */
  background: #fff;
  border: 2px solid #444;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  flexAROOT: 0; /* Prevent game container from shrinking */
}

#room-display {
  padding: 8px;
  text-align: center;
  background: #222;
  color: #fff;
  margin-bottom: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  flex-shrink: 0; /* Prevent shrinking */
}

#room-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: inherit;
  opacity: 0.5;
  z-index: 1;
}

#room-name, #room-desc {
  position: relative;
  z-index: 2;
  text-shadow:
    0 0 4px rgba(0, 0, 0, 0.7),
    -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
}

#log {
  width: 100%;
  box-sizing: border-box;
  height: 200px;
  padding: 5px;
  overflow-y: auto;
  background: #f9f9f9;
  color: #000;
  font-size: 0.85em;
  line-height: 1.3;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  flex-shrink: 0; /* Prevent shrinking */
}

.timestamp { color: #888; margin-right: 4px; }
.player-text { color: #004080; }
.npc-text { color: #006600; }
.system-text { color: #444; }

#controls {
  display: flex;
  justify-content: space-between;
  padding: 8px;
  background: #1a1a1a; /* Dark, console-like background */
  border-top: 1px solid #444;
  border-bottom: 1px solid #444;
  flex-shrink: 0; /* Prevent shrinking */
}

.dir-btn {
  flex: 1;
  margin: 4px;
  padding: 10px 0;
  font-size: 1em;
  font-family: 'Arial', sans-serif;
  font-weight: bold;
  color: #ffffff;
  background: linear-gradient(145deg, #2a2a2a, #1c1c1c); /* Metallic gradient */
  border: 2px solid #d4a017; /* Gold accent to match header */
  border-radius: 8px;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.2), /* Inner glow */
    inset 0 -2px 4px rgba(0, 0, 0, 0.5), /* Inner shadow */
    0 4px 8px rgba(0, 0, 0, 0.3); /* Outer shadow */
  transition: all 0.2s ease;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.dir-btn:hover:not(.disabled) {
  background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    0 6px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.dir-btn:active:not(.disabled) {
  background: linear-gradient(145deg, #1c1c1c, #2a2a2a);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.2);
  transform: translateY(1px);
}

.dir-btn.disabled,
.dir-btn:disabled {
  background: linear-gradient(145deg, #1a1a1a, #151515);
  border: 2px solid #666; /* Muted border */
  color: #666; /* Muted text */
  box-shadow: none; /* Remove shadows */
  cursor: not-allowed;
  transform: none;
  opacity: 0.6;
}

#command-line {
  display: flex;
  padding: 4px;
  background: #eee;
  flex-shrink: 0; /* Prevent shrinking */
}

#command-input {
  flex: 1;
  padding: 8px;
  font-size: 16px;
  border: 1px solid #888;
  border-radius: 4px;
  margin-right: 4px;
}

#send-button {
  padding: 8px 16px;
  font-size: 0.9em;
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 4px;
}

#speech-toggle {
  transition: all 0.2s ease;
}

#speech-toggle:hover {
  background: #e6b800;
}

#speech-toggle:active {
  background: #b38f00;
  transform: translateY(1px);
}

footer {
  width: 100%;
  max-width: 480px; /* Match game-container */
  margin: 0 auto; /* Center on larger screens */
  box-sizing: border-box;
  flex-shrink: 0; /* Prevent footer from shrinking */
}

@media (max-width: 500px) {
  #log { height: 200px; }
  #header, #controls, #command-line { padding: 3px; }
  .dir-btn, #command-input, #send-button { font-size: 16px; }
  #header, #game-container, footer {
    max-width: 100%; /* Full width on small screens */
  }
  .dir-btn {
    padding: 8px 0;
    font-size: 0.9em;
    margin: 2px;
  }
}
#mic-button.listening {
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0% { background-color: #ffcc00; }
  50% { background-color: #e6b800; }
  100% { background-color: #ffcc00; }
}
.chat-text {
  color: #00ff00; /* Green for chat messages */
}
