/* =============================================================================
   CyenlaceX — "Quartermaster's War Tent" theme
   A besieging tribe's supply depot: charred oak at night, parchment requisition
   forms, iron trim, and wax-seal stamps for every badge & confirmation.
   ============================================================================= */

:root {
  /* Palette — wood/parchment/red-gold tones lifted from the real game's own
     stylesheet (game.css), reimplemented here as plain CSS, not their assets. */
  --ink-tent: #1c130c;        /* charred oak — page backdrop */
  --ink-tent-raised: #271b11; /* panels sitting slightly above the backdrop */
  --wood: #6c4824;            /* authentic TW wood-brown — beams, dividers, buttons */
  --wood-mid: #7b5c3d;        /* gradient midpoint for wood buttons */
  --wood-light: #947a62;      /* gradient highlight for wood buttons */
  --parchment: #f4e4bc;       /* authentic TW parchment cream — cards, crates */
  --parchment-light: #fff8e6; /* bevel highlight edge */
  --parchment-dark: #c9af7a;  /* parchment shadow/border */
  --parchment-ink: #2b1d10;   /* text on parchment */
  --ember: #b5482a;           /* signature accent — hot iron / wax seal */
  --ember-light: #d8663f;
  --crimson: #a90329;         /* authentic TW alert red — used sparingly */
  --moss: #4b5e3a;            /* secondary accent — tribe banner green */
  --moss-light: #6c8552;
  --confirm-green: #0bac00;   /* authentic TW "confirm" gradient start */
  --confirm-green-dark: #0e7a1e;
  --iron: #8b8578;            /* muted stone/steel — secondary text on dark */
  --iron-light: #b3ac9c;
  --gold: #c9a227;            /* coin / price highlight */
  --gold-light: #e5c27e;
  --blood: #7a2018;           /* danger / cancelled */
  --shadow-deep: rgba(10, 6, 3, 0.65);

  /* Type */
  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-banner: 'Sancreek', var(--font-display);   /* carved-wood signage — wordmark, hero */
  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --radius-crate: 4px;
  --ease-stamp: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at top, rgba(255, 180, 110, 0.06), transparent 60%),
    var(--ink-tent);
  background-attachment: fixed;
  color: var(--iron-light);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Subtle grain overlay so flat wood/parchment fields don't look like clean vectors */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  color: var(--parchment);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 0.5em;
}

a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold); }

::selection { background: var(--ember); color: var(--parchment); }

:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 3px;
  border-radius: 2px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--moss-light);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =============================================================================
   Wood-beam divider — replaces the generic hairline rule
   ============================================================================= */
.wood-divider {
  height: 14px;
  background: repeating-linear-gradient(
    90deg, var(--wood) 0, var(--wood-light) 2px, var(--wood) 4px, var(--wood) 22px
  );
  border-top: 2px solid rgba(0,0,0,0.4);
  border-bottom: 2px solid rgba(255,255,255,0.06);
  box-shadow: 0 6px 14px var(--shadow-deep);
}

/* =============================================================================
   Header / nav — hung like a beam across the tent entrance
   ============================================================================= */
