/* Uncrowned Online's website (docs/WEBSITE.md). The game's own type (Cinzel for titles, Alegreya Sans for text) and
   colours: dark stone, iron and bronze, gold for what matters. One stylesheet for every page. */

@font-face { font-family: 'Cinzel'; src: url('../fonts/Cinzel-Variable.ttf') format('truetype'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('../fonts/AlegreyaSans-Medium.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url('../fonts/AlegreyaSans-Bold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }

:root {
  --bg: #121112;
  --bg-2: #1a1819;
  --panel: #1e1d1f;
  --panel-2: #262426;
  --line: #38383c;
  --line-soft: #2c2a2c;
  --text: #d8cfbf;
  --dim: #8a8174;
  --gold: #d2ae63;
  --gold-2: #f0d48c;
  --bronze: #70502e;
  --red: #c4453c;
  --green: #6fbf5a;
  --blue: #6c9be0;
  --elite: #c58bff;
  --boss: #e2683c;
  --warrior: #d26a4f;
  --ranger: #78b35a;
  --mage: #6f8fe0;
  --radius: 4px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --wrap: 1120px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 500px at 50% -120px, #2a2418 0%, rgba(42, 36, 24, 0) 70%), var(--bg);
  font: 500 17px/1.55 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); text-decoration: underline; }
h1, h2, h3 { font-family: 'Cinzel', Georgia, serif; font-weight: 600; letter-spacing: 0.02em; color: #efe4cf; text-wrap: balance; margin: 0 0 0.5em; line-height: 1.2; }
h1 { font-size: clamp(30px, 5vw, 52px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 19px; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.dim { color: var(--dim); }
.gold { color: var(--gold); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(18, 17, 18, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-soft);
}
.top .wrap { display: flex; align-items: center; gap: 22px; min-height: 64px; flex-wrap: wrap; }
.brand { font-family: 'Cinzel', serif; font-weight: 700; font-size: 20px; letter-spacing: 0.08em; color: var(--gold); white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; color: var(--gold-2); }
.brand .mark { width: 26px; height: 26px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--text); padding: 6px 10px; border-radius: var(--radius); font-weight: 600; }
.nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--gold-2); }
.nav a.on { color: var(--gold); background: var(--panel); box-shadow: inset 0 -2px 0 var(--gold); }
.online { font-size: 14px; color: var(--dim); white-space: nowrap; }
.online b { color: var(--green); font-weight: 700; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); margin-right: 6px; vertical-align: 1px; }

