/* Palette sampled directly from the game -- see docs/website-media/palette.md */
:root {
    --bg-canvas: #222222;      /* game's own screen-clear color */
    --bg-panel: #3f2631;       /* dark maroon nine-patch behind every in-game panel */
    --bg-panel-2: #4a2e3a;     /* slightly lifted panel, for table header rows etc. */
    --bg-panel-hi: #55374480;  /* hover wash */
    --border: #576674;         /* blue-grey frame around every in-game panel */
    --border-hi: #7c8b9d;
    --accent-warm: #d7b990;    /* cream/tan button fill (Start, nav tabs) */
    --accent-warm-hover: #e7cead;
    --text-primary: #ffffff;
    --text-secondary: #cfc6b8; /* Constants.LIGHT_GRAY -- in-game body text */
    --gold: #ffca28;           /* Legendary rarity -- the "special" accent */
    --gold-currency: #f4b41b;
    --glow: rgba(255, 202, 40, 0.22);

    --might: #8e3f38;
    --shadow: #6a6893;         /* Shadow tree #2c2b4e, lightened so it reads on dark */
    --arcane: #39ffb4;

    --radius: 10px;
    --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 10px 28px rgba(0, 0, 0, 0.5);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 84px;
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

html, body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-canvas);
    color: var(--text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.6;
    min-height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* faint torch-lit vignette so the flat canvas colour has some depth */
    background-image:
        radial-gradient(1200px 600px at 50% -10%, rgba(255, 180, 60, 0.06), transparent 70%),
        radial-gradient(900px 500px at 50% 110%, rgba(120, 90, 160, 0.06), transparent 70%);
    background-attachment: fixed;
}

h1, h2, h3 { color: var(--text-primary); line-height: 1.2; }

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

img { max-width: 100%; height: auto; }

::selection { background: var(--glow); color: #fff; }

/* ---- sticky header / nav ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 2px solid var(--border);
    background: rgba(45, 27, 35, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}
.site-header .brand img {
    height: 34px;
    display: block;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.6));
}
.site-header nav { display: flex; gap: 8px; }
.site-header nav a {
    position: relative;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.site-header nav a:hover { color: var(--gold); text-decoration: none; background: rgba(255, 255, 255, 0.05); }
.site-header nav a.active { color: var(--gold); }
.site-header nav a.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 1px;
    height: 2px;
    background: var(--gold);
    border-radius: 2px;
}

/* ---- layout ---- */
main {
    flex: 1;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}
section { margin-bottom: 64px; }

h1 { font-size: 2.3rem; margin: 0 0 12px; }
h2 { font-size: 1.65rem; margin: 0 0 20px; }
.subtitle, .tagline { color: var(--text-secondary); margin-top: 0; }

/* section eyebrow + rule */
.eyebrow {
    display: block;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
}
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.section-head h2 { margin: 0; }
.section-head a { font-size: 0.9rem; font-weight: 700; white-space: nowrap; }

/* ---- hero ---- */
.hero { text-align: center; padding: 8px 0 0; margin-bottom: 56px; }

.hero-banner {
    position: relative;
    width: 100%;
    min-height: clamp(260px, 40vw, 460px);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: #1a1a1a url("placeholder-banner.jpg") center / cover no-repeat;
    box-shadow: var(--shadow-lift), inset 0 0 120px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.hero-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(34, 34, 34, 0) 35%, rgba(34, 34, 34, 0.9) 100%);
}
.hero-banner .tagline {
    position: relative;
    z-index: 1;
    margin: 0;
    padding: 0 20px 26px;
    font-size: clamp(1.1rem, 2.6vw, 1.6rem);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 30px rgba(255, 202, 40, 0.25);
}

.hero .pitch {
    max-width: 640px;
    margin: 28px auto 24px;
    font-size: 1.08rem;
}

