/* ==========================================================================
   1. Reset & Base Layout
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #121212;
  color: #f1f1f1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ==========================================================================
   2. Compact Top Banner Header & Integrated Login
   ========================================================================== */
.top-banner {
  background-color: #1e1e24;
  text-align: center;
  padding: 0.75rem 0.5rem;
  border-bottom: 2px solid #333;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header-main {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.top-banner h1 {
  font-size: 1.5rem;
  letter-spacing: 1.5px;
  color: #e2b714;
  text-transform: uppercase;
}

/* Discrete Header Puzzle Button */
.btn-puzzle-header {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background-color: #2b2d42;
  color: #edf2f4;
  border: 1px solid #444;
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-puzzle-header:hover {
  background-color: #3d405b;
  border-color: #e2b714;
}

.header-auth {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.compact-auth-form {
  display: flex;
  gap: 0.3rem;
  justify-content: center;
  width: 100%;
  max-width: 320px;
}

.compact-auth-form input {
  flex: 1;
  padding: 0.35rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid #444;
  background-color: #121212;
  color: #fff;
  min-width: 0; /* Prevents input overflow on small screens */
}

.btn-compact {
  padding: 0.35rem 0.6rem;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: 4px;
  border: none;
  background-color: #e2b714;
  color: #121212;
  cursor: pointer;
}

.user-badge {
  font-size: 0.75rem;
  color: #a0a0a0;
}

.game-status {
  font-size: 0.85rem;
  color: #ccc;
  margin-top: 0.25rem;
}

.highlight {
  color: #e2b714;
}

/* ==========================================================================
   3. Main Content & Cards Layout
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem;
  margin-bottom: 90px; /* Offset for fixed bottom navigation bar */
}

.card {
  background-color: #1e1e24;
  padding: 1.25rem;
  border-radius: 10px;
  border: 1px solid #2a2a32;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 400px;
}

.hero-card {
  text-align: center;
}

.hero-card h2 {
  margin-bottom: 0.5rem;
  color: #ffffff;
}

.hero-card p {
  color: #a0a0a0;
  font-size: 0.95rem;
  line-height: 1.4;
}

.app-logo {
  width: 100%;
  max-width: 280px;      /* Restricts logo width inside cards */
  height: auto;          /* Maintains original aspect ratio */
  border-radius: 8px;    /* Subtle rounded corners */
  border: 1px solid #333;
  background-color: #fff;/* Adds white background if canvas is transparent */
  display: block;
  margin: 0 auto 0.75rem auto; /* Centers the image */
}

/* API & Technology Tags */
.api-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: #e2b714;
  background: rgba(226, 183, 20, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-top: 0.75rem;
}

/* ==========================================================================
   4. Gameplay Elements (play.html)
   ========================================================================== */
.play-layout {
  flex-direction: column;
  align-items: center;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(4, 65px);
  grid-template-rows: repeat(4, 65px);
  border: 2px solid #444;
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.square {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 0.75rem;
}

.square .piece {
  line-height: 1.1;
  font-size: 1.2rem;
}

.square .piece small {
  font-size: 0.65rem;
  display: block;
  font-weight: bold;
}

.dark {
  background-color: #b58863;
  color: #000;
}

.light {
  background-color: #f0d9b5;
  color: #000;
}

.ability-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  width: 100%;
  max-width: 260px;
}

.btn-ability {
  flex: 1;
  padding: 0.6rem;
  background: #2b2d42;
  color: #fff;
  border: 1px solid #555;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.btn-ignite {
  background: #8d0801;
}

/* WebSocket Feed Box */
.feed-box {
  background: #121212;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  height: 80px;
  overflow-y: auto;
  border: 1px solid #2a2a32;
}

.ws-msg {
  color: #4caf50;
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   5. Database Data & Personal Stats Dashboard (stats.html)
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.stat-box {
  background-color: #121212;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid #2a2a32;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.stat-label {
  font-size: 0.75rem;
  color: #a0a0a0;
  margin-bottom: 0.25rem;
  text-align: center;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: bold;
  color: #ffffff;
}

.db-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.db-table th,
.db-table td {
  padding: 0.5rem;
  border-bottom: 1px solid #333;
}

.db-table th {
  color: #e2b714;
}

/* ==========================================================================
   6. Rules & Footer (help.html)
   ========================================================================== */
.help-list {
  text-align: left;
  padding-left: 1.2rem;
  line-height: 1.6;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.site-footer {
  background-color: #121212;
  text-align: center;
  padding: 1rem 0.75rem;
  font-size: 0.8rem;
  color: #888;
  border-top: 1px solid #222;
  margin-bottom: 100px; /* Elevated offset so author credit never clips with fixed bottom banner */
  width: 100%;
}

.site-footer a {
  color: #e2b714;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   7. Bottom Banner Navigation Bar
   ========================================================================== */
.bottom-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #1e1e24;
  border-top: 2px solid #333;
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0.75rem 1rem;
  gap: 0.5rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.nav-btn {
  text-decoration: none;
  font-weight: bold;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.1s ease, background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:active {
  transform: scale(0.96);
}

.btn-secondary {
  flex: 1;
  background-color: #2b2d42;
  color: #edf2f4;
  padding: 0.75rem 0.5rem;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  background-color: #3d405b;
}

.btn-primary {
  flex: 1.5;
  background-color: #e2b714;
  color: #121212;
  padding: 1.1rem 0.5rem;
  font-size: 1.2rem;
  letter-spacing: 1px;
}

.btn-primary:hover {
  background-color: #f7d036;
}