:root {
  --bg: #f3efe6;
  --panel: #fffaf0;
  --panel-2: #f4e6bd;
  --gold: #d6b448;
  --gold-hover: #c79f28;
  --brown: #9a6b46;
  --brown-dark: #50321d;
  --ink: #1f1710;
  --muted: rgba(31, 23, 16, 0.72);
  --line: rgba(90, 61, 36, 0.18);
  --shadow: rgba(80, 50, 20, 0.15);
}

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

body {
  background:
    linear-gradient(180deg, rgba(244, 230, 189, 0.45), transparent 320px),
    var(--bg);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: var(--panel);
  border-bottom: 2px solid var(--brown);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  flex-wrap: wrap;
}

.site-header h1 {
  font-size: 2rem;
  color: var(--ink);
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1 1 700px;
}

.home-btn,
.country-search button,
.clear-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--ink);
  text-decoration: none;
  font-weight: bold;
  padding: 12px 18px;
  border: 2px solid var(--brown);
  border-radius: 10px;
  transition: 0.2s ease;
  box-shadow: 0 2px 6px var(--shadow);
  white-space: nowrap;
  font-family: inherit;
  font-size: 1rem;
  cursor: pointer;
}

.home-btn:hover,
.country-search button:hover,
.clear-search:hover {
  background: var(--gold-hover);
  transform: translateY(-1px);
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  background: var(--panel);
  border: 2px solid var(--brown);
  border-radius: 10px;
  box-shadow: 0 8px 18px var(--shadow);
  padding: 10px;
  z-index: 1000;
}

.dropdown-content a {
  display: block;
  width: 100%;
  margin-bottom: 8px;
}

.dropdown-content a:last-child {
  margin-bottom: 0;
}

.country-page {
  width: min(1320px, 92%);
  margin: 30px auto 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}

.country-hero {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  border-radius: 18px;
  border: 2px solid var(--brown);
  box-shadow: 0 14px 34px var(--shadow);
  background:
    linear-gradient(rgba(55, 37, 24, 0.72), rgba(55, 37, 24, 0.72)),
    url("https://images.unsplash.com/photo-1524661135-423995f22d0b?auto=format&fit=crop&w=1800&q=80");
  background-position: center;
  background-size: cover;
  display: flex;
  align-items: flex-end;
  padding: 38px;
}

.country-hero-content {
  max-width: 860px;
  color: #fff7ea;
}

.country-kicker {
  display: inline-block;
  margin-bottom: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.16);
  border: 1px solid rgba(255, 247, 234, 0.32);
  font-size: 0.95rem;
  font-weight: bold;
}

.country-hero h2 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.08;
  margin-bottom: 12px;
}

.country-hero p {
  font-size: 1.1rem;
  line-height: 1.6;
  color: rgba(255, 247, 234, 0.92);
}

.country-panel {
  background: var(--panel);
  border: 2px solid var(--brown);
  border-radius: 14px;
  box-shadow: 0 10px 22px var(--shadow);
  overflow: hidden;
}

.country-panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(244, 230, 189, 0.85), rgba(255, 250, 240, 0.95));
}

.country-panel-header h3,
.warning-panel h3,
.empty-panel h3 {
  color: var(--brown-dark);
  font-size: 1.75rem;
  margin-bottom: 6px;
}

.country-panel-header p,
.warning-panel p,
.empty-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.country-count {
  font-weight: bold;
  color: var(--brown-dark);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
}

.country-search {
  padding: 22px 24px 24px;
}

.country-search label {
  display: block;
  color: var(--brown-dark);
  font-weight: bold;
  margin-bottom: 10px;
}

.country-search-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.country-search input {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--brown);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  padding: 0 14px;
}

.clear-search {
  background: #ffffff;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.country-card {
  background: var(--panel);
  border: 2px solid var(--brown);
  border-radius: 14px;
  box-shadow: 0 8px 18px var(--shadow);
  overflow: hidden;
}

.country-card-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.country-id {
  display: inline-block;
  color: var(--brown-dark);
  font-weight: bold;
  margin-bottom: 8px;
}

.country-card h3 {
  color: var(--brown-dark);
  font-size: 1.65rem;
  line-height: 1.2;
}