.site-header {
  background: linear-gradient(180deg, var(--wood-light) 0%, var(--wood-mid) 22%, var(--wood) 55%, var(--wood) 100%);
  border-bottom: 4px solid var(--ink-tent);
  box-shadow: 0 8px 24px var(--shadow-deep);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.wordmark {
  font-family: var(--font-banner);
  font-weight: 400;
  letter-spacing: 0.03em;
  font-size: 1.7rem;
  color: var(--parchment-light);
  text-shadow: 0 2px 0 rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.wordmark .glyph { color: var(--gold-light); font-size: 1.3rem; }

.nav-signs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-signs a {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--parchment);
  background: linear-gradient(180deg, var(--parchment) 0%, var(--parchment-dark) 100%);
  padding: 8px 14px;
  border-radius: var(--radius-crate);
  box-shadow: 0 3px 0 #5c4423, 0 5px 8px var(--shadow-deep);
  color: var(--parchment-ink);
  transition: transform 0.12s ease;
}
.nav-signs a:hover { transform: translateY(-2px); color: var(--ember); }
.nav-signs a.active { background: linear-gradient(180deg, var(--gold-light), var(--gold)); }

.currency-toggle {
  display: inline-flex;
  background: var(--ink-tent-raised);
  border: 1px solid var(--wood-light);
  border-radius: var(--radius-crate);
  padding: 3px;
  gap: 2px;
}
.currency-toggle .curr-btn {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  border: none;
  background: transparent;
  color: var(--iron-light);
  padding: 6px 12px;
  border-radius: 2px;
  cursor: pointer;
}
.currency-toggle .curr-btn:hover { color: var(--parchment); }
.currency-toggle .curr-btn.active {
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  color: var(--parchment-ink);
}

.fx-note {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--iron);
  padding-bottom: 8px;
  letter-spacing: 0.02em;
}

.cart-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--parchment);
  background: var(--ink-tent-raised);
  border: 1px solid var(--wood-light);
  padding: 8px 14px;
  border-radius: var(--radius-crate);
  cursor: pointer;
}
.cart-badge .count {
  background: var(--ember);
  color: var(--parchment);
  border-radius: 50%;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
}

/* =============================================================================
   Hero banner — carved stone tribute slab
   ============================================================================= */
.hero {
  position: relative;
  padding: 72px 0 56px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 100% at 50% 0%, rgba(181, 72, 42, 0.16), transparent 70%),
    var(--ink-tent);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  overflow: hidden;
}
.hero h1 {
  font-family: var(--font-banner);
  font-weight: 400;
  font-size: clamp(2.1rem, 5.5vw, 3.8rem);
  text-shadow: 0 3px 0 rgba(0,0,0,0.5), 0 0 40px rgba(201,162,39,0.15);
  max-width: 820px;
  margin-inline: auto;
}
.hero p {
  max-width: 560px;
  margin: 14px auto 30px;
  color: var(--iron-light);
  font-size: 1.05rem;
}
.hero .torches { font-size: 1.4rem; opacity: 0.85; letter-spacing: 0.4em; }

/* =============================================================================
   Buttons — beveled plaques, stamped on press
   ============================================================================= */
