/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
  background-image: url("/static/images/mainbackground.webp");
  background-size: cover;
  background-position: center;
}

.is-hidden {
  display: none !important;
}

/* Navigation */
.navbar {
  background-color: #2c3e50;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

.nav-brand {
  color: #ecf0f1;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: bold;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-link {
  color: #ecf0f1;
  text-decoration: none;
  transition: color 0.3s ease;
}

.nav-link:hover {
  color: #3498db;
}

/* Main content */
.main-content {
  min-height: calc(100vh - 140px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  background-color: rgba(51, 51, 51, 0.8);
}

/* Hero section */
.hero {
  text-align: center;
  padding: 4rem 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 10px;
  margin-bottom: 3rem;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-block;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: transparent;
  color: white;
  border: 2px solid white;
}

.btn-secondary:hover {
  background-color: white;
  color: #667eea;
}

/* Features section */
.features {
  margin-bottom: 3rem;
}

.features h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: #2c3e50;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: white;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-card h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
  font-size: 1.5rem;
}

/* About page */
.about-container {
  background: white;
  padding: 3rem;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.about-container h1 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.about-description {
  font-size: 1.1rem;
  margin-bottom: 2rem;
  color: #555;
}

.tech-stack,
.getting-started {
  margin-bottom: 2rem;
}

.tech-stack h2,
.getting-started h2 {
  color: #2c3e50;
  margin-bottom: 1rem;
}

.tech-list {
  list-style: none;
}

.tech-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
}

.tech-list li:last-child {
  border-bottom: none;
}

.getting-started ol {
  padding-left: 1.5rem;
}

.getting-started li {
  margin-bottom: 0.5rem;
}

code {
  background-color: #f4f4f4;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: "Courier New", monospace;
}

/* Footer */
.footer {
  background-color: #16431f;
  color: #ecf0f1;
  text-align: center;
  padding: 1rem;
  margin-top: auto;
}

/* Responsive design */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    gap: 1rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .main-content {
    padding: 1rem;
  }

  .about-container {
    padding: 2rem;
  }

  .game-board {
    width: 100%;
    height: auto;
  }

  .board-tile {
    font-size: 0.8rem;
    min-height: 30px;
  }

  .game-controls {
    flex-direction: column;
    align-items: center;
  }

  .clan-banner__frame {
    width: 100%;
    padding: 10px;
  }

  .designer-container {
    padding: 1.8rem 1rem 3rem;
  }

  .designer-grid {
    grid-template-columns: 1fr;
  }

  .designer-card--span {
    grid-column: auto;
  }
}

/* Game Styles */
.game-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem;
}

.clan-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  text-align: center;
}

.clan-banner__frame {
  border-radius: 32px;
  background: linear-gradient(
    135deg,
    rgba(26, 69, 42, 0.85),
    rgba(33, 112, 71, 0.85)
  );
  box-shadow: 0 24px 45px rgba(31, 126, 60, 0.55);
  position: relative;
}

.clan-banner__frame::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 24px;
  border: 2px solid rgba(36, 140, 67, 0.15);
  pointer-events: none;
}

.clan-banner__image {
  display: block;
  width: 100%;
  border-radius: 24px;
  object-fit: cover;
  filter: saturate(1.08);
}

.clan-banner__caption h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: #f5f6fa;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clan-banner__caption p {
  margin: 0.25rem 0 0;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: rgba(230, 236, 245, 0.85);
  letter-spacing: 0.04em;
}

.clan-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
  text-align: center;
}

.clan-banner__image {
  display: block;
  width: 100%;
  border-radius: 24px;
  object-fit: cover;
  filter: saturate(1.08);
}

.clan-banner__caption h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: #f5f6fa;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clan-banner__caption p {
  margin: 0.25rem 0 0;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: rgba(230, 236, 245, 0.85);
  letter-spacing: 0.04em;
}

.game-container h1 {
  text-align: center;
  color: #2c3e50;
  margin-bottom: 2rem;
  font-size: 2.5rem;
}

.game-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.game-info {
  display: flex;
  gap: 2rem;
  font-weight: bold;
}

.game-info > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.board-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.designer-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  color: #e9f1ff;
}

.designer-header {
  text-align: center;
  margin-bottom: 2rem;
}

.designer-header h1 {
  font-size: clamp(2.4rem, 5vw, 3.2rem);
  margin-bottom: 0.6rem;
  letter-spacing: 0.04em;
}

.designer-header p {
  color: rgba(233, 241, 255, 0.82);
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin: 0;
}

