/* Ancient Battle Arena - site styles. Palette follows the game UI: dark leather
   panels, bronze edges, parchment text. */
:root {
  --bg: #0f0d0b;
  --bg2: #17130f;
  --panel: #1e1913;
  --panel2: #261f17;
  --line: #3a2f22;
  --bronze: #b3955a;
  --gold: #ffe0a0;
  --text: #ece4d4;
  --muted: #a99c86;
  --blue: #3d5fe0;
  --red: #d2402c;
  --ok: #6fbf5f;
  --warn: #e6a23c;
  --err: #e0573f;
  --radius: 6px;
  --wrap: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: Georgia, "Palatino Linotype", serif; color: var(--gold); line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: .02em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .92em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

/* ---------------------------------------------------------------- Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15, 13, 11, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--gold); font-family: Georgia, serif; font-size: 1.15rem; font-weight: bold; }
.brand img { width: 30px; height: 30px; }
.brand:hover { text-decoration: none; }
.nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.link { color: var(--text); padding: 8px 10px; border-radius: var(--radius); }
.nav a:hover, .nav button.link:hover { background: var(--panel); text-decoration: none; }
.nav form { margin: 0; }

/* ---------------------------------------------------------------- Buttons + forms */
.btn, button {
  display: inline-block; cursor: pointer; font: inherit; font-weight: 600;
  padding: 10px 18px; border-radius: var(--radius);
  border: 1px solid var(--bronze); background: var(--panel2); color: var(--gold);
}
.btn:hover, button:hover { background: #33291e; text-decoration: none; }
.btn-primary { background: linear-gradient(#c9a865, #9c7e44); color: #1a140c; border-color: #e6c98a; }
.btn-primary:hover { background: linear-gradient(#d8b874, #ab8c50); }
.btn-danger { border-color: var(--err); color: #ffb4a6; }
.btn-small { padding: 5px 10px; font-size: .88rem; }
button.link { background: none; border: 0; font-weight: normal; padding: 0; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

form.stack { display: grid; gap: 14px; }
label { display: grid; gap: 5px; font-weight: 600; color: var(--gold); font-size: .95rem; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: normal; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--bg2);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--bronze); outline-offset: 0; }
textarea { min-height: 110px; resize: vertical; }
.hint { font-weight: normal; color: var(--muted); font-size: .85rem; }

/* ---------------------------------------------------------------- Panels + messages */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel + .panel { margin-top: 18px; }
.narrow { max-width: 460px; margin: 40px auto; }
.flash { padding: 12px 16px; border-radius: var(--radius); margin: 16px 0; border: 1px solid; }
.flash.success { border-color: var(--ok); background: #1b2717; }
.flash.error { border-color: var(--err); background: #2c1712; }
.flash.info { border-color: var(--bronze); background: #241d14; }
.errors { margin: 0; padding-left: 20px; }
.page { padding: 28px 0 60px; }

/* ---------------------------------------------------------------- Home */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(ellipse at 70% 30%, rgba(179, 149, 90, .22), transparent 60%),
    linear-gradient(180deg, #1a140e 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.hero .wrap { display: grid; grid-template-columns: 1.1fr .9fr; gap: 32px; align-items: center; padding-top: 70px; padding-bottom: 70px; }
.hero .tag { color: var(--bronze); text-transform: uppercase; letter-spacing: .18em; font-size: .8rem; font-weight: 700; }
.hero p.lead { font-size: 1.15rem; color: #d8ccb5; max-width: 36em; }
.hero-art { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.hero-art img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 6px; padding: 8px;
  background: radial-gradient(circle at 50% 60%, #4a3c2a, #221b13 70%); border: 1px solid var(--line); }
.release-note { font-size: .9rem; color: var(--muted); margin-top: 10px; }

section.block { padding: 64px 0; border-bottom: 1px solid var(--line); }
section.block:nth-of-type(even) { background: var(--bg2); }
.section-head { max-width: 46em; margin-bottom: 28px; }

.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.feature { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature h3 { display: flex; gap: 10px; align-items: center; }
.feature img { width: 26px; height: 26px; }
.feature p { color: #d0c4ae; margin: 0; font-size: .96rem; }

.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.unit { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.unit .pics { display: grid; grid-template-columns: 1fr 1fr; background: radial-gradient(circle at 50% 65%, #4a3c2a, #1e1913 75%); }
.unit .pics img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; padding: 6px; }
.unit .body { padding: 12px 14px; }
.unit h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.unit h3 img { width: 22px; height: 22px; }
.unit .role { color: var(--bronze); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.unit p { font-size: .92rem; color: #d0c4ae; margin: 6px 0 0; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.media-slot {
  aspect-ratio: 16 / 9; border: 2px dashed var(--line); border-radius: var(--radius);
  display: grid; place-items: center; color: var(--muted); text-align: center; padding: 16px; background: var(--panel);
}

.cta { text-align: center; }
.cta .btn-row { justify-content: center; margin-top: 18px; }

.site-footer { padding: 30px 0 40px; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Tables + admin */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--gold); font-weight: 600; white-space: nowrap; }
tr:hover td { background: rgba(255, 255, 255, .02); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .78rem; font-weight: 700; border: 1px solid var(--line); white-space: nowrap; }
.badge.ok { color: var(--ok); border-color: #3c6a33; }
.badge.warn { color: var(--warn); border-color: #7a5a24; }
.badge.err { color: var(--err); border-color: #7a3424; }
.badge.gold { color: var(--gold); border-color: var(--bronze); }

.admin { display: grid; grid-template-columns: 210px 1fr; gap: 24px; padding: 24px 0 60px; }
.admin-nav { display: grid; gap: 4px; align-content: start; position: sticky; top: 76px; }
.admin-nav a { padding: 9px 12px; border-radius: var(--radius); color: var(--text); }
.admin-nav a.active, .admin-nav a:hover { background: var(--panel); color: var(--gold); text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .n { font-size: 1.8rem; font-weight: 700; color: var(--gold); font-family: Georgia, serif; }
.stat .l { color: var(--muted); font-size: .85rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { width: auto; flex: 1 1 160px; }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.secret { background: #000; border: 1px solid var(--bronze); padding: 12px; border-radius: var(--radius); word-break: break-all; font-family: Consolas, monospace; }
details summary { cursor: pointer; color: var(--gold); font-weight: 600; }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; padding-top: 40px; padding-bottom: 40px; }
  .admin { grid-template-columns: 1fr; }
  .admin-nav { position: static; grid-auto-flow: column; overflow-x: auto; }
  .grid2 { grid-template-columns: 1fr; }
}
