/* ===== CORE LAYOUT ===== */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;

  background: radial-gradient(circle at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.35) 100%);
  z-index: 1;
}

body {
  margin: 0;
  background-color: #4b4b4b;
  color: #e0e0e0;

  font-family: "Helvetica Neue", Arial, sans-serif;
}

#game {
  padding: 16px;
  max-width: 720px;
  margin: 0 auto;
}

/* ===== ROOM ===== */

#roomTitle {
  margin: 0 0 8px 0;
}

#roomIntro {
  margin: 0.5em 0;
}

#roomButtons,
#actionArea,
#crisisActions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

/* ===== BUTTONS ===== */

button {
  background: #222;
  color: #e0e0e0;
  border: 1px solid #666;
  padding: 8px 12px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

button:hover {
  background: #333;
}

/* ===== OVERLAY ===== */

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

#overlay[hidden] {
  display: none;
}

#overlayContent {
  background: #111;
  border: 1px solid #666;
  padding: 16px;
  max-width: 480px;
  width: 90%;
}

#overlayTitle {
  margin: 0 0 8px 0;
  font-weight: bold;
}

#overlayText p {
  margin: 0.4em 0;
}

#overlayButtons {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ===== ENDING SCORE ===== */

#endingScore {
  margin-top: 20px;
}

#endingScore table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

#endingScore td {
  border-bottom: 1px solid #444;
  padding: 4px 6px;
  font-size: 0.9em;
}

/* ===== MEDIA ===== */

#background {
  position: fixed;
  inset: 0;
  z-index: -1;
}

.bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.6s ease, background-image 0.6s ease;
  opacity: 0;
}

/* Halutessa eri blur/brightness-efektejä */
#bg-event {
  filter: contrast(1.1) saturate(1.1);
}

#roomMedia,
#overlayMedia {
  margin: 1rem auto;
  text-align: center;
}

img, video {
  max-width: 100%; /* Ei koskaan leveämpi kuin isäntä */
  height: auto;    /* Säilyttää alkuperäisen kuvasuhteen */
  display: block;  /* Estää inline-kuvan aiheuttamia valkoisia marginaaleja */
  margin: 0 auto;
}

/* ===== FOOTER ===== */

#footer {
  margin-top: 1.5em;
  padding: 0.6em 1em;

  font-size: 0.75rem;
  line-height: 1.4;

  color: rgba(255, 255, 255, 0.6);
  text-align: center;

  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

#footerFixed {
  color: rgba(255, 255, 160, 0.9);
  padding: 0;
  margin: 0.05em;
}

/* ===== DEV PANEL ===== */

#devPanel {
  position: fixed;
  bottom: 0;
  right: 0;
  max-height: 40vh;
  overflow: auto;
  background: rgba(0, 0, 0, 0.9);
  color: #0f0;
  font-family: monospace;
  font-size: 12px;
  padding: 8px;
  border-top-left-radius: 6px;
  z-index: 2000;
  min-width: 260px;
}

#devPanel h4 {
  margin: 6px 0 2px;
  color: #9f9;
}

#devPanel .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

#devPanel.hidden {
  display: none;
}
