/* =====================================================================
   USER PROFILE PAGE
   Cleaned up: every duplicated selector merged into one rule holding the
   declarations that actually won in the old cascade. Rules that were
   fully overridden (or did nothing) have been removed.

   Sections
     0. Base
     1. Shared components (buttons, cards, forms)   <- may belong in styles.css
     2. Titlebar dropdown                           <- may belong in styles.css
     3. Page layout
     4. Profile header
     5. Action bar + "⋯" menu
     6. Tabs
     7. Tab panels (bio, notes, debts, mod/owner tools)
     8. Statsf
     9. Achievements
    10. Games grid
    11. Right column: leaderboard + links
    12. Modals / popups
    13. Responsive
   ===================================================================== */


/* ---------------------------------------------------------------------
   0. BASE
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { max-width: 100vw; }

body {
    /* font-family: Arial, sans-serif; */
    font-family: var(--font);
    font-size: 15px;
    /* line-height: 1.5; */
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    background-color: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; font-weight: 650; }

/* a:link, a:visited { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; } */

::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

.warning {
    color: var(--warning);
    font-style: italic;
    font-weight: 600;
    margin-top: 20px;
}

/* .red   { color: var(--danger); }
.green { color: var(--success); } */


/* ---------------------------------------------------------------------
   1. SHARED COMPONENTS
   --------------------------------------------------------------------- */

/* Buttons
   <button class="btn">Default</button>
   <button class="btn btn-primary">Main action</button>
   <button class="btn btn-accent">Highlight</button>
   <button class="btn btn-danger">Destructive</button>
   <a class="btn btn-icon"><i class="fa-solid fa-gear"></i></a>          */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-3);
    color: var(--accent-text) !important;
    font: 600 0.9rem/1 var(--font);
    text-decoration: none !important;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover  { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text) !important;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-accent {
    background: var(--accent);
    border-color: transparent;
    color: var(--accent-text) !important;
}
.btn-accent:hover { filter: brightness(1.08); }

.btn-danger {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: color-mix(in srgb, var(--danger) 45%, transparent);
    color: var(--danger) !important;
}
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }

.btn-icon { width: 38px; padding: 0; }
.btn-sm   { height: 30px; padding: 0 12px; font-size: 0.82rem; }

/* Inner span from the old markup — let the .btn do the styling */
.btn > .button-front { display: contents; }

