/* ==========================================================================
   TADA Play — "Castle Age" theme (Age of Empires II), FLAT edition.
   Shared across login / register / profile / activate / reset pages.
   Medieval identity via colour + inscriptional type; no bevels, gradients,
   embosses or 3D — solid fills, clean flat borders. Single dark theme by design.
   Font-CDN-free: robust behind a VPN, no silent webfont fallback.
   ========================================================================== */

:root {
    --stone:        #1c1712;
    --stone-line:   #2a2118;
    --parchment:    #e9dcb7;
    --panel-head:   #2a2017;
    --ink:          #3d2c15;
    --ink-soft:     #7a6231;
    --gold:         #c39a3c;
    --gold-deep:    #8a6a1e;
    --teak:         #35281a;
    --win:          #4f7a2e;
    --loss:         #a5361f;

    --display: "Trajan Pro", "Cinzel", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
    --body:    "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--body);
    color: #efe2c2;
    margin: 0;
    padding: 40px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    line-height: 1.55;
    /* AoE2 battle-scene backdrop with a dark scrim so panels and text stay readable. */
    background-color: var(--stone);
    background-image:
        linear-gradient(180deg, rgba(20, 14, 9, 0.58), rgba(20, 14, 9, 0.80)),
        url("https://aoe2.io.vn/wp-content/uploads/2025/02/banner_bg.jpg");
    background-position: center, center;
    background-size: cover, cover;
    background-repeat: no-repeat, no-repeat;
    background-attachment: fixed, fixed;
}

/* ---- Flat parchment panel with a clean gold/teak frame ------------------- */
.container,
.leaderboard {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: 32px 30px 28px;
    color: var(--ink);
    background: var(--parchment);
    border: 2px solid var(--gold);
    border-radius: 4px;
    box-shadow: 0 0 0 4px var(--teak); /* flat solid ring, no blur */
}
.leaderboard { max-width: 820px; }

/* ---- Inscriptional headings (solid gold, no emboss) ---------------------- */
h1, h2, h3 {
    font-family: var(--display);
    text-align: center;
    text-wrap: balance;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-variant: small-caps;
    margin: 0 0 0.5em;
    color: var(--gold-deep);
    font-weight: 700;
}
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }

/* Flat heraldic divider: a gold rule with a centred diamond. */
.rule {
    height: 10px;
    margin: 2px auto 20px;
    max-width: 300px;
    background:
        conic-gradient(from 45deg, var(--gold) 0 25%, transparent 0 50%, var(--gold) 0 75%, transparent 0) center / 10px 10px no-repeat,
        linear-gradient(var(--gold), var(--gold)) center / 100% 2px no-repeat;
}

p { margin: 0 0 1em; }
.subtitle { text-align: center; color: var(--ink-soft); margin: -2px 0 20px; }

/* ---- Forms ---------------------------------------------------------------- */
form { display: flex; flex-direction: column; gap: 4px; }