.btn {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  padding: 13px 26px;
  border-radius: var(--radius-crate);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn:active { transform: translateY(2px); }

.btn-primary {
  color: var(--parchment);
  background: linear-gradient(180deg, var(--ember-light), var(--ember) 60%, #8a3620 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), inset 0 -3px 0 rgba(0,0,0,0.3), 0 6px 14px var(--shadow-deep);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-secondary {
  color: var(--parchment-ink);
  background: linear-gradient(180deg, var(--parchment), var(--parchment-dark));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), inset 0 -3px 0 rgba(0,0,0,0.15), 0 6px 14px var(--shadow-deep);
}
.btn-secondary:hover { filter: brightness(1.05); }

.btn-ghost {
  color: var(--parchment);
  background: transparent;
  border: 1px solid var(--wood-light);
}
.btn-ghost:hover { border-color: var(--gold-light); color: var(--gold-light); }

.btn-danger {
  color: var(--parchment);
  background: linear-gradient(180deg, #9c3226, var(--blood));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 4px 10px var(--shadow-deep);
}

/* Authentic in-game "confirm" gradient — used for the final commit step of a
   purchase (paying/sealing an order), where green reads as "go" more clearly
   than our ember brand color. */
.btn-confirm {
  color: #fff;
  background: linear-gradient(180deg, var(--confirm-green) 0%, var(--confirm-green-dark) 100%);
  border: 1px solid #006712;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 6px 14px var(--shadow-deep);
}
.btn-confirm:hover { filter: brightness(1.08); }

.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* =============================================================================
   Wax seal — the signature element. Used for badges & confirmations.
   ============================================================================= */
.wax-seal {
  --seal-color: var(--ember);
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--ember-light), var(--seal-color) 55%, #7a2c18 100%);
  box-shadow: 0 4px 10px var(--shadow-deep), inset 0 -4px 8px rgba(0,0,0,0.35), inset 0 3px 4px rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--parchment);
  font-family: var(--font-display);
  font-size: 0.68rem;
  text-align: center;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  filter: drop-shadow(0 0 0 transparent);
}
.wax-seal::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px dashed rgba(0,0,0,0.18);
  opacity: 0.5;
}
.wax-seal.seal-gold { --seal-color: var(--gold); background: radial-gradient(circle at 32% 28%, var(--gold-light), var(--gold) 55%, #8a6e18 100%); color: var(--parchment-ink); }
.wax-seal.seal-moss { --seal-color: var(--moss); background: radial-gradient(circle at 32% 28%, var(--moss-light), var(--moss) 55%, #2e3b23 100%); }
.wax-seal.seal-sm { width: 40px; height: 40px; font-size: 0.55rem; }

.wax-seal.stamping {
  animation: stampDown 0.4s var(--ease-stamp);
}
@keyframes stampDown {
  0% { transform: scale(2.2) rotate(-14deg); opacity: 0; }
  60% { transform: scale(0.92) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(-6deg); }
}

/* Corner badge wrapper positions a seal over a crate/card */
.seal-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  z-index: 3;
  transform: rotate(-8deg);
}

/* =============================================================================
   Crates — product cards, styled as sealed supply crates
   ============================================================================= */
.crate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}

.crate {
  position: relative;
  background: linear-gradient(180deg, var(--parchment) 0%, #e6cd97 100%);
  border-radius: var(--radius-crate);
  /* Authentic TW "beveled box" trick: a different shade per side fakes a carved edge */
  border: 2px solid;
  border-color: var(--parchment-light) var(--parchment-dark) #a9803f var(--parchment-dark);
  box-shadow: 0 2px 0 var(--parchment-dark), 0 12px 20px var(--shadow-deep);
  color: var(--parchment-ink);
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.crate:hover {
  transform: translateY(-5px);
  box-shadow: 0 2px 0 var(--parchment-dark), 0 20px 28px var(--shadow-deep);
}

.crate-icon {
  height: 108px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, #f1e2bb, #d9c193);
  border-bottom: 1px dashed rgba(0,0,0,0.2);
  border-radius: var(--radius-crate) var(--radius-crate) 0 0;
}
.crate-icon svg { width: 48px; height: 48px; }

.crate-body {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.crate-category {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--moss);
}
.crate-title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  color: var(--parchment-ink);
  margin: 0;
  line-height: 1.25;
}
.crate-desc {
  font-size: 0.85rem;
  color: #5a4a30;
  flex: 1;
  margin: 0;
}
.crate-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 4px;
}
.crate-price {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ember);
}
.crate-price .compare {
  font-size: 0.78rem;
  color: #8a7a55;
  text-decoration: line-through;
  margin-right: 6px;
  font-weight: 400;
}
.crate .btn { margin-top: 10px; }

/* =============================================================================
   Panels — flat parchment surfaces for sections, forms, tables
   ============================================================================= */
.panel {
  background: var(--ink-tent-raised);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-crate);
  box-shadow: 0 10px 24px var(--shadow-deep);
}
.panel-parchment {
  background: linear-gradient(180deg, var(--parchment), #e6cd97);
  color: var(--parchment-ink);
  border-radius: var(--radius-crate);
  box-shadow: 0 10px 24px var(--shadow-deep);
}

/* Ornate double-ring frame — CSS re-creation of the game's gold/red border
   frames (border-image assets we won't hotlink), for the one or two most
   important panels on a page. Use sparingly. */
.ornate-frame {
  box-shadow:
    0 0 0 2px var(--crimson),
    0 0 0 5px var(--gold),
    0 0 0 6px rgba(0,0,0,0.35),
    0 10px 24px var(--shadow-deep);
}

.section { padding: 56px 0; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--parchment);
  text-align: center;
  margin-bottom: 8px;
}
.section-sub {
  text-align: center;
  color: var(--iron);
  margin-bottom: 34px;
  font-size: 0.95rem;
}