/* Old "pushable" 3D buttons used on other pages → flat pills */
.button-pushable {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    font: inherit;
}
.button-pushable .button-shadow,
.button-pushable .button-edge { display: none; }
.button-pushable .button-front {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font: 600 0.9rem/1 var(--font);
    transition: background-color .15s;
}
.button-pushable:hover .button-front { background: var(--surface-3); }
.button-pushable .bt-red  { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.button-pushable .bt-blue { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button-pushable:hover .bt-blue { background: var(--accent-strong); }
.button-icon { max-width: 22px; max-height: 22px; }

/* Cards / panels */
.card,
.offline,
.home-section,
.home-latest-update,
.update-entry {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Form controls */
input[type="text"], input[type="number"], input[type="email"],
input[type="password"], input[type="date"], input[type="search"] {
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    transition: border-color .15s, box-shadow .15s;
}
textarea, select {
    width: 100%;
    margin-top: 5px;
    padding: 10px;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }


/* ---------------------------------------------------------------------
   2. TITLEBAR DROPDOWN
   --------------------------------------------------------------------- */
/* .menu-section {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 18px;
    padding-right: 6px;
}

.hamburger-menu {
    width: 24px;
    height: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}
.hamburger-menu span {
    display: block;
    height: 2px;
    background: var(--titlebar-text);
    border-radius: 2px;
}

.dropdown-menu {
    display: none; 
    position: fixed;
    top: 68px;
    right: 10px;
    min-width: 220px;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    z-index: 5000;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0,0,0,.4);
 }
 */
.dropdown-menu a { text-decoration: none !important; }

.dropdown-option {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color .12s;
    user-select: none;
}
.dropdown-option:hover { background-color: var(--surface-2); }

#logout-button .option-title { color: var(--danger); }
#mod-button { border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 4px; } */
 */

/* ---------------------------------------------------------------------
   3. PAGE LAYOUT
   --------------------------------------------------------------------- */
.content { width: 90vw; }

.profile-container {
    display: flex;
    margin-bottom: 20px;
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    width: 90vw;
}

.main-section {
    flex: 2;
    max-width: 100%;
    border-radius: var(--radius);
}

.banner {
    width: 100%;
    height: 150px;
    background: #001111;
    border-radius: 10px 10px 0 0;
}

.under-banner {
    display: flex;
    height: max(80vh, 700px);
    background-color: color-mix(in srgb, var(--bg) var(--bg-opacity-percentage), transparent);
    color: var(--text);
    border-radius: var(--radius);
}

.left {
    width: 70%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    border-left: var(--border-width) solid var(--border-strong);
}

.jigsaw-thumb {
    display: block;
    width: 100%;
    height: 100%;
}


/* ---------------------------------------------------------------------
   4. PROFILE HEADER
   --------------------------------------------------------------------- */
.horizontal-header { display: flex; flex-direction: column; }
.vertical-header   { display: none; }

.profile-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-height: 225px;
    padding: 20px;
}

.pic-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.profile-pic {
    width: 100px;
    height: auto;
    aspect-ratio: 1 / 1;
    max-width: 100px;
    max-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border-radius: 50%;
    border: var(--border-width-big) solid var(--border-strong);
    background: lightgray;
}
.profile-pic img {
    width: 105%;
    height: 105%;
    object-fit: cover;
}
.profile-adjust { margin-top: -50px; }

.profile-info {
    margin-left: 20px;
    margin-bottom: 30px;
}

.tagline { font-style: italic; }

.collar-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px;
    padding: 5px 10px;
    border-radius: 8px;
    border: var(--border-width) solid var(--border-strong);
    background-color: var(--bg);
    color: var(--text);
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
}

.collar-banner-special {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px auto 0 auto;
    padding: 6px 14px;
    border-radius: 999px;
    border: 3px solid var(--border);
    background: var(--accent);
    color: #fff;
    font-weight: bold;
    font-size: 1.1em;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    box-shadow:
        0 0 5px var(--accent),
        0 0 10px var(--accent),
        inset 0 0 5px rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease-in-out;
}
.collar-banner-special:hover { transform: scale(1.05) rotate(-1deg); }


/* ---------------------------------------------------------------------
   5. ACTION BAR + "⋯" MENU
   --------------------------------------------------------------------- */
.buttons,
.action-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.action-menu { position: relative; }
.action-menu > summary { list-style: none; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu[open] > summary { background: var(--surface-3); }

.action-menu-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 50;
    min-width: 200px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0,0,0,.35);
    animation: menu-in .12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font: 500 0.9rem var(--font);
    text-align: left;
    cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item i { width: 16px; text-align: center; color: var(--text-muted); }
.menu-item > .button-front { display: contents; }
.menu-danger, .menu-danger i { color: var(--danger); }

.menu-label {
    margin: 6px 10px 2px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.follow-btn { font-size: inherit; }


/* ---------------------------------------------------------------------
   6. TABS
   --------------------------------------------------------------------- */
.tabs-container {
    position: relative;
    flex-shrink: 0;
    border-bottom: 2px solid var(--border-strong);
}

.tabs-wrapper {
    position: relative;
    z-index: 10;
    padding: 0 16px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.tabs-wrapper::-webkit-scrollbar { display: none; }

.tabs {
    display: inline-flex;
    gap: 4px;
    min-width: 100%;
    white-space: nowrap;
    font-size: 20px;
    line-height: 1;
}

.tab {
    position: relative;
    margin: 0;
    padding: 13px 12px 12px;
    border-radius: 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    user-select: none;
    transition: color .15s;
}
.tab:hover { color: var(--text); }
.tab::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 4px;
    height: 2px;
    border-radius: 2px;
    background: transparent;
    transition: background-color .15s;
}
.tab.active { color: var(--text); background: none; }
.tab.active::after { background: var(--accent); }

.spacer { margin-left: 8px; }

/* Scroll hint arrows */
.scroll-hint,
.scroll-hint-left {
    display: block;
    position: absolute;
    top: 38%;
    transform: translateY(-50%);
    z-index: 20000;
    font-size: 24px;
    color: var(--text);
    pointer-events: none;
    animation: blink 1.5s infinite;   /* keyframes only exist in portrait (see Responsive) */
}
.scroll-hint      { right: 5px; }
.scroll-hint-left { left: 5px; }

.scroll-container,
.scroll-container-left {
    display: block;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20000;
    width: 20px;
    font-size: 24px;
    color: var(--text);
    pointer-events: none;
}
.scroll-container      { right: 0; height: 30px; background-color: var(--bg-color); }
.scroll-container-left { left: 0;  height: 45px; }

.scroll-gradient { display: none; }

.tab-content { display: none; }
.tab-content.active { display: block; }


/* ---------------------------------------------------------------------
   7. TAB PANELS
   --------------------------------------------------------------------- */
.profile-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 28px 28px;
}
.profile-content > h3:first-child { margin-top: 4px; }

#main { height: 56%; }
#main p {
    font-size: 0.98rem;
    line-height: 1.3;
}
#main blockquote {
    margin: 12px 0;
    padding: 8px 14px;
    border-left: 3px solid var(--accent);
    background: var(--surface-2);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.bio-title {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bio-title h3 { margin: 4px 0 8px; }

.edit-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 14px;
    color: var(--text-muted) !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.edit-icon:hover { background: var(--surface-3); color: var(--text) !important; }

/* Notes */
.notes-tab { display: none; flex-direction: column; height: 100%; }
.notes-tab.active { display: flex !important; }
.notes-textarea {
    flex-grow: 1;
    width: 100%;
    height: 70%;
    min-height: 220px;
    resize: vertical;
    line-height: 1.6;
}
.notes-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 0;
}
.notes-status { color: var(--success); font-size: 0.88rem; }