/* ------------------------------------------------------------------ buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 16px 'Alegreya Sans', sans-serif; letter-spacing: 0.02em;
  padding: 10px 20px; border-radius: var(--radius); cursor: pointer;
  color: #1b1408; background: linear-gradient(#f0d48c, #c89b48); border: 1px solid #f3dc9c;
  box-shadow: 0 2px 0 #6e5126, 0 6px 18px rgba(210, 174, 99, 0.18);
}
.btn:hover { text-decoration: none; color: #1b1408; filter: brightness(1.07); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #6e5126; }
.btn.ghost { color: var(--text); background: var(--panel); border-color: var(--line); box-shadow: none; }
.btn.ghost:hover { color: var(--gold-2); border-color: var(--bronze); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn[disabled] { opacity: 0.55; cursor: default; filter: none; }
input, select {
  font: 500 16px 'Alegreya Sans', sans-serif; color: var(--text);
  background: #151415; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; min-width: 0;
}
input:focus, select:focus { outline: 2px solid rgba(210, 174, 99, 0.5); outline-offset: 1px; border-color: var(--bronze); }
label { display: block; font-weight: 600; font-size: 14px; color: var(--dim); margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.field input { width: 100%; }
.hint { font-size: 13px; color: var(--dim); margin-top: 4px; }
.msg { padding: 10px 12px; border-radius: var(--radius); margin: 10px 0; font-size: 15px; }
.msg.bad { background: rgba(196, 69, 60, 0.13); border: 1px solid rgba(196, 69, 60, 0.5); color: #f0b3ab; }
.msg.good { background: rgba(111, 191, 90, 0.12); border: 1px solid rgba(111, 191, 90, 0.45); color: #bfe7b1; }

/* tabs: a row of choices, one on */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  font: 600 15px 'Alegreya Sans', sans-serif; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: var(--radius); cursor: pointer;
}
.tabs button:hover { border-color: var(--bronze); color: var(--gold-2); }
.tabs button.on { color: #1b1408; background: var(--gold); border-color: var(--gold-2); }

/* ------------------------------------------------------------------ panels */
.panel { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow); }
.panel.pad { padding: 22px; }
main { flex: 1; width: 100%; }
.page-head { padding: 40px 0 22px; }
.page-head p { color: var(--dim); max-width: 64ch; margin: 0; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 0 0 18px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar input[type=search] { width: 100%; }
.count { font-size: 14px; color: var(--dim); }

/* ------------------------------------------------------------------ home */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line-soft); }
.hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center 40%; opacity: 0.55; filter: saturate(1.05); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(18, 17, 18, 0.95) 0%, rgba(18, 17, 18, 0.7) 45%, rgba(18, 17, 18, 0.15) 100%), linear-gradient(0deg, var(--bg) 0%, rgba(18, 17, 18, 0) 35%); }
.hero .wrap { position: relative; z-index: 1; padding-top: 90px; padding-bottom: 90px; }
.hero h1 { max-width: 14ch; }
.hero .lead { font-size: 21px; max-width: 46ch; color: #e7dcc8; }
.hero .cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 26px 0 14px; }
.hero .note { font-size: 14px; color: var(--dim); }
.section { padding: 56px 0; }
.section.alt { background: var(--bg-2); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.section > .wrap > h2 { margin-bottom: 8px; }
.section .sub { color: var(--dim); margin-bottom: 28px; max-width: 64ch; }

.classes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.class-card { padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; border-top: 3px solid var(--c, var(--gold)); }
.class-card[data-class=warrior] { --c: var(--warrior); } .class-card[data-class=ranger] { --c: var(--ranger); } .class-card[data-class=mage] { --c: var(--mage); }
.class-card .stage { width: 192px; height: 192px; background: radial-gradient(circle at 50% 70%, #2f2a22 0%, #191819 70%); border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px; overflow: hidden; }
.walker { background-repeat: no-repeat; image-rendering: pixelated; }
.class-card h3 { color: var(--c, var(--gold)); margin-bottom: 4px; }
.class-card .role { font-size: 14px; color: var(--dim); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.class-card p { font-size: 16px; margin: 0; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.feature { overflow: hidden; }
.feature img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; cursor: zoom-in; border-bottom: 1px solid var(--line); }
.feature div { padding: 14px 16px 16px; }
.feature h3 { margin-bottom: 4px; }
.feature p { font-size: 15px; color: var(--dim); margin: 0; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; counter-reset: step; }
.step { padding: 20px; position: relative; }
.step::before { counter-increment: step; content: counter(step); font-family: 'Cinzel', serif; font-weight: 700; font-size: 22px; color: #1b1408; background: var(--gold); width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 10px; }
.step p { font-size: 15px; color: var(--dim); margin: 0; }

.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.88); display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-height: 84vh; border: 1px solid var(--line); box-shadow: var(--shadow); }
.lightbox p { text-align: center; color: var(--text); margin: 12px 0 0; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 700; background: rgba(0, 0, 0, 0.15); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: rgba(210, 174, 99, 0.05); }
.rank { font-family: 'Cinzel', serif; font-weight: 700; color: var(--dim); width: 64px; }
tr.top1 .rank { color: #f3c94e; } tr.top2 .rank { color: #cfd6de; } tr.top3 .rank { color: #d08b4f; }
.voc { font-weight: 600; }
.voc-warrior { color: var(--warrior); } .voc-ranger { color: var(--ranger); } .voc-mage { color: var(--mage); }
.empty { padding: 40px; text-align: center; color: var(--dim); }

/* ------------------------------------------------------------------ the library */
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.card { cursor: pointer; padding: 14px 12px 12px; text-align: center; transition: border-color 0.12s, transform 0.12s; }
.card:hover { border-color: var(--bronze); transform: translateY(-2px); }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.card .pic { height: 96px; display: grid; place-items: center; margin-bottom: 8px; }
.card .pic img { max-width: 100%; height: auto; }
.card .name { font-weight: 700; color: #efe4cf; line-height: 1.25; }
.card .meta { font-size: 13px; color: var(--dim); margin-top: 4px; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; padding: 2px 7px; border-radius: 3px; border: 1px solid currentColor; }
.badge.elite { color: var(--elite); } .badge.boss { color: var(--boss); } .badge.normal { color: var(--dim); }
.badge.guild { color: var(--gold); } .badge.uncrowned { color: #f3c94e; }

.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 8px 14px 8px 8px; cursor: pointer; }
.row:hover { border-color: var(--bronze); }
.row .icon { width: 48px; height: 48px; background: #151415; border: 1px solid var(--line); border-radius: 3px; display: grid; place-items: center; }
.row .icon img { width: 44px; height: 44px; }
.row .name { font-weight: 700; color: #efe4cf; }
.row .stats { font-size: 14px; color: var(--dim); }
.row .req { font-size: 14px; color: var(--dim); text-align: right; white-space: nowrap; }

.spells { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.spell { padding: 16px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; }
.spell .icon { width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 4px; background: #151415; display: grid; place-items: center; font-family: 'Cinzel', serif; font-size: 26px; color: var(--gold); }
.spell .icon img { width: 62px; height: 62px; }
.spell h3 { margin-bottom: 2px; }
.spell .facts { display: flex; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--dim); margin-bottom: 8px; }
.spell .facts b { color: var(--text); font-weight: 700; }
.spell p { font-size: 15px; margin: 0; }

/* detail sheet (a creature, an item) */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.7); display: grid; place-items: center; padding: 16px; }
.sheet { width: min(680px, 100%); max-height: 90vh; overflow: auto; padding: 24px; position: relative; }
.sheet .close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--dim); font-size: 26px; cursor: pointer; line-height: 1; }
.sheet .close:hover { color: var(--gold-2); }
.sheet .top-line { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; margin-bottom: 16px; }
.sheet .portrait { width: 150px; height: 150px; display: grid; place-items: center; background: radial-gradient(circle at 50% 65%, #2f2a22 0%, #171617 72%); border-radius: 6px; border: 1px solid var(--line); }
.sheet .portrait img { max-width: 140px; max-height: 140px; }
.facts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 16px; }
.fact { background: rgba(0, 0, 0, 0.2); border: 1px solid var(--line-soft); border-radius: 4px; padding: 8px 10px; }
.fact span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
.fact b { font-size: 18px; color: #efe4cf; }
.sheet h3 { margin-top: 10px; }
.loot { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.loot li { display: flex; align-items: center; gap: 8px; font-size: 15px; background: rgba(0, 0, 0, 0.18); border-radius: 4px; padding: 4px 8px 4px 4px; }
.loot img { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.loot .band { margin-left: auto; font-size: 12px; color: var(--dim); white-space: nowrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 14px; padding: 3px 9px; border-radius: 12px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.chip.weak { border-color: rgba(111, 191, 90, 0.6); color: #bfe7b1; }
.chip.strong { border-color: rgba(196, 69, 60, 0.6); color: #f0b3ab; }

/* ------------------------------------------------------------------ account */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: start; }
.chars td .voc { font-size: 15px; }
.gap-top { margin-top: 20px; }
.center { text-align: center; }
.pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.pick label { cursor: pointer; margin: 0; text-align: center; padding: 10px 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0, 0, 0, 0.2); color: var(--text); }
.pick label img { width: 96px; height: 96px; display: block; margin: 0 auto 4px; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick input:checked + label { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); color: var(--gold-2); }
.pick input:focus-visible + label { outline: 2px solid var(--gold); }

/* ------------------------------------------------------------------ footer */
.foot { border-top: 1px solid var(--line-soft); padding: 26px 0 32px; color: var(--dim); font-size: 14px; margin-top: 40px; }
.foot .wrap { display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }
.foot a { color: var(--dim); }
.foot a:hover { color: var(--gold); }

@media (max-width: 720px) {
  .top .wrap { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .nav a { padding: 5px 8px; font-size: 15px; }
  .online { display: none; }
  .hero .wrap { padding-top: 56px; padding-bottom: 56px; }
  .sheet .top-line { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .row { grid-template-columns: 52px minmax(0, 1fr); }
  .row { row-gap: 2px; }
  .row .icon { grid-row: span 2; }
  .row .req { grid-column: 2; text-align: left; }
}