.button {
    display: inline-block;
    padding: 13px 30px;
    background: linear-gradient(180deg, #e3c9a4, var(--accent-warm));
    color: #2a1a12;
    font-weight: 800;
    border: 2px solid #b9986e;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 0 #9c7f5c, 0 8px 18px rgba(0, 0, 0, 0.45);
    transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background 0.15s var(--ease);
}
.button:hover {
    background: linear-gradient(180deg, #f0dcc0, var(--accent-warm-hover));
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #9c7f5c, 0 12px 24px rgba(0, 0, 0, 0.5);
}
.button:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #9c7f5c, 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* ---- "how it works" steps ---- */
.steps { counter-reset: step; display: grid; gap: 14px; }
.step {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-card);
    transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.step:hover { transform: translateX(4px); border-color: var(--border-hi); }
.step::before {
    counter-increment: step;
    content: counter(step);
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, #e3c9a4, var(--accent-warm));
    color: #2a1a12;
    font-weight: 800;
    font-size: 1.1rem;
    border-radius: 8px;
    box-shadow: 0 0 0 1px #b9986e, 0 0 18px var(--glow);
}
.step h3 { margin: 4px 0 4px; font-size: 1.08rem; color: var(--gold); }
.step p { margin: 0; }

/* ---- feature grid ---- */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature {
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.feature:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: var(--shadow-lift), 0 0 0 1px var(--glow);
}
.feature h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.feature h3::before {
    content: "";
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 2px;
    transform: rotate(45deg);
    box-shadow: 0 0 10px var(--glow);
}
.feature p { margin: 0; }

.tree-badges { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.tree-badges span {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 999px;
    color: #fff;
}
.tree-badges .might { background: var(--might); }
.tree-badges .shadow { background: var(--shadow); }
.tree-badges .arcane { background: var(--arcane); color: #10261d; }

/* ---- screenshot gallery ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.gallery figure {
    margin: 0;
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.gallery figure:hover {
    transform: translateY(-4px);
    border-color: var(--border-hi);
    box-shadow: var(--shadow-lift);
}
.gallery .shot {
    display: block;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #111;
}
.gallery img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.gallery figure:hover img { transform: scale(1.05); }
.gallery figcaption { padding: 12px 16px; font-size: 0.9rem; }

/* ---- scoring ---- */
.scoring .formula {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    background: var(--bg-canvas);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    display: inline-block;
    color: var(--gold);
    font-size: 1.08rem;
    box-shadow: inset 0 0 24px var(--glow);
}

/* ---- leaderboard table ---- */
.board-wrap {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
table.board {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
}
table.board th, table.board td {
    padding: 11px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table.board thead th {
    background: var(--bg-panel-2);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary);
}
table.board tbody tr { transition: background 0.12s var(--ease); }
table.board tbody tr:hover { background: var(--bg-panel-hi); }
table.board tbody tr:last-child td { border-bottom: none; }
table.board .num { text-align: right; font-variant-numeric: tabular-nums; }
table.board .rank { width: 3.2rem; text-align: right; color: var(--text-secondary); font-weight: 700; }
table.board .score { font-weight: 800; color: var(--gold); }
table.board .dungeon { font-family: "SFMono-Regular", Consolas, monospace; font-size: 0.88rem; }
table.board tr.gold   { box-shadow: inset 3px 0 0 var(--gold); }
table.board tr.silver { box-shadow: inset 3px 0 0 #d8dbe0; }
table.board tr.bronze { box-shadow: inset 3px 0 0 #cd7f32; }
table.board tr.gold .rank   { color: var(--gold); }
table.board tr.silver .rank { color: #d8dbe0; }
table.board tr.bronze .rank { color: #cd7f32; }

.empty { color: var(--text-secondary); font-style: italic; }

/* ---- stats strip ---- */
.stats-strip { display: flex; flex-wrap: wrap; gap: 14px; }
.stats-strip div {
    flex: 1 1 130px;
    background: var(--bg-panel);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px;
    text-align: center;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-card);
}
.stats-strip .num {
    display: block;
    font-size: 1.7rem;
    color: var(--text-primary);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 18px var(--glow);
}

/* ---- board page header ---- */
.board-page h1 { margin-bottom: 8px; }
.board-page .subtitle { max-width: 640px; margin-bottom: 24px; }
.board-page .stats-strip { margin-bottom: 24px; }

/* ---- legal ---- */
.legal { max-width: 760px; }
.legal h2 {
    font-size: 1.15rem;
    margin-top: 32px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.legal ul { padding-left: 1.2rem; }
.legal li { margin: 6px 0; }
.legal code {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 0.9em;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
}

/* ---- footer ---- */
.site-footer {
    border-top: 2px solid var(--border);
    background: var(--bg-panel);
    padding: 22px 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.site-footer .about { max-width: 640px; margin: 0 auto 10px; }

/* ---- section entrance: gentle one-shot slide-up on load.
   Only transforms (never opacity), so a missed animation just means
   content sits in its final place -- it can never hide anything. ---- */
@keyframes rise {
    from { transform: translateY(18px); }
    to   { transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
    main > section { animation: rise 0.45s var(--ease) both; }
    main > section:nth-of-type(2) { animation-delay: 0.04s; }
    main > section:nth-of-type(3) { animation-delay: 0.08s; }
    main > section:nth-of-type(4) { animation-delay: 0.12s; }
    main > section:nth-of-type(n+5) { animation-delay: 0.16s; }
}

@media (max-width: 560px) {
    main { padding: 28px 16px 60px; }
    h1 { font-size: 1.9rem; }
    table.board th, table.board td { padding: 9px 10px; font-size: 0.9rem; }
    .site-header { padding: 10px 16px; }
    .site-header nav a { padding: 5px 8px; }
}