/* Shared pill button for panels + popups */
.save-btn,
.debt-form button,
.mod-tools button,
.send-tribute-btn,
.send-antitribute-btn,
.popup-inner button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--accent-text);
    font: 600 0.9rem var(--font);
    cursor: pointer;
    transition: background-color .15s, transform .08s;
}
.save-btn:hover,
.debt-form button:hover,
.mod-tools button:hover,
.send-tribute-btn:hover,
.send-antitribute-btn:hover,
.popup-inner button:hover { background: var(--accent-strong); }
.save-btn:active,
.mod-tools button:active { transform: translateY(1px); }
.save-btn,
.mod-tools button { margin-top: 5px; }

/* Debts */
.debt-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.summary-heading       { font-size: 1.3em; font-weight: 700; display: inline-block; margin: 0; }
.summary-heading-small { font-weight: 700; display: inline-block; margin: 0.2em 0; }
.owed-amt { color: var(--accent); }

.debt-form { display: flex; flex-direction: column; }
.debt-form label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.debt-form label:hover { background: var(--surface-3); }
.selected-total { padding: 4px 10px; color: var(--accent); }
#debts strong { color: var(--text); }
#debt_uncapped { width: auto; }

.debt-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.debt-btns .mark-del-btn {
    background-color: #ffdbdb;
    border-color: color-mix(in srgb, var(--danger) 50%, transparent);
    color: var(--danger);
}
.debt-btns .mark-del-btn:hover { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.debt-btns .split-debt-btn {
    background: var(--accent);
    border-color: var(--border-strong);
    color: var(--accent-text);
}
.debt-btns .split-debt-btn:hover { background: var(--surface-3); }

/* Owner + mod tools */
.mod-tools {
    margin-top: 8px;
    padding: 22px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}
.mod-tools h3 {
    margin: 0 0 18px;
    font-size: 1.15rem;
    color: var(--titlebar-font-color);
    text-shadow: 0 0 5px var(--titlebar-glow-color);
}
.mod-tools form { margin-bottom: 18px; }
.mod-tools .form-group { margin-bottom: 14px; }
.mod-tools label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.88rem;
}
.mod-tools input {
    width: 100%;
    margin-top: 5px;
    padding: 10px;
    background: var(--bg);
    color: var(--text);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
}
.mod-tools input[type="text"],
.mod-tools input[type="number"] {
    max-width: 260px;
    margin: 0 8px 8px 0;
    padding: 8px;
}
.mod-tools select { max-width: 360px; }