.designer-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.designer-card {
  background: linear-gradient(
    160deg,
    rgba(15, 24, 38, 0.9),
    rgba(25, 32, 49, 0.9)
  );
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 20px 40px rgba(6, 12, 24, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.designer-card h2 {
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.designer-card--span {
  grid-column: 1 / -1;
}

.designer-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.designer-field label,
.designer-field span {
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.designer-field--inline {
  align-items: flex-start;
}

.designer-field input,
.designer-field select,
.designer-field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 18, 32, 0.85);
  color: #f1f5ff;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.designer-field input:focus,
.designer-field select:focus,
.designer-field textarea:focus {
  outline: none;
  border-color: rgba(82, 173, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(82, 173, 255, 0.25);
}

.designer-field textarea {
  resize: vertical;
  min-height: 96px;
}

.field-hint {
  font-size: 0.8rem;
  color: rgba(233, 241, 255, 0.6);
  font-weight: 500;
}

.designer-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.tiles-table-wrapper {
  max-height: 360px;
  overflow-y: auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.tiles-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 320px;
}

.tiles-table th,
.tiles-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.92rem;
}

.tiles-table thead th {
  background: rgba(33, 46, 68, 0.9);
  position: sticky;
  top: 0;
  z-index: 1;
}

.tiles-table tbody tr:nth-child(odd) {
  background: rgba(17, 27, 43, 0.85);
}

.tiles-table tbody tr:nth-child(even) {
  background: rgba(22, 32, 50, 0.85);
}

.table-action {
  background: none;
  border: none;
  color: #52adff;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  transition: color 0.15s ease;
}

.table-action:hover {
  color: #8cd0ff;
}

.designer-output textarea {
  width: 100%;
  border-radius: 14px;
  background: rgba(12, 20, 33, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #d3e4ff;
  font-family: "Fira Code", "Courier New", monospace;
  padding: 1rem;
  font-size: 0.9rem;
}

.designer-output textarea:focus {
  outline: none;
  border-color: rgba(82, 173, 255, 0.8);
  box-shadow: 0 0 0 2px rgba(82, 173, 255, 0.2);
}

/* Game board now renders as a flowing track with absolute positioned tiles */
.game-board {
  position: relative;
  width: min(90vw, 720px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 2rem;
  background-image: url("/static/images/towsnakesbg.jpg");
  background-size: cover;
  background-position: center;
  border-radius: 36px;
  box-shadow: 0 18px 45px rgba(27, 39, 53, 0.45);
  padding: clamp(16px, 4vw, 40px);
  overflow: visible;
}

.connection-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

.board-tile {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  background: #ecf0f1;
  color: #2c3e50;
  border: 4px solid rgba(12, 22, 32, 0.45);
  box-shadow: 0 10px 24px rgba(12, 22, 32, 0.35);
  border-radius: 18px;
  font-weight: 700;
  cursor: default;
  transform: translate(-50%, -50%);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 20;
}

.board-tile:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: 0 16px 28px rgba(12, 22, 32, 0.45);
}

.tile-start {
  background-color: #2ecc71 !important;
  color: white;
}

.tile-finish {
  background-color: #f39c12 !important;
  color: white;
}

.tile-objective {
  color: #2c3e50;
  text-align: center;
}

.tile-snake {
  background-color: #e74c3c !important;
  color: white;
}

.tile-ladder {
  background-color: #3498db !important;
  color: white;
}

.tile-number {
  font-size: 1em;
  line-height: 1;
}

.tile-symbol {
  font-size: 1.35em;
  line-height: 1;
}

.player-piece {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.8rem;
  color: white;
  z-index: 10;
  animation: bounce 0.5s ease-in-out;
  pointer-events: none;
  top: 50%;
  left: 50%;
  margin: -10px 0 0 -10px;
}

.player1 {
  background-color: #dd2020;
}

.player2 {
  background-color: #e622bf;
}

.player3 {
  background-color: #f1c40f;
}

.player4 {
  background-color: #27ae60;
}

.player5 {
  background-color: #2980b9;
}

@keyframes bounce {
  0%,
  20%,
  60%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  80% {
    transform: translateY(-5px);
  }
}

.tile-icon {
  width: 28px;
  height: 28px;
  margin-top: 0.25rem;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.tile-tooltip {
  position: absolute;
  max-width: 220px;
  background: rgba(44, 62, 80, 0.95);
  color: #ecf0f1;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 30;
}

.tile-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tile-tooltip .tooltip-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tile-tooltip .tooltip-body {
  font-size: 0.78rem;
  color: #d6e4f0;
}

.tile-tooltip {
  position: absolute;
  max-width: 220px;
  background: rgba(44, 62, 80, 0.95);
  color: #ecf0f1;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  font-size: 0.85rem;
  line-height: 1.4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
  z-index: 30;
}

.tile-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tile-tooltip .tooltip-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.tile-tooltip .tooltip-body {
  font-size: 0.78rem;
  color: #d6e4f0;
}

.game-log {
  background: white;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  max-height: 300px;
}

.game-log h3 {
  margin-bottom: 1rem;
  color: #2c3e50;
}

#logContainer {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ddd;
  padding: 1rem;
  border-radius: 5px;
  background-color: #f8f9fa;
}

.log-entry {
  padding: 0.5rem 0;
  border-bottom: 1px solid #eee;
  color: #555;
}

.log-entry:last-child {
  border-bottom: none;
}

.dice-result {
  color: #e74c3c;
  font-size: 1.2rem;
}

.current-player {
  color: #3498db;
  font-size: 1.2rem;
}

.player-positions {
  color: #27ae60;
}