label {
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78rem;
    color: var(--gold-deep);
    margin-top: 8px;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select {
    font-family: var(--body);
    font-size: 1rem;
    color: var(--ink);
    padding: 11px 12px;
    margin-bottom: 14px;
    background: #f6efd6;
    border: 2px solid #b79a5f;
    border-radius: 3px;
}
input::placeholder { color: #a88f5f; }
input:focus,
select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(195, 154, 60, 0.35);
}

/* ---- Flat gold buttons ---------------------------------------------------- */
button,
input[type="submit"],
.btn {
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 1rem;
    font-weight: 700;
    color: #2f2109;
    padding: 12px 18px;
    margin-top: 8px;
    cursor: pointer;
    background: var(--gold);
    border: 2px solid var(--gold-deep);
    border-radius: 3px;
    transition: background 0.15s ease, color 0.15s ease;
}
button:hover,
input[type="submit"]:hover,
.btn:hover { background: var(--gold-deep); color: #f6eccf; }
button:active,
input[type="submit"]:active,
.btn:active { background: #6f551a; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---- Links ---------------------------------------------------------------- */
a {
    color: #9a3320;
    text-decoration: none;
    font-weight: 700;
}
a:hover { color: #c0432a; text-decoration: underline; }
.links { display: flex; justify-content: center; gap: 18px; margin-top: 16px; }
.container > a { display: inline-block; margin: 0 8px; }

/* ---- Lists (generated profiles, etc.) ------------------------------------- */
ul { list-style: none; padding: 0; margin: 12px 0 0; }
li {
    margin: 8px 0;
    padding: 10px 12px;
    background: #f1e7c8;
    border: 1px solid #cbb787;
    border-radius: 3px;
}

/* ---- Leaderboard (ranking.php) -------------------------------------------- */
.leaderboard table { width: 100%; border-collapse: collapse; }
.leaderboard th,
.leaderboard td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #cbb787; }
.leaderboard th {
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.76rem;
    color: var(--gold);
    background: var(--panel-head);
    border-bottom: 2px solid var(--gold-deep);
}
.leaderboard td.num, .leaderboard th.num { text-align: right; font-variant-numeric: tabular-nums; }
.leaderboard td.rank { width: 60px; text-align: center; font-weight: 700; font-size: 1.15rem; }
.leaderboard tr.top1 { background: #f3e4ac; }
.leaderboard tr.top2 { background: #e6e2d3; }
.leaderboard tr.top3 { background: #ecd9bd; }
.leaderboard .rating { font-family: var(--display); font-weight: 700; color: var(--gold-deep); font-size: 1.05rem; }
.leaderboard .win { color: var(--win); font-weight: 700; }
.leaderboard .loss { color: var(--loss); font-weight: 700; }
.leaderboard .empty, .leaderboard .error { text-align: center; color: var(--ink-soft); padding: 34px 0; }
.leaderboard .error { color: var(--loss); }
.leaderboard .foot { text-align: center; margin: 18px 0 0; font-size: 0.85rem; color: var(--ink-soft); }

/* IP column + unranked rows */
.leaderboard td.ip { font-family: "Consolas", "Menlo", monospace; font-size: 0.85rem; color: var(--ink-soft); white-space: nowrap; }
.leaderboard tr.unranked td { color: var(--ink-soft); }
.leaderboard tr.unranked td.muted-cell { color: #b0a074; }
.leaderboard .tag-unranked {
    display: inline-block;
    font-family: var(--body);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink-soft);
    background: #e4d7ae;
    border: 1px solid #cbb787;
    border-radius: 10px;
    padding: 2px 8px;
    white-space: nowrap;
}

/* ---- Link-buttons render like buttons ------------------------------------ */
a.btn { display: inline-block; text-align: center; text-decoration: none; }
a.btn:hover { color: #f6eccf; }

/* Secondary "ghost" button (outline only). */
.btn-ghost {
    background: transparent;
    color: var(--gold);
    border-color: var(--gold);
}
.btn-ghost:hover, a.btn-ghost:hover { background: var(--gold); color: #2f2109; }

/* ---- Home top bar (over the battle-scene background) ---------------------- */
.topbar {
    width: 100%;
    max-width: 820px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
}
.brand {
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}
.topbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Dashboard sections (profile.php) ------------------------------------ */
.section {
    margin: 16px 0;
    padding: 16px 16px 18px;
    background: #f1e7c8;
    border: 1px solid #cbb787;
    border-radius: 4px;
}
.section-title {
    font-family: var(--display);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.82rem;
    color: var(--gold-deep);
    margin-bottom: 8px;
}
.muted { color: var(--ink-soft); margin: 0 0 12px; }
.alert {
    text-align: center;
    color: var(--loss);
    font-weight: 700;
    background: #f6e2d6;
    border: 1px solid #d8a58f;
    border-radius: 3px;
    padding: 10px 12px;
    margin: 0 0 16px;
}

@media (max-width: 560px) {
    .container, .leaderboard { padding: 24px 16px; }
    h1 { font-size: 1.5rem; }
    .leaderboard th, .leaderboard td { padding: 9px 8px; font-size: 0.9rem; }
    .topbar { justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