.mod-tools .quick-links {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.mod-tools .quick-links a.button {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background-color: var(--link-bg-color);
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}
.mod-tools .quick-links a.button:hover {
    background: var(--surface-3);
    color: var(--link-text-color);
}

.confirmation-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    padding: 12px 20px;
    background: var(--surface);
    color: var(--text);
    font-size: 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0,0,0,.4);
}


/* ---------------------------------------------------------------------
   8. STATS
   --------------------------------------------------------------------- */
#stats, #userstats { width: 100%; flex-direction: column; align-items: center; }
#stats.active, #userstats.active { display: flex; justify-content: flex-start; }
#stats > span, #userstats > span { color: var(--text-muted); font-size: 0.82rem; }

.stats-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 4px;
    margin: 4px 0 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
}
.stats-btn, .userstats-btn {
    margin: 0;
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font: 600 0.8rem var(--font);
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.stats-btn:hover, .userstats-btn:hover { color: var(--accent-text); background: var(--surface-3); }
.stats-btn.active, .userstats-btn.active { background: var(--accent); color: var(--accent-text); }

.chart-container {
    width: min(820px, 90%);
    max-width: 800px;
    height: 90%;
    min-height: 300px;
    max-height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
}
#stats-graph, #userstats-graph {
    display: block;
    background: var(--grid-bg-color);
    border: 3px solid var(--border-strong);
    border-radius: var(--radius);
}

.date-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 6px;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.date-filter .stats-btn {
    background: var(--surface-3);
    color: var(--accent-text);
}


/* ---------------------------------------------------------------------
   9. ACHIEVEMENTS
   --------------------------------------------------------------------- */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.achievement {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: 190px;
    padding: 8px;
    overflow: hidden;
    border-radius: var(--radius);
    border: 1px solid color-mix(in srgb, currentColor 18%, transparent);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
    cursor: default;
    transition: transform .2s ease, box-shadow .2s ease;
}
.achievement:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 22px rgba(0,0,0,.25);
}
.achievement img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    transition: transform .3s ease;
}
.achievement:hover img { transform: scale(1.05); }
.achievement a { color: inherit; text-decoration: underline; }

.achievement-name {
    position: relative;
    height: 24px;
    margin-top: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}
.achievement-sender {
    font-size: 0.7rem;
    opacity: .8;
    overflow: hidden;
    white-space: nowrap;
}

/* Marquee-scroll long names on hover */
.achievement-name span,
.achievement-sender span { display: inline-block; padding-right: 100%; }
.achievement-name:hover span,
.achievement-sender:hover span { animation: scroll-text 5s linear infinite; }

.scroll-wrapper {
    display: inline-block;
    white-space: nowrap;
    text-align: left;
    transition: transform 5s linear;
}

@keyframes scroll-text {
    0%  { transform: translateX(0); }
    50% { transform: translateX(-100%); }
}

.achievement-tooltip {
    display: none;
    position: absolute;
    top: 0;
    left: 50%;
    width: 100%;
    transform: translateX(-50%);
    padding: 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 12px;
}
.achievement:hover .achievement-tooltip { display: block; }