.country-styles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.country-styles div {
  background: #fffdf8;
  padding: 14px;
  min-width: 0;
}

.country-styles span {
  display: block;
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.country-styles strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.historical-block {
  padding: 18px 20px 20px;
}

.historical-block h4 {
  color: var(--brown-dark);
  font-size: 1.1rem;
  margin-bottom: 10px;
}

.historical-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.historical-list span {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--brown-dark);
  font-weight: bold;
  padding: 7px 10px;
  line-height: 1.25;
}

.warning-panel,
.empty-panel {
  padding: 24px;
}

.technical-note {
  margin-top: 12px;
  padding: 12px;
  background: #fff5f2;
  border: 1px solid rgba(150, 45, 25, 0.25);
  border-radius: 10px;
  color: #7a2718;
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.site-footer {
  background: var(--panel);
  border-top: 2px solid var(--brown);
  text-align: center;
  padding: 18px;
  font-size: 1rem;
  color: var(--brown-dark);
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .country-panel-header,
  .country-search-row {
    grid-template-columns: 1fr;
  }

  .country-search-row {
    flex-direction: column;
  }

  .country-count {
    width: fit-content;
  }
}

@media (max-width: 640px) {
  .site-header h1 {
    font-size: 1.7rem;
  }

  .home-btn,
  .country-search button,
  .clear-search {
    width: 100%;
  }

  .dropdown {
    width: 100%;
  }

  .dropdown-content {
    width: 100%;
  }

  .country-page {
    width: min(94%, 1320px);
    margin: 20px auto 36px;
  }

  .country-hero {
    min-height: 230px;
    padding: 26px;
  }

  .country-hero h2 {
    font-size: 2rem;
  }

  .country-grid {
    grid-template-columns: 1fr;
  }

  .country-styles {
    grid-template-columns: 1fr;
  }
}

/* Desert page theme - local to this page/section */
:root {
  --bg: #f3efe6;
  --panel: #fffaf0;
  --panel-2: #f4e6bd;
  --gold: #d6b448;
  --gold-hover: #c79f28;
  --brown: #9a6b46;
  --brown-dark: #50321d;
  --ink: #1f1710;
  --text: #1f1710;
  --muted: rgba(31, 23, 16, 0.72);
  --line: rgba(90, 61, 36, 0.18);
  --shadow: rgba(80, 50, 20, 0.15);
  --hero-image: url("https://images.unsplash.com/photo-1524661135-423995f22d0b?auto=format&fit=crop&w=1800&q=80");
}

body {
  background:
    linear-gradient(180deg, rgba(244, 230, 189, 0.45), transparent 320px),
    var(--bg) !important;
  color: var(--ink) !important;
  font-family: Georgia, "Times New Roman", serif !important;
  min-height: 100vh;
}

body, button, input, select, textarea {
  font-family: Georgia, "Times New Roman", serif !important;
}

header,
.site-header,
.container > header {
  background: var(--panel) !important;
  border-bottom: 2px solid var(--brown) !important;
  color: var(--ink) !important;
  box-shadow: 0 4px 14px var(--shadow);
}

header h1,
header h2,
.site-header h1 {
  color: var(--ink) !important;
}

.header-right,
header nav,
.toolbar {
  gap: 12px;
  flex-wrap: wrap;
}

.home-btn,
header nav a,
.play-btn,
.primary-button,
.logout-button,
.nav-mois a,
.clear-search,
button,
input[type="submit"],
input[type="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold) !important;
  color: var(--ink) !important;
  border: 2px solid var(--brown) !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 6px var(--shadow);
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.home-btn:hover,
header nav a:hover,
.play-btn:hover,
.primary-button:hover,
.logout-button:hover,
.nav-mois a:hover,
.clear-search:hover,
button:hover,
input[type="submit"]:hover,
input[type="button"]:hover {
  background: var(--gold-hover) !important;
  transform: translateY(-1px);
}

.dropdown {
  position: relative;
}

.dropdown-content {
  background: var(--panel) !important;
  border: 2px solid var(--brown) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 18px var(--shadow);
  padding: 10px;
  z-index: 1000;
}

.page-info-box,
.country-hero,
.command-hero,
.forum-hero,
.hero {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  border: 2px solid var(--brown) !important;
  border-radius: 18px !important;
  box-shadow: 0 14px 34px var(--shadow);
  background:
    linear-gradient(rgba(55, 37, 24, 0.72), rgba(55, 37, 24, 0.72)),
    var(--hero-image) !important;
  background-position: center !important;
  background-size: cover !important;
  color: #fff7ea !important;
  display: flex;
  align-items: flex-end;
  padding: 36px;
}

.page-info-box,
.hero {
  width: min(1320px, 92%);
  margin: 30px auto 24px;
}

.page-info-box {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
}

.page-info-box span,
.country-kicker,
.command-kicker,
.forum-kicker {
  display: inline-block;
  margin-bottom: 12px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 247, 234, 0.32);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.16);
  color: #fff7ea !important;
  font-size: 0.95rem;
  font-weight: 700;
}