/* Hanging category signs */
.sign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}
.sign {
  background: linear-gradient(180deg, var(--wood-light), var(--wood));
  border: 1px solid rgba(0,0,0,0.4);
  border-radius: var(--radius-crate);
  padding: 22px 18px;
  text-align: center;
  box-shadow: 0 3px 0 #1c1108, 0 10px 18px var(--shadow-deep);
  position: relative;
  color: var(--parchment);
  transition: transform 0.15s ease;
}
.sign::before {
  content: '';
  position: absolute;
  top: -8px; left: 50%;
  transform: translateX(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #cfc9bd, #6b6558);
  box-shadow: 0 2px 4px var(--shadow-deep);
}
.sign:hover { transform: translateY(-4px) rotate(-0.6deg); }
.sign .icon { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--gold-light); }
.sign .name { font-family: var(--font-display); font-size: 1.05rem; }
.sign .count { font-family: var(--font-mono); font-size: 0.72rem; color: var(--iron); margin-top: 4px; }

/* =============================================================================
   Badges / status pills
   ============================================================================= */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.pill-pending { background: rgba(201,162,39,0.15); color: var(--gold-light); border-color: rgba(201,162,39,0.35); }
.pill-in_progress, .pill-paid { background: rgba(75,94,58,0.25); color: var(--moss-light); border-color: rgba(108,133,82,0.4); }
.pill-completed { background: rgba(75,94,58,0.35); color: #a7c98c; border-color: var(--moss); }
.pill-cancelled, .pill-failed { background: rgba(122,32,24,0.25); color: #e28377; border-color: rgba(122,32,24,0.5); }
.pill-refunded { background: rgba(139,133,120,0.2); color: var(--iron-light); border-color: var(--iron); }

/* =============================================================================
   Forms
   ============================================================================= */
label { display: block; font-size: 0.82rem; color: var(--iron-light); margin-bottom: 6px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.92rem;
  padding: 10px 12px;
  border-radius: var(--radius-crate);
  border: 1px solid var(--wood-light);
  background: var(--ink-tent);
  color: var(--parchment);
}
input::placeholder, textarea::placeholder { color: var(--iron); }
input:focus, select:focus, textarea:focus { border-color: var(--gold-light); }
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* =============================================================================
   Tables (admin ledger)
   ============================================================================= */
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-light);
  border-bottom: 2px solid var(--wood-light);
  padding: 10px 12px;
  white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); color: var(--iron-light); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
td.num, th.num { font-family: var(--font-mono); text-align: right; }

/* =============================================================================
   Utility
   ============================================================================= */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.muted { color: var(--iron); }
.text-gold { color: var(--gold-light); }
.text-ember { color: var(--ember-light); }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }
.mt-8{margin-top:8px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}.mb-8{margin-bottom:8px}.mb-16{margin-bottom:16px}

/* Toast */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--wood);
  color: var(--parchment);
  border: 1px solid var(--wood-light);
  border-left: 4px solid var(--gold);
  padding: 12px 16px;
  border-radius: var(--radius-crate);
  box-shadow: 0 10px 24px var(--shadow-deep);
  font-size: 0.88rem;
  animation: toastIn 0.25s ease;
  max-width: 320px;
}
.toast.error { border-left-color: var(--blood); }
@keyframes toastIn { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Footer */
.site-footer {
  background: var(--wood);
  border-top: 4px solid var(--ink-tent);
  padding: 40px 0 30px;
  margin-top: 60px;
  color: var(--iron-light);
  font-size: 0.86rem;
}
.site-footer a { color: var(--parchment); }

@media (max-width: 720px) {
  .site-header .container { flex-wrap: wrap; }
  .nav-signs { order: 3; width: 100%; justify-content: center; }
  .field-row { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 40px; }
}
