@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg: #1B1B2E;
    --surface: #262640;
    --surface-raised: #2E2E52;
    --yellow: #FFD23F;
    --teal: #3EC1D3;
    --coral: #FF5E5B;
    --text: #F5F3FF;
    --text-dim: #A8A4C8;
    --outline: #12121F;

    /* Layered-shadow system: a tight dark "contact" shadow for grounding,
       plus a softer diffused shadow for lift. Comic/game-UI cards read as
       "sitting on the page" much more than a single flat box-shadow. */
    --shadow-contact: 0 3px 0 rgba(8, 8, 16, 0.6);
    --shadow-lift: 0 10px 24px rgba(0, 0, 0, 0.35);
    --shadow-card: var(--shadow-contact), var(--shadow-lift);
    --stroke: 2px solid var(--outline);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(ellipse 900px 500px at 50% -80px, rgba(126, 111, 255, 0.16), transparent 60%),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.015) 0px, rgba(255, 255, 255, 0.015) 1px, transparent 1px, transparent 10px),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
}

h1, h2, h3, .display {
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    margin: 0;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}

.site-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 40px;
    flex-wrap: wrap;
    gap: 12px;
}

.site-header .brand {
    font-size: 1.4rem;
    color: var(--yellow);
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-header .brand-logo {
    width: 42px;
    height: 42px;
    display: block;
}

.site-header .brand span {
    color: var(--text);
}

/* --- Search hero --- */
.search-hero {
    text-align: center;
    padding: 48px 16px 56px;
}

.search-hero h1 {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    margin-bottom: 10px;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.search-hero p {
    color: var(--text-dim);
    margin-bottom: 28px;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 480px;
    margin: 0 auto;
}

.search-form input {
    flex: 1;
    padding: 14px 18px;
    border-radius: 14px;
    border: var(--stroke);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.search-form input::placeholder { color: var(--text-dim); }

.search-form button {
    padding: 14px 24px;
    border-radius: 14px;
    border: var(--stroke);
    background: var(--yellow);
    color: var(--outline);
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-contact);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.search-form button:hover { transform: translateY(-1px); box-shadow: 0 4px 0 rgba(8, 8, 16, 0.6); }
.search-form button:active { transform: translateY(3px); box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
    .search-form button { transition: none; }
}

/* --- Hex badge, the signature element --- */
/* An enamel-pin/medal treatment: thick ink outline, a beveled top-edge
   highlight (inset shadow catching imaginary light from above), and a
   two-layer shadow — a tight dark contact shadow plus a soft glow tinted
   to the badge's own tier color, so it visibly lifts off the page. */
.hex-badge {
    --size: 96px;
    width: var(--size);
    height: calc(var(--size) * 1.1547);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', sans-serif;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
    filter: drop-shadow(0 4px 0 rgba(8, 8, 16, 0.55)) drop-shadow(0 0 18px var(--tier-glow, rgba(255, 210, 63, 0.35)));
}

.hex-badge::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    box-shadow: inset 0 10px 18px rgba(255, 255, 255, 0.28), inset 0 -14px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.hex-badge .trophy-count { font-size: 1.1rem; line-height: 1.1; position: relative; }
.hex-badge .trophy-label { font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; position: relative; }

.tier-bronze    { background: linear-gradient(160deg, #B08D57, #7A5C33); color: #FCEBD5; --tier-glow: rgba(176, 141, 87, 0.4); }
.tier-gold      { background: linear-gradient(160deg, #FFD23F, #C99A1E); color: #2A1E00; --tier-glow: rgba(255, 210, 63, 0.45); }
.tier-diamond   { background: linear-gradient(160deg, #6FE3F0, #2C9AAB); color: #062226; --tier-glow: rgba(111, 227, 240, 0.45); }
.tier-mythic    { background: linear-gradient(160deg, #C77DFF, #7B2CBF); color: #F5EBFF; --tier-glow: rgba(199, 125, 255, 0.45); }
.tier-legendary { background: linear-gradient(160deg, #FF9F5E, #FF5E5B); color: #331000; --tier-glow: rgba(255, 94, 91, 0.5); }

/* --- Profile header --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--surface);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 28px;
    border: var(--stroke);
    box-shadow: var(--shadow-card);
}

.profile-header h2 { font-size: 1.5rem; margin-bottom: 4px; }
.profile-header .meta { color: var(--text-dim); font-size: 0.9rem; }
.profile-header .stat-row { display: flex; gap: 20px; margin-top: 10px; flex-wrap: wrap; }
.profile-header .stat { font-size: 0.85rem; color: var(--text-dim); }
.profile-header .stat strong { display: block; color: var(--text); font-size: 1.05rem; font-family: 'Fredoka', sans-serif; }

/* --- Cards / grids --- */
.section-title {
    font-size: 1.1rem;
    margin: 32px 0 14px;
    color: var(--yellow);
}

.brawler-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.brawler-card {
    background: var(--surface);
    border: var(--stroke);
    border-radius: 14px;
    padding: 12px;
    box-shadow: var(--shadow-contact);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.brawler-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 0 rgba(8, 8, 16, 0.6), var(--shadow-lift);
}

.brawler-card .name { font-family: 'Fredoka', sans-serif; font-size: 0.95rem; margin-bottom: 6px; }
.brawler-card .trophies { color: var(--yellow); font-weight: 600; }
.brawler-card .power { color: var(--text-dim); font-size: 0.8rem; }

@media (prefers-reduced-motion: reduce) {
    .brawler-card { transition: none; }
}

.roster-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: 14px;
    overflow: hidden;
    border: var(--stroke);
    box-shadow: var(--shadow-card);
}

.roster-table th, .roster-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--surface-raised);
    font-size: 0.9rem;
}

.roster-table th { color: var(--text-dim); font-weight: 500; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.04em; }
.roster-table tr:last-child td { border-bottom: none; }
.roster-table .role-badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 8px;
    background: var(--surface-raised);
    border: 1px solid var(--outline);
    color: var(--text-dim);
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-dim);
    background: var(--surface);
    border: 2px dashed var(--surface-raised);
    border-radius: 20px;
}

.empty-state .display { color: var(--coral); font-size: 1.3rem; margin-bottom: 8px; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }

.back-link { display: inline-block; margin-bottom: 20px; }

.site-footer {
    margin-top: 56px;
    padding-top: 20px;
    border-top: 2px solid var(--surface-raised);
    color: var(--text-dim);
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.site-footer strong { color: var(--yellow); font-family: 'Fredoka', sans-serif; }
.site-footer .footer-credit { margin: 4px 0 0; font-size: 0.72rem; color: var(--text-dim); opacity: 0.8; }
