:root {
  --bg: #ffffff;
  --fg: #1a1d21;
  --muted: #5b6470;
  --border: #d8dde3;
  --surface: #f6f7f9;
  --accent: #1f6f5c;
  --accent-contrast: #ffffff;
  --warn-bg: #fff6e5;
  --warn-border: #e8c27a;
  --footer-h: 46px;
  --footer-bg: #0b1220;
  --footer-fg: rgba(199, 214, 230, 0.85);
  --footer-border: rgba(255, 255, 255, 0.08);
  --footer-link-hover: #7aa7ff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --fg: #e8eaed;
    --muted: #9aa4af;
    --border: #2c3136;
    --surface: #1b1f23;
    --accent: #4fbf9f;
    --accent-contrast: #0b1210;
    --warn-bg: #2a2416;
    --warn-border: #7a611f;
  }
}

/* Explicit toggle (data-theme) always wins over the system preference. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --fg: #1a1d21;
  --muted: #5b6470;
  --border: #d8dde3;
  --surface: #f6f7f9;
  --accent: #1f6f5c;
  --accent-contrast: #ffffff;
  --warn-bg: #fff6e5;
  --warn-border: #e8c27a;
}

:root[data-theme="dark"] {
  --bg: #14171a;
  --fg: #e8eaed;
  --muted: #9aa4af;
  --border: #2c3136;
  --surface: #1b1f23;
  --accent: #4fbf9f;
  --accent-contrast: #0b1210;
  --warn-bg: #2a2416;
  --warn-border: #7a611f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  padding-bottom: calc(var(--footer-h) + 0.5rem);
}

/* ---------- Header: logo + brand + language/theme controls ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  color: var(--fg);
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.25;
}
.brand-sub.tagline {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.2;
}

.header-controls { display: flex; gap: 0.4rem; flex: 0 0 auto; }

.control-button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg);
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 2.4rem;
}
.control-button:hover { border-color: var(--accent); }

.tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.tab-button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-button.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

main { padding: 1.25rem; max-width: 960px; margin: 0 auto; }

.panel.is-hidden { display: none; }

.catalog-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

#search-input {
  flex: 1 1 240px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
}

.source-toggle {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.status-line { color: var(--muted); font-size: 0.9rem; min-height: 1.2em; }

.cart-toast {
  position: fixed;
  right: 1rem;
  bottom: calc(var(--footer-h) + 1rem);
  z-index: 90;
  max-width: min(28rem, calc(100vw - 2rem));
  padding: 0.7rem 1rem;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translateY(0.65rem);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.cart-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes cart-add-confirm {
  50% { transform: scale(1.06); }
}

.btn.is-added {
  animation: cart-add-confirm 0.32s ease-out;
}

.game-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.game-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.game-card-image {
  /* TGC's Game.advertisement shop-ad is authored at 216×150. */
  aspect-ratio: 216 / 150;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  margin-bottom: 0.2rem;
}
.game-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.game-card .name { font-weight: 600; }
.game-card .price { color: var(--muted); font-size: 0.9rem; }

.badge {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--fg);
  width: fit-content;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-secondary { background: var(--surface); color: var(--fg); border: 1px solid var(--border); }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.cart-toolbar { display: flex; justify-content: flex-end; gap: 0.5rem; align-items: center; margin-bottom: 1rem; }

#currency-select, #address-select {
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}

.cart-items { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  background: var(--surface);
}

.cart-item .qty-controls { display: flex; align-items: center; gap: 0.4rem; }
.cart-item input[type="number"] {
  width: 3.5rem;
  padding: 0.3rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}

.cart-summary {
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-bottom: 1rem;
}

.summary-line { display: flex; justify-content: space-between; margin-bottom: 0.3rem; }

/* The grand total is the answer the visitor came for -- set it apart from
   the lines that merely add up to it. */
.summary-line-grand {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  font-size: 1.1rem;
}

.quote-totals { margin-bottom: 1.25rem; }

.fine-print { color: var(--muted); font-size: 0.8rem; }

.footer-note { padding: 0 1.25rem; max-width: 960px; margin: 0 auto; }

.notice-box {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.notice-box p { margin: 0.2rem 0; }

.cart-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.5rem; }

.quote-panel {
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
}
.quote-panel.is-hidden { display: none; }
.quote-step.is-hidden { display: none; }

.shipping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.shipping-table th, .shipping-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ---------- Footer sticky (structure/palette reprises de galasoft.ca) ---------- */
.site-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: var(--footer-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  padding: 0 1.2rem;
  background: var(--footer-bg);
  border-top: 1px solid var(--footer-border);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.3);
  font-size: 0.74rem;
  color: var(--footer-fg);
}
.footer-copy { white-space: nowrap; }
.footer-legal { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.footer-legal a { color: var(--footer-fg); text-decoration: none; transition: color 0.15s; }
.footer-legal a:hover { color: var(--footer-link-hover); }
.footer-btc { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.footer-btc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--footer-fg);
}
.footer-btc-icon { font-size: 0.85rem; line-height: 1; }

/* ---------- Legal modals (Conditions / Confidentialité) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 1rem;
}
.modal-overlay.is-open { display: flex; }

.modal {
  position: relative;
  background: var(--bg);
  color: var(--fg);
  border-radius: 12px;
  border: 1px solid var(--border);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
}
.modal h2 { margin-top: 0; }
.modal h3 { font-size: 1rem; margin: 1.1rem 0 0.3rem; }
.modal p { margin: 0.3rem 0; }
.modal a { color: var(--accent); }

.modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.legal-meta { color: var(--muted); font-size: 0.8rem; }

.legal-callout {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
  .shipping-table { display: block; overflow-x: auto; }
  .site-footer { font-size: 0.68rem; justify-content: center; text-align: center; }
  .brand-sub.tagline { display: none; }
}

.method-choice { display: flex; align-items: center; gap: 0.45rem; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .cart-toast { transition: none; }
  .btn.is-added { animation: none; }
}
