body {
  margin: 0;
  padding: 0;
  background-color: #2c3e50;
  color: white;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

#ui-layer {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.screen {
  background: rgba(0, 0, 0, 0.85);
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  pointer-events: auto;
  min-width: 300px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.hidden {
  display: none !important;
}

h1 { margin-top: 0; color: #f39c12; }

input[type="text"] {
  padding: 10px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #7f8c8d;
  background: #34495e;
  color: white;
  width: 80%;
  margin-bottom: 20px;
}

button {
  padding: 12px 20px;
  font-size: 16px;
  background-color: #e67e22;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin: 5px;
  font-weight: bold;
  transition: transform 0.1s, background-color 0.2s;
}

button:hover { background-color: #d35400; transform: scale(1.05); }
button:active { transform: scale(0.95); }

#player-list {
  margin-top: 20px;
  font-size: 14px;
  color: #bdc3c7;
  text-align: left;
  max-height: 150px;
  overflow-y: auto;
}

canvas {
  background-color: #1a1a12;
  border: 4px solid #1abc9c;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0,0,0,0.8);
}

#game-ui {
  position: absolute;
  bottom: 20px;
  right: 20px;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#role-display {
  background: rgba(0,0,0,0.7);
  padding: 10px 20px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-weight: bold;
  font-size: 18px;
}

#action-btn {
  background-color: #c0392b;
  font-size: 20px;
  padding: 15px 30px;
}
#action-btn:hover { background-color: #a93226; }

/* ROLE INTRO SCREEN */
#role-intro {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  pointer-events: auto;
}

.intro-content {
  text-align: center;
  max-width: 80%;
  animation: zoomIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.intro-header {
  font-size: 24px;
  color: #bdc3c7;
  letter-spacing: 4px;
  margin-bottom: 5px;
  text-transform: uppercase;
  font-weight: bold;
}

.intro-role {
  font-size: 72px;
  font-weight: 900;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 8px;
  text-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.intro-image {
  max-height: 420px;
  width: auto;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  margin-bottom: 30px;
  border: 4px solid #333;
}

.intro-objective {
  font-size: 22px;
  color: #ecf0f1;
  font-style: italic;
  font-weight: 300;
  letter-spacing: 1px;
}

@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOutIntro {
  from { opacity: 1; }
  to { opacity: 0; }
}

.fade-out {
  animation: fadeOutIntro 1s forwards !important;
}
/* LANDING PAGE SPECIFICS */
#landing-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: slideDown 0.8s ease-out;
}

.landing-title {
  font-size: 48px;
  margin: 0;
  text-shadow: 0 4px 10px rgba(0,0,0,0.5);
  color: #f39c12;
}

/* ROLE INFO ICONS */
.landing-banner-wrap {
    position: relative;
    width: 95%;
    max-width: 1400px;
    aspect-ratio: 16 / 9; /* Matched to new 16:9 user artwork */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 40px 100px rgba(0,0,0,0.95), 0 0 40px rgba(243, 156, 18, 0.15);
    background: #000;
    border: 5px solid #2d3436;
    animation: cinematicScale 1.2s ease-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

.landing-banner {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Ensure no part of the artwork is cut off */
    display: block;
    background: #000;
}

.info-icon {
  position: absolute;
  top: 20px;
  width: 40px;
  height: 40px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  border: 2px solid #fff;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: pulseIcon 2s infinite ease-in-out;
}

.info-icon.left { 
    left: 20px; 
    color: #e74c3c; 
    border-color: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.6);
}

.info-icon.right { 
    right: 20px; 
    color: #3498db; 
    border-color: #3498db;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.6);
}

.info-icon:hover {
  transform: scale(1.2);
  background: rgba(0,0,0,0.85);
  box-shadow: 0 0 20px currentColor; /* Glow with icon color */
}

/* Credits placement bottom-right */
.info-icon.credits {
    right: 25px;
    bottom: 25px;
    top: auto !important; /* Overcome base .info-icon top: 20px */
    position: fixed;
    z-index: 100;
    border-color: #bdc3c7;
    color: #bdc3c7;
}

/* Credits Modal Specifics (Handbook Style) */
.credits-card {
    width: 95% !important;
    max-width: 1200px !important; /* Even wider to support 3-4 columns */
    max-height: 90vh; /* More height to avoid scrollbar on most screens */
    overflow-y: auto;
    border: 5px solid #f39c12; 
    text-align: center !important;
    background: #1e1e2e;
    border-radius: 20px;
    box-shadow: 0 0 60px rgba(0,0,0,0.9), 0 0 30px rgba(243, 156, 18, 0.25);
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center !important; /* Force all children to center horizontally */
}

.credits-section {
    width: 100%; /* Ensure section fills card width for true centering */
    margin-bottom: 20px; /* Compacted from 45px */
    padding-bottom: 5px;
    text-align: center !important;
}

.credits-title {
    color: #f39c12;
    font-family: 'Montserrat', sans-serif;
    font-size: 20px; 
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 12px; /* Compacted from 20px */
    font-weight: 900;
    text-align: center !important;
}

.credits-name {
    font-size: 16px; /* Refined for multi-column density */
    font-family: 'Orbitron', sans-serif; 
    color: #ecf0f1;
    margin: 8px 0;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-align: center !important;
    text-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

.credits-grid {
    display: grid;
    width: 100% !important; /* Panoramic width enforcement */
    /* Forced 3-column layout to ensure widescreen expansion */
    grid-template-columns: 1fr 1fr 1fr; 
    gap: 15px 30px;
    margin: 20px auto 0;
    justify-items: center; /* Center names within their columns */
}

/* Ensure the Close button is centered in the wide view */
.credits-card .modal-footer {
    justify-content: center !important;
    margin-top: 25px;
}

#credits-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2500;
    padding: 20px;
    backdrop-filter: blur(8px);
    pointer-events: auto;
}


/* HANDBOOK MODAL OVERLAY */
#role-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
  backdrop-filter: blur(8px);
  pointer-events: auto; /* Fix for clickable close button */
}