.grant-div {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    width: 100%;
    margin-top: 6px;
}
.grant-btn {
    width: 100%;
    padding: 6px 10px;
    margin-bottom: 10px;
    border: 0;
    border-radius: 999px;
    background: var(--success);
    color: #04140c;
    font: 700 0.8rem var(--font);
    cursor: pointer;
}
.grant-btn:hover { background-color: #45a049; filter: brightness(1.1); }

.bg-type-1  { background-color: var(--achevement-type-1-bg-color);  color: var(--achevement-type-1-color); }
.bg-type-2  { background-color: var(--achevement-type-2-bg-color);  color: var(--achevement-type-2-color); }
.bg-type-3  { background-color: var(--achevement-type-3-bg-color);  color: var(--achevement-type-3-color); }
.bg-default { background-color: var(--achevement-default-bg-color); color: var(--achevement-default-color); }


/* ---------------------------------------------------------------------
   10. GAMES GRID
   --------------------------------------------------------------------- */
.games-sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0 14px;
}
.games-sort-controls label {
    font-size: 0.9rem;
    color: var(--text);
}
.games-sort-controls select {
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid var(--border, #444);
    background: var(--bg, #1e1e1e);
    color: var(--text);
    font-size: 0.9rem;
}

.games-box {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    justify-content: center;
}

.games-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
}

.game-card {
    position: relative;   /* anchors the drag handle / edit icon */
    width: 130px;
    height: 160px;
    padding: 1rem;
    background-color: var(--bg);
    border: var(--border-width) solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 0 5px var(--border);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.game-card:hover {
    transform: scale(1.03);
    box-shadow: 0 0 10px var(--link-clicked-color);
}

.game-top {
    position: relative;
    display: flex;
    width: 100%;
    aspect-ratio: 1 / 1;
}
.wheel-preview,
.game-top img {
    display: block;
    width: 100%;
    height: 100%;
}
.game-card img {      /* must stay after .game-top img — its height:auto wins */
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.game-title {
    color: var(--text);
    font-weight: bold;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

.margin-adjust { margin: -11px; }

/* Blocked */
.game-card.blocked {
    opacity: 0.4;
    pointer-events: none;
}
.game-block-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: red;
    font-size: 3rem;
    pointer-events: none;
}

/* Drag to reorder */
.drag-handle {
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 5;
    width: 22px;
    height: 22px;
    margin: -15px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    letter-spacing: -3px;
    cursor: grab;
    user-select: none;
    touch-action: none;
}
.drag-handle:active { cursor: grabbing; }

/* Dragging in alphabetical view wouldn't map to a savable order */
.games-grid.sort-alpha .drag-handle { display: none; }

.game-card.dragging { opacity: 0.4; }
.game-card.drag-over-before { box-shadow: inset 3px 0 0 0 var(--accent-color, #6aa9ff); }
.game-card.drag-over-after  { box-shadow: inset -3px 0 0 0 var(--accent-color, #6aa9ff); }


/* ---------------------------------------------------------------------
   11. RIGHT COLUMN: LEADERBOARD + LINKS
   --------------------------------------------------------------------- */
.leaderboard {
    flex-shrink: 0;
    height: 268px;
    padding: 20px 20px 8px;
    color: var(--text);
    border-bottom: 2px solid var(--border-strong);
}

.top-recipients, .top-senders { margin-bottom: 19px; }

.top-recipients h3, .top-senders h3,
#linkbar-title h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text);
}

.top-recipients ul, .top-senders ul {
    list-style: none;
    margin: 0 0 8px;
    padding: 0;
    counter-reset: rank;
}
.top-recipients li, .top-senders li {
    counter-increment: rank;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    margin-bottom: 4px;
    border-radius: var(--radius-sm);
}
.top-recipients li:hover, .top-senders li:hover { background: var(--surface-2); }
.top-recipients li::before, .top-senders li::before {
    content: counter(rank);
    width: 20px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-muted);
}
.top-recipients li:nth-child(1)::before, .top-senders li:nth-child(1)::before { color: #f5c542; }
.top-recipients li:nth-child(2)::before, .top-senders li:nth-child(2)::before { color: #c0c8d4; }
.top-recipients li:nth-child(3)::before, .top-senders li:nth-child(3)::before { color: #d08a4e; }
.top-recipients img, .top-senders img {
    display: block;
    width: 36px;
    height: 36px;
    margin: 0;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-strong);
}
.top-recipients p, .top-senders p { margin: 0; font-size: 1rem; }

/* Links */
.links-section {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 16px 20px;
    color: var(--text);
    border-radius: var(--radius);
}

#linkbar-title {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}
#linkbar-title h3 { margin: 0; }

#link-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 600px;
    max-height: 100%;
    margin: 10px auto 0;
}

.link-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text) !important;
    text-decoration: none !important;
    transition: border-color .15s, background-color .15s, transform .1s;
}
a.link-bar:hover {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    transform: translateX(2px);
}

.link-icon {
    flex: 0 0 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
    font-size: 16px;
}

.link-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.link-title,
.url {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.link-title {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
}
.url {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-decoration: none;
}
.link-go {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity .15s;
}
a.link-bar:hover .link-go { opacity: 1; }

/* A link with no URL = a section heading */
.link-bar.no-link {
    padding: 14px 4px 2px;
    border: 0;
    background: none;
}
.link-bar.no-link:first-child { padding-top: 2px; }
.nolink-title {
    width: 100%;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text);
    text-align: left;
}


/* ---------------------------------------------------------------------
   12. MODALS / POPUPS
   --------------------------------------------------------------------- */
.tribute-modal,
#split-debt-popup,
#support-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
    background: rgba(3, 6, 14, 0.65);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.tribute-modal-content,
.popup-inner {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 26px 24px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 24px 60px rgba(0,0,0,.45);
    text-align: left;
    animation: menu-in .15s ease-out;
}
.popup-inner { align-items: stretch; text-align: center; }

.tribute-modal-content h2 { margin: 0; font-size: 1.3rem; }
.tribute-modal-content p  { margin: 0 0 6px; color: var(--text-muted); font-size: 0.88rem; line-height: 1.55; }

.tribute-modal-content input,
.popup-inner input { width: 100%; }
.tribute-modal-content input {
    margin-top: 5px;
    padding: 10px;
    background: var(--bg);
    color: var(--text);
    border: var(--border-width) solid var(--border-strong);
    border-radius: var(--radius);
}

.send-tribute-btn, .send-antitribute-btn { margin-top: 6px; width: 100%; }

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.close-btn:hover { background: var(--surface-2); color: var(--text); }


/* ---------------------------------------------------------------------
   13. RESPONSIVE
   --------------------------------------------------------------------- */
@media (max-width: 800px) {
    .horizontal-header { display: none; }
    .vertical-header   { display: flex; flex-direction: column; align-items: center; }
    .profile-info      { margin-left: 0; }
}

/* Narrow or portrait: stack everything into one column */
@media (max-width: 1050px), (max-aspect-ratio: 1/1) {
    .content { width: 100%; padding: 0 10px 30px; }

    .under-banner {
        flex-direction: column;
        height: auto;
        max-height: none;
    }
    .left { width: 100%; overflow: visible; }

    .right {
        flex: 1 1 auto;
        border-left: 0;
        border-top: 1px solid var(--border-strong);
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 24px 16px 18px;
    }
    .profile-info { width: 100%; }
    .buttons, .action-bar { justify-content: center; }
    .action-menu-list { left: auto; right: 0; }

    .profile-content { padding: 10px; max-height: none; overflow: visible; }

    /* edge fades hint that the tab row scrolls */
    .tabs-container::before,
    .tabs-container::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 1px;
        width: 24px;
        z-index: 11;
        pointer-events: none;
    }
    .tabs-container::before { left: 0;  background: linear-gradient(to right, var(--surface), transparent); }
    .tabs-container::after  { right: 0; background: linear-gradient(to left,  var(--surface), transparent); }

    .leaderboard   { padding: 16px; }
    .links-section { padding: 16px; overflow: visible; }
}

/* Portrait only */
@media (max-aspect-ratio: 1/1) {
    @keyframes blink {
        0%, 100% { opacity: 1; }
        50%      { opacity: 0.3; }
    }

    .tabs-wrapper { margin-left: 20px; }
    .scroll-container,
    .scroll-container-left { background-color: var(--bg); }

    .profile-container { width: 90vw; border-radius: 10px; }
    .main-section { flex: 1; }
    .right { padding-top: 15px; }
    .profile-pic { margin-top: 0; margin-bottom: 10px; }
    .profile-content { padding: 16px; }

    .button-front { font-size: 1.25rem; }
    .button-pushable { margin: 5px; }

    .games-grid { gap: 10px; padding: 10px; }

    #link-container { align-items: center; }
    .link-bar {
        position: relative;
        width: 90%;
        margin: 5px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    .links-section {
        width: 100%;
        border-radius: 0 0 var(--radius) var(--radius);
        border-top: var(--border-width) solid var(--border-strong);
    }
}