/* --- Variables & Reset --- */
:root {
  --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --color-text: #ffffff;
  --color-overlay: rgba(18, 18, 18, 0.9);
  --color-sidebar: #111;
  --color-accent: #5cb85c;
  --color-error: #d9534f;
  --sidebar-width: 260px;
}

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

body {
  font-family: var(--font-main);
  color: var(--color-text);
  /* PATH: Relative to this CSS file. Looks for background.png in the same assets folder */
  background-image: url('background.png'); 
  background-repeat: no-repeat;
  background-position: center center;
  background-attachment: fixed;
  background-size: cover;
  background-color: #222;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Page Overlay */
.page-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--color-overlay);
  z-index: -1;
}

/* --- Layout --- */
.wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* --- Sidebar Navigation --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  border-right: 1px solid #333;
  display: flex;
  flex-direction: column;
  padding: 20px;
  /* Ensure sidebar is ALWAYS on top */
  z-index: 10000; 
  transition: transform 0.3s ease;
  overflow-y: auto;
}

/* Desktop Logic */
@media (min-width: 769px) {
  .sidebar { transform: translateX(0); }
  .sidebar.collapsed { transform: translateX(-100%); }
  
  .main-content {
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
  }
  
  body.sidebar-closed .main-content { margin-left: 0; }
}

/* Mobile Logic */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.active { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

/* Sidebar Internal Elements */
.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid #333;
  margin-top: 5px;
}

.nav-brand { display: flex; align-items: center; }
.nav-logo { width: 32px; height: 32px; margin-right: 10px; }
.nav-title { font-weight: bold; font-size: 1.2rem; letter-spacing: 1px; }

/* Internal Close Button (Mobile) */
.nav-close-btn {
  background: none;
  border: 1px solid #444;
  color: #fff;
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.nav-close-btn:hover { border-color: var(--color-error); color: var(--color-error); }
/* Hide close button on desktop unless sidebar is behaving as overlay */
@media (min-width: 769px) { .nav-close-btn { display: none; } }

.nav-links { list-style: none; flex-grow: 1; }
.nav-links li { margin-bottom: 5px; }
.nav-links a {
  text-decoration: none;
  color: #aaa;
  font-size: 1rem;
  display: block;
  padding: 10px;
  border-radius: 4px;
  transition: 0.2s;
}
.nav-links a:hover, .nav-links a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  padding-left: 15px;
}

.nav-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #666;
  margin: 15px 0 5px;
  letter-spacing: 1px;
  font-weight: bold;
}

/* Secret Link */
.nav-secret {
  margin-top: auto;
  border-top: 1px solid #333;
  padding-top: 15px;
  text-align: center;
}
.secret-btn {
  color: #333; 
  text-decoration: none;
  font-size: 0.8rem;
  padding: 10px;
  display: block;
  cursor: pointer;
}
.secret-btn:hover { color: var(--color-accent); }

/* Hamburger Menu Toggle (External) */
.menu-toggle {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 5000; /* Below sidebar, above content */
  background: rgba(0,0,0,0.8);
  border: 1px solid #555;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hide toggle when sidebar is open */
body.sidebar-open .menu-toggle { display: none; }

/* --- Main Content --- */
.main-content {
  flex: 1;
  width: 100%;
  padding: 20px;
  /* Removed excessive top padding so content is visible immediately */
  display: flex;
  flex-direction: column;
  align-items: center; 
}

/* Mobile top spacing to clear status bar/notches */
@media (max-width: 768px) {
    .main-content { padding-top: 80px; }
}
@media (min-width: 769px) {
    .main-content { padding-top: 40px; }
}

/* --- Components --- */
h1 { font-size: 3rem; margin-bottom: 10px; text-transform: uppercase; line-height: 1.1; text-shadow: 2px 2px 4px #000; }
h2 { border-bottom: 2px solid var(--color-accent); padding-bottom: 10px; margin: 30px 0 20px; width: 100%; }
h3 { margin: 25px 0 10px; color: var(--color-accent); font-size: 1.1rem; text-transform: uppercase; }
p { line-height: 1.6; margin-bottom: 15px; color: #ddd; }
code { background: #111; padding: 2px 6px; border-radius: 3px; font-family: monospace; }

/* Buttons */
.btn-container {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: 30px 0;
  justify-content: center;
}
.mc-btn {
  border: none;
  color: white;
  font-weight: bold;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background-color: #555;
  /* PATH: Relative to CSS file */
  background-image: url('buttonlarge.png'); 
  background-size: 100% 100%; 
  background-repeat: no-repeat;
  image-rendering: pixelated;
  transition: transform 0.1s;
  width: 250px; 
  height: 60px; 
  font-size: 1.2rem;
}
.mc-btn:active { transform: translateY(2px); filter: brightness(0.9); }

/* Rules Box */
.rules-container {
  position: relative;
  transition: max-height 0.5s ease;
  overflow: hidden;
  background: rgba(0,0,0,0.2);
  padding: 10px;
  border-radius: 4px;
}
.rules-container.collapsed {
  max-height: 300px;
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
}
.rules-container.expanded {
  max-height: 5000px; 
  mask-image: none;
  -webkit-mask-image: none;
}
.rules-toggle-btn {
  display: block;
  margin: 15px auto 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--color-accent);
  color: #fff;
  padding: 10px 20px;
  cursor: pointer;
  text-transform: uppercase;
  font-weight: bold;
  font-size: 0.9rem;
  border-radius: 4px;
}
.rules-toggle-btn:hover { background: rgba(92, 184, 92, 0.2); }
.rules-list { list-style: none; padding: 0; text-align: left; }
.rules-list li { margin-bottom: 12px; padding-left: 15px; border-left: 2px solid #444; font-size: 0.95rem; color: #ccc; }

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  text-align: left;
  width: 100%;
}
.card { background: rgba(30, 30, 30, 0.9); padding: 20px; border: 1px solid #555; box-shadow: 0 4px 6px rgba(0,0,0,0.3); }

/* Player List Grid */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 15px;
  margin-top: 20px;
}
.player-card {
  background: rgba(0,0,0,0.3);
  padding: 15px;
  border: 1px solid #444;
  text-align: center;
  border-radius: 4px;
}
.player-head {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  margin-bottom: 8px;
  border-radius: 4px;
  background: #333;
}
.player-name {
  font-size: 0.9rem;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status Card */
.status-card {
  background: rgba(10, 10, 10, 0.8);
  border: 2px solid #555;
  padding: 25px;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
  border-radius: 4px;
  text-align: center;
}
.status-dot {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-right: 8px;
  background: #777;
}
.status-dot.online { background: var(--color-accent); box-shadow: 0 0 8px var(--color-accent); }
.status-dot.offline { background: var(--color-error); }

/* Toast */
#toast {
  visibility: hidden;
  min-width: 250px;
  background-color: #333;
  color: #fff;
  text-align: center;
  border-radius: 4px;
  padding: 16px;
  position: fixed;
  z-index: 12000;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%);
  border: 1px solid var(--color-accent);
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}
#toast.show { visibility: visible; animation: fadein 0.5s, fadeout 0.5s 2.5s; }
@keyframes fadein { from {bottom: 0; opacity: 0;} to {bottom: 30px; opacity: 1;} }
@keyframes fadeout { from {bottom: 30px; opacity: 1;} to {bottom: 0; opacity: 0;} }