.modal-body {
  padding: 24px;
  max-width: 500px;
  text-align: left;
  line-height: 1.6;
}

.strategy-section {
  margin-bottom: 20px;
}

.strategy-title {
  color: #f39c12;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 14px;
  margin-bottom: 8px;
  display: block;
}

.strategy-text {
  color: #bdc3c7;
  font-size: 16px;
}

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

@keyframes cinematicScale {
  from { opacity: 0; transform: scale(0.85) translateY(30px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.play-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 550px; /* Constrained for better look */
  margin: 25px auto 0;
  gap: 15px;
}

/* PLAY BUTTON */
.play-btn {
  flex-grow: 1; /* Occupies the primary space */
  background-color: #e74c3c;
  color: #fff;
  font-size: 32px;
  padding: 18px 0;
  border-radius: 60px;
  letter-spacing: 6px;
  box-shadow: 0 8px 0 #c0392b;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  font-weight: 900;
  text-transform: uppercase;
}

.play-btn:hover {
  background-color: #2ecc71;
  box-shadow: 0 8px 0 #27ae60;
  transform: translateY(-4px);
}

.play-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #27ae60;
}

.info-icon.lore {
  position: static; /* Remove the absolute positioning conflict */
  width: 46px; 
  height: 46px;
  font-size: 24px;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.4);
  background-color: rgba(0,0,0,0.4) !important;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.info-icon.lore:hover {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  background: rgba(0,0,0,0.7);
}

.lore-card {
  max-width: 650px !important;
  max-height: 80vh;
  overflow-y: auto;
}

.lore-card p {
  margin-bottom: 20px;
  line-height: 1.6;
  color: #bdc3c7;
}

#lore-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2500;
  padding: 20px;
  backdrop-filter: blur(8px);
  pointer-events: auto;
}

/* Audio Toggle HUD */
.audio-toggle {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 10000;
  background: rgba(44, 62, 80, 0.85);
  backdrop-filter: blur(4px);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.audio-toggle:hover {
  background: rgba(52, 73, 94, 0.95);
  border-color: #3498db;
  transform: translateY(-1px);
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
}

.audio-toggle.active {
  border-color: #2ecc71;
  color: #2ecc71;
  box-shadow: 0 0 15px rgba(46, 204, 113, 0.2);
}