.page-info-box h2,
.country-hero h2,
.command-hero h2,
.forum-hero h2,
.hero h2 {
  color: #fff7ea !important;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.08;
  margin: 0 0 12px;
}

.page-info-box p,
.country-hero p,
.command-hero p,
.forum-hero p,
.hero p {
  max-width: 860px;
  color: rgba(255, 247, 234, 0.92) !important;
  font-size: 1.08rem;
  line-height: 1.6;
  margin: 0;
}

.games-intro,
.section,
.content,
.categories,
.panel,
.section-panel,
.forum-panel,
.command-panel,
.country-panel,
.game-card,
.news-card,
.summary-item,
.box,
.modal-box,
.container,
.card,
article.game-card,
article.news-card {
  background: var(--panel) !important;
  border-color: var(--brown) !important;
  color: var(--ink) !important;
  box-shadow: 0 8px 18px var(--shadow);
}

.games-intro,
.section,
.content,
.categories,
.panel,
.forum-panel,
.command-panel,
.country-panel,
.game-card,
.news-card,
.summary-item,
.box,
.modal-box,
.container,
.card {
  border: 2px solid var(--brown);
  border-radius: 14px;
}

h1, h2, h3, h4,
.section-title {
  color: var(--brown-dark) !important;
}

p,
.muted,
.label,
.forum-row-text p {
  color: var(--muted) !important;
}

input,
select,
textarea {
  background: #fffdf8 !important;
  color: var(--ink) !important;
  border: 2px solid var(--brown) !important;
  border-radius: 10px !important;
}

table {
  background: var(--panel) !important;
  border: 2px solid var(--brown);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 18px var(--shadow);
}

th {
  background: var(--panel-2) !important;
  color: var(--brown-dark) !important;
}

td {
  background: #fffdf8 !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

.tags span,
.forum-meta,
.status,
.country-count,
.command-count,
.command-list span,
.historical-list span {
  background: #fffdf8 !important;
  border: 1px solid var(--line) !important;
  color: var(--brown-dark) !important;
}

footer,
.site-footer,
.footer {
  background: var(--panel) !important;
  border-top: 2px solid var(--brown) !important;
  color: var(--brown-dark) !important;
}

@media (max-width: 760px) {
  .page-info-box,
  .hero {
    width: min(94%, 1320px);
    min-height: 210px;
    padding: 26px;
  }

  .country-hero,
  .command-hero,
  .forum-hero {
    min-height: 210px;
    padding: 26px;
  }

  .page-info-box h2,
  .country-hero h2,
  .command-hero h2,
  .forum-hero h2,
  .hero h2 {
    font-size: 2rem;
  }
}

/* Desert local category/navigation controls */
.categories a,
.category-btn,
.sidebar a,
aside a,
.tab,
.tabs a,
.tabs button,
.filter-btn,
.menu-btn,
.ghost-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  background: var(--gold) !important;
  color: var(--ink) !important;
  border: 2px solid var(--brown) !important;
  border-radius: 10px !important;
  box-shadow: 0 2px 6px var(--shadow);
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.2s ease, transform 0.2s ease;
}

