/* Copyright (c) 2026 Oliver Merkel. All rights reserved. MIT License */

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #1a3a2a;
  color: #e0e0e0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== TITLE BAR ===== */
#title-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  min-height: 48px;
  background: #0f2a1a;
  border-bottom: 2px solid #2d5a3d;
  flex-shrink: 0;
}

.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 2px solid #4a9a5a;
  border-radius: 6px;
  cursor: pointer;
  color: #c8e6c9;
  flex-shrink: 0;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.hamburger-btn:hover {
  background: #1a4a2a;
  border-color: #6abf6a;
}

.hamburger-btn svg {
  display: block;
}

#title-bar h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #c8e6c9;
  letter-spacing: 0.02em;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.15;
}

/* ===== GAME BADGE (title-bar right) ===== */
#game-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: visible;
  flex-shrink: 0;
}

.badge-player {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #1a4a2a;
  border: 1px solid #2d5a3d;
  color: #a5d6a7;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.badge-player.badge-active {
  background: #1a5a2a;
  border-color: #6abf6a;
  color: #e8f5e9;
  font-weight: 600;
}

.badge-turn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #0f3a1f;
  border: 1px solid #4a9a5a;
  color: #c8e6c9;
  font-weight: 500;
}

.badge-turn-spinner {
  width: 10px;
  height: 10px;
  border: 2px solid rgba(200, 230, 201, 0.35);
  border-top-color: #c8e6c9;
  border-radius: 50%;
  animation: badge-turn-spin 0.9s linear infinite;
}

@keyframes badge-turn-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  #title-bar {
    gap: 8px;
    padding: 2px 10px;
    min-height: 40px;
  }

  #title-bar h1 {
    font-size: 0.95rem;
    white-space: nowrap;
  }

  #game-badge {
    gap: 6px;
    font-size: 0.74rem;
  }

  .badge-turn,
  .badge-player {
    padding: 2px 6px;
  }

  .badge-turn-spinner {
    width: 8px;
    height: 8px;
    border-width: 1.5px;
  }
}

/* ===== APP CONTENT ===== */
#app {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}

/* ===== SIDE PANEL ===== */
#side-panel-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
}

#side-panel-overlay.open {
  display: block;
}

#side-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: #0f2a1a;
  border-right: 2px solid #2d5a3d;
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

#side-panel.open {
  transform: translateX(0);
}

.side-panel-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  background: none;
  border: none;
  color: #c8e6c9;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.side-panel-item:hover {
  background: #1a4a2a;
}

.side-panel-item .item-icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.side-panel-divider {
  border: none;
  border-top: 1px solid #2d5a3d;
  margin: 4px 0;
}

/* ===== OVERLAY PAGES (Rules / Options / About) ===== */
.overlay-page {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 300;
  overflow-y: auto;
}

.overlay-page.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

.overlay-content {
  background: #132b1e;
  border: 2px solid #2d5a3d;
  border-radius: 12px;
  padding: 32px;
  max-width: 640px;
  width: 100%;
}

.overlay-content h2 {
  color: #a5d6a7;
  font-size: 1.4rem;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid #2d5a3d;
}

.overlay-content h3 {
  color: #81c784;
  font-size: 1rem;
  margin: 16px 0 8px;
}

.overlay-content p,
.overlay-content li {
  color: #c8e6c9;
  line-height: 1.6;
  font-size: 0.95rem;
}

.overlay-content ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.overlay-content li {
  margin-bottom: 6px;
}

.overlay-content a {
  color: #b8e6ff;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  font-weight: 600;
}

.overlay-content a:visited {
  color: #d0b8ff;
}

.overlay-content a:hover,
.overlay-content a:active {
  color: #fff3b0;
}

.overlay-content a:focus-visible {
  outline: 2px solid #fff3b0;
  outline-offset: 2px;
  border-radius: 2px;
}

.overlay-close-btn {
  margin-top: 24px;
  padding: 10px 28px;
  background: #2d5a3d;
  border: 2px solid #4a9a5a;
  border-radius: 8px;
  color: #c8e6c9;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s;
}

.overlay-close-btn:hover {
  background: #3d7a4d;
}

/* ===== OPTIONS PANEL INSIDE OVERLAY ===== */
.options-section {
  margin-bottom: 20px;
}

/* Player type selector */
.player-type-section h3 {
  color: #81c784;
  font-size: 1rem;
  margin-bottom: 12px;
}

.player-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #1e4a2a;
}

.player-type-row:last-child {
  border-bottom: none;
}

.player-type-label {
  color: #c8e6c9;
  font-size: 0.95rem;
  min-width: 130px;
}

.player-type-radios {
  display: flex;
  gap: 16px;
  align-items: center;
}

.player-type-radios input[type="radio"] {
  accent-color: #4a9a5a;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.player-type-radios label {
  color: #c8e6c9;
  font-size: 0.9rem;
  cursor: pointer;
  margin-right: 8px;
}

/* Placeholder styles */
.game-container {
  display: block;
  width: 100%;
}

.game-section {
  background: #0f1f1a;
  border: 2px solid #2d5a3d;
  border-radius: 8px;
  padding: 20px;
}

/* Diagram figures */
figure.diagram {
  display: inline-block;
  max-width: 360px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 8px 0;
  vertical-align: top;
}

figure.diagram img,
figure.diagram embed {
  width: 100%;
  display: block;
}

figure.diagram figcaption {
  background: var(--color-border);
  color: var(--color-text-dim);
  font-style: italic;
  font-size: 0.85rem;
  padding: 6px 10px;
}
