/* ── Shared styles for region.html & play.html ── */
/* Theme variables, background, layout, game header, diff-card system */

* { box-sizing: border-box; }

:root {
  --bg-primary: #0f172a;
  --bg-gradient-1: rgba(59, 130, 246, 0.1);
  --bg-gradient-2: rgba(139, 92, 246, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-color-rgb: 59, 130, 246;
  --dot-color: rgba(59, 130, 246, 0.3);
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-bg-hover: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-border-hover: rgba(59, 130, 246, 0.5);
  --card-shadow: rgba(59, 130, 246, 0.3);
  --button-bg: rgba(59, 130, 246, 0.2);
  --button-bg-hover: rgba(59, 130, 246, 0.4);
  --button-border: rgba(59, 130, 246, 0.4);
  --button-border-hover: rgba(59, 130, 246, 0.6);
  --button-text: #60a5fa;
  --button-text-hover: #ffffff;
  --globe-gradient-1: #3b82f6;
  --globe-gradient-2: #8b5cf6;
  --ring-color: rgba(59, 130, 246, 0.3);
}

html.light-mode,
body.light-mode {
  --bg-primary: linear-gradient(to bottom, #f8fafc 0%, #e2e8f0 100%);
  --bg-gradient-1: rgba(59, 130, 246, 0.05);
  --bg-gradient-2: rgba(139, 92, 246, 0.05);
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent-color: #2563eb;
  --accent-color-rgb: 37, 99, 235;
  --dot-color: rgba(100, 116, 139, 0.15);
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-bg-hover: rgba(255, 255, 255, 1);
  --card-border: rgba(0, 0, 0, 0.08);
  --card-border-hover: rgba(37, 99, 235, 0.4);
  --card-shadow: rgba(0, 0, 0, 0.1);
  --button-bg: rgba(37, 99, 235, 0.1);
  --button-bg-hover: rgba(37, 99, 235, 0.2);
  --button-border: rgba(37, 99, 235, 0.3);
  --button-border-hover: rgba(37, 99, 235, 0.5);
  --button-text: #2563eb;
  --button-text-hover: #1e40af;
  --globe-gradient-1: #1e3a8a;
  --globe-gradient-2: #581c87;
  --ring-color: rgba(59, 130, 246, 0.2);
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.map-background {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(circle at 20% 50%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, var(--bg-gradient-2) 0%, transparent 50%);
  z-index: 0;
}

.map-dots {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.3;
  animation: map-float 20s ease-in-out infinite;
}

@keyframes map-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -20px); }
}

/* ── Page layout ── */

.content {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 40px 24px 32px;
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* ── Game header ── */

.game-header {
  text-align: center;
  margin-bottom: 28px;
}

.game-icon-large {
  font-size: 48px;
  line-height: 1;
  display: block;
  text-align: center;
  margin: 0 auto 10px;
}

.game-title {
  display: block;
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 10px;
  background: linear-gradient(135deg, var(--globe-gradient-1) 0%, var(--globe-gradient-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.game-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin: 0;
}

/* ── Card grid ── */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  grid-auto-rows: 1fr;
  gap: 24px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* ── Diff cards ── */

.diff-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px 20px;
  text-decoration: none;
  color: var(--text-primary);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.diff-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(135deg,
    rgba(var(--accent-color-rgb), 0.15) 0%,
    rgba(var(--accent-color-rgb), 0.05) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.diff-card:hover {
  transform: translateY(-6px);
  border-color: var(--card-border-hover);
  box-shadow: 0 16px 48px var(--card-shadow);
}

.diff-card:hover::before {
  opacity: 1;
}

.diff-emoji {
  font-size: 44px;
  display: block;
  margin-bottom: 12px;
  line-height: 1;
}

.diff-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.diff-rounds {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.diff-play {
  display: inline-block;
  padding: 10px 24px;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 10px;
  color: var(--button-text);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}

.diff-card:hover .diff-play {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--button-text-hover);
}

/* ── Short viewport ── */

@media (min-width: 601px) and (max-height: 750px) {
  .content {
    padding: 24px 24px 20px;
  }

  .game-header {
    margin-bottom: 16px;
  }

  .game-icon-large {
    font-size: 36px;
    margin-bottom: 6px;
  }

  .card-grid {
    gap: 14px;
  }

  .diff-card {
    padding: 16px 18px;
  }

  .diff-rounds {
    margin-bottom: 4px;
  }
}

/* ── Mobile ── */

@media (max-width: 600px) {
  .content {
    padding: 24px 14px 24px;
  }

  .game-header {
    margin-bottom: 20px;
  }

  .game-icon-large {
    font-size: 36px;
  }

  .game-title {
    font-size: 22px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 100%;
  }

  .diff-card {
    padding: 14px 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    max-height: none;
    border-radius: 16px;
  }

  .diff-emoji {
    font-size: 24px;
    margin: 0;
    flex-shrink: 0;
  }

  .diff-info {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1px 10px;
    align-items: start;
  }

  .diff-name {
    grid-column: 1;
    grid-row: 1;
    font-size: 15px;
    margin-bottom: 0;
  }

  .diff-rounds {
    grid-column: 1;
    grid-row: 2;
    font-size: 12px;
    margin-bottom: 0;
  }

  .diff-play {
    grid-column: 1 / 3;
    grid-row: 3;
    margin: 8px 0 0;
    justify-self: start;
  }
}