.categories a:hover,
.category-btn:hover,
.sidebar a:hover,
aside a:hover,
.tab:hover,
.tabs a:hover,
.tabs button:hover,
.filter-btn:hover,
.menu-btn:hover,
.ghost-button:hover,
.categories a.active,
.category-btn.active,
.tab.active,
.tabs .active {
  background: var(--gold-hover) !important;
  color: var(--ink) !important;
  transform: translateY(-1px);
}

/* Desert local page flow */
body {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  height: auto !important;
}

body > .container,
body > .box {
  align-self: center;
  margin-bottom: 36px;
}

/* Desert layout repair - larger navigation and stable page widths */
header,
.site-header,
.container > header {
  min-height: 76px;
  padding: 18px 32px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 24px !important;
  flex-wrap: wrap !important;
}

header h1,
.site-header h1 {
  font-size: clamp(1.9rem, 2.2vw, 2.6rem) !important;
  line-height: 1.1 !important;
}

header nav,
.header-right,
.toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
  flex: 1 1 760px;
}

.home-btn,
header nav a,
.play-btn,
.primary-button,
.logout-button,
.nav-mois a,
.clear-search,
button,
input[type="submit"],
input[type="button"] {
  min-height: 44px !important;
  padding: 12px 18px !important;
  font-size: 1rem !important;
  line-height: 1.12 !important;
  margin-left: 0 !important;
}

.dropdown-content a {
  width: 100% !important;
  margin: 0 0 8px !important;
}

.page-info-box,
.country-hero,
.command-hero,
.forum-hero,
.hero {
  width: min(1500px, calc(100% - 96px)) !important;
  max-width: 1500px !important;
  min-height: 280px !important;
  margin: 32px auto !important;
}

.games-page,
.section,
.games-intro,
.wiki-container,
.forum-page,
.command-page,
.country-page {
  width: min(1500px, calc(100% - 96px)) !important;
  max-width: 1500px !important;
  margin-left: auto !important;
  margin-right: auto !important;
}

.section,
.games-intro {
  padding: 34px !important;
  margin-bottom: 30px !important;
}

.discover-section {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 28px !important;
}

.discover-text {
  flex: 1 1 420px !important;
  min-width: 280px !important;
}

.discover-img {
  flex: 0 1 380px !important;
  min-width: 260px !important;
}

.news-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 24px !important;
  width: 100% !important;
}

.news-card {
  width: auto !important;
  max-width: none !important;
}

.wiki-container {
  display: grid !important;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr) !important;
  gap: 32px !important;
  align-items: start !important;
  padding: 0 !important;
}

.categories {
  width: auto !important;
  margin-right: 0 !important;
  padding: 18px !important;
}

.categories a,
.category-btn,
.sidebar a,
aside a,
.tab,
.tabs a,
.tabs button,
.filter-btn,
.menu-btn,
.ghost-button {
  min-height: 50px !important;
  padding: 14px 16px !important;
  font-size: 1.05rem !important;
  line-height: 1.15 !important;
  width: 100% !important;
}

.content {
  max-height: none !important;
  min-height: 520px;
  padding: 24px !important;
}

@media (max-width: 980px) {
  header nav,
  .header-right,
  .toolbar {
    justify-content: flex-start !important;
    flex-basis: 100%;
  }

  .page-info-box,
  .country-hero,
  .command-hero,
  .forum-hero,
  .hero,
  .games-page,
  .section,
  .games-intro,
  .wiki-container,
  .forum-page,
  .command-page,
  .country-page {
    width: min(94%, 1500px) !important;
  }

  .wiki-container {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  header,
  .site-header,
  .container > header {
    padding: 16px 20px !important;
  }

  .home-btn,
  header nav a,
  .play-btn,
  .primary-button,
  .logout-button,
  .nav-mois a,
  .clear-search,
  button,
  input[type="submit"],
  input[type="button"] {
    width: 100% !important;
  }
}

/* Desert sizing guard */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Desert root background fix */
html {
  background: var(--bg) !important;
  min-height: 100% !important;
  height: auto !important;
}

body {
  background:
    linear-gradient(180deg, rgba(244, 230, 189, 0.45), transparent 320px),
    var(--bg) !important;
  min-height: 100vh !important;
  height: auto !important;
}