:root {
    --bg: #060b17;
    --bg-alt: #0d1830;
    --panel: #15253f;
    --panel-strong: #21385d;
    --border: #3e618a;
    --gold: #d8a94f;
    --gold-dark: #715426;
    --text: #eaf2ff;
    --muted: #b8cdea;
    --accent: #4b8be8;
    --accent-hover: #68a2f5;
    --success: #20c16f;
    --pet-tile-width: 108px;
    --pet-thumb-size: 72px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px;
    font-family: Trebuchet MS, Verdana, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 8%, #273f69 0%, transparent 36%),
        radial-gradient(circle at 84% 0%, #1a3054 0%, transparent 34%),
        repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.015) 0,
            rgba(255, 255, 255, 0.015) 1px,
            transparent 1px,
            transparent 4px
        ),
        linear-gradient(180deg, var(--bg-alt), var(--bg));
    min-height: 100vh;
}

.top-auth {
    position: fixed;
    top: 16px;
    right: 24px;
    z-index: 150;
}

a {
    color: #94bdff;
}

h1, h2, h3, h4 {
    margin-top: 0;
    color: #f8edd8;
    text-shadow: 0 1px 0 #2d1f11;
}

h1 {
    letter-spacing: 0.4px;
    margin-bottom: 12px;
}

.title-link,
.title-link:visited,
.title-link:hover,
.title-link:active {
    color: inherit;
    text-decoration: none;
}

.page-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.page-actions-left,
.page-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-actions-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.account-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.autorefresh-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 10px;
    text-align: left;
}

.autorefresh-sound-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 0;
}

.autorefresh-status {
    display: block;
    margin-top: 0;
    padding-left: 62px;
    text-align: left;
}

.page-actions-right {
    margin-left: auto;
}

.inline-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 14px;
}

.section-title {
    display: inline;
    margin: 0;
}

.empty-message {
    color: #ff9ea0;
}

.trade-card {
    border: 1px solid var(--gold-dark);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 20%),
        linear-gradient(180deg, #233d64, #15263f 65%, #122136);
    border-radius: 12px;
    padding: 12px;
    margin: 0 0 12px;
    box-shadow:
        inset 0 1px 0 rgba(255, 233, 189, 0.15),
        inset 0 -1px 0 rgba(5, 8, 16, 0.7),
        0 10px 24px rgba(0, 0, 0, 0.35);
    break-inside: avoid;
    page-break-inside: avoid;
}

.trades-grid {
    column-width: 420px;
    column-gap: 12px;
    position: relative;
}

.trades-grid.masonry-active {
    column-width: auto;
    column-count: auto;
}

.trades-grid.masonry-active .trade-card {
    margin: 0;
}

.trades-grid.masonry-linear {
    column-width: auto;
    column-count: 1;
}

.trades-grid.masonry-linear .trade-card {
    margin: 0 0 12px;
}

.trade-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.own-post-username {
    color: #ffd27a;
}

.trade-mode-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: #ffe8e8;
    background: linear-gradient(180deg, rgba(170, 44, 44, 0.85), rgba(130, 27, 27, 0.88));
    border: 1px solid #ff8f8f;
    border-radius: 999px;
    padding: 3px 9px;
    margin-left: auto;
    cursor: help;
}

.trade-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.trade-section {
    min-width: 0;
}

.trade-section + .trade-section {
    border-left: 1px solid rgba(120, 154, 198, 0.35);
    padding-left: 10px;
}

.trade-section b {
    display: block;
    margin-bottom: 4px;
}

.pet-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.muted {
    color: var(--muted);
}

.primary-btn,
button {
    background:
        linear-gradient(180deg, #f1cb82, #d4a252 52%, #b8843f 53%, #9f6f32);
    color: #1f1408;
    border: 1px solid #6f4d21;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    text-shadow: 0 1px 0 rgba(255, 240, 220, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 245, 220, 0.5),
        inset 0 -2px 0 rgba(88, 52, 18, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.3);
    transition: filter 0.2s, transform 0.08s;
}

.primary-btn:hover,
button:hover {
    filter: brightness(1.05);
}

.primary-btn:active,
button:active {
    transform: translateY(1px);
}

.discord-btn {
    display: inline-block;
    text-decoration: none;
    background: linear-gradient(180deg, #7289da, #5865f2 52%, #4d59d9 53%, #3f49b2);
    color: #ffffff;
    border: 1px solid #2f3a9b;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    text-shadow: 0 1px 0 rgba(22, 27, 80, 0.45);
    box-shadow:
        inset 0 1px 0 rgba(199, 208, 255, 0.28),
        inset 0 -2px 0 rgba(36, 45, 120, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.3);
    transition: filter 0.2s, transform 0.08s;
}

.discord-btn:hover {
    filter: brightness(1.08);
}

.discord-btn:active {
    transform: translateY(1px);
}

.danger-btn {
    background: linear-gradient(180deg, #e97878, #c94f4f 52%, #b33b3b 53%, #8a2525);
    color: #fff3f3;
    border: 1px solid #6f1e1e;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    text-shadow: 0 1px 0 rgba(64, 10, 10, 0.4);
    box-shadow:
        inset 0 1px 0 rgba(255, 206, 206, 0.25),
        inset 0 -2px 0 rgba(99, 17, 17, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.danger-btn:hover {
    filter: brightness(1.05);
}

.danger-btn:active {
    transform: translateY(1px);
}

.warn-btn {
    background: linear-gradient(180deg, #e8b84b, #c98f20 52%, #b87d10 53%, #8a5c08);
    color: #fff8e0;
    border: 1px solid #6f4a0a;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 700;
    text-shadow: 0 1px 0 rgba(64, 40, 0, 0.4);
    box-shadow:
        inset 0 1px 0 rgba(255, 240, 160, 0.25),
        inset 0 -2px 0 rgba(99, 60, 5, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.3);
}

.warn-btn:hover {
    filter: brightness(1.05);
}

.warn-btn:active {
    transform: translateY(1px);
}

.admin-mode-active {
    outline: 2px solid #e8b84b;
    outline-offset: 2px;
}

.banned-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.banned-table th,
.banned-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(167, 198, 241, 0.15);
}

.banned-table th {
    color: #a7c6f1;
    font-weight: 700;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.history-table {
    table-layout: fixed;
}

.pets-expand {
    cursor: pointer;
}

.pets-expand summary {
    color: #a7c6f1;
    font-weight: 700;
}

.pets-expand-content {
    margin-top: 6px;
    color: #d8e6ff;
    line-height: 1.4;
    word-break: break-word;
}

.expiry-early {
    color: #ff8a8a;
    font-weight: 700;
}

.expiry-fulfilled {
    color: var(--gold);
    font-weight: 700;
}

.inline-form {
    display: inline-block;
    margin-top: 8px;
}

.ban-note-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 320px;
}

.ban-note-textarea {
    width: 100%;
    min-height: 76px;
    resize: vertical;
    font: inherit;
}

.contact-btn {
    margin-bottom: 8px;
}

.top-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 160px;
    min-height: 40px;
    font-size: 14px;
    line-height: 1;
    text-align: center;
}

.post-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 190px;
    min-height: 40px;
    font-size: 14px;
    line-height: 1;
    text-align: center;
}

.post-timestamps {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(80, 112, 154, 0.15);
    font-size: 11px;
}

.fancy-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-weight: 700;
    user-select: none;
}

.fancy-toggle.compact {
    margin-left: 0;
}

.fancy-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fancy-toggle-slider {
    position: relative;
    width: 52px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid #445f87;
    background: linear-gradient(180deg, #162c4d, #102440);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 0 rgba(0, 0, 0, 0.35),
        0 2px 8px rgba(0, 0, 0, 0.28);
    transition: background 0.2s, border-color 0.2s;
}

.fancy-toggle-slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(180deg, #f9fbff, #cdd9ee);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 2px 6px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s;
}

.fancy-toggle input[type="checkbox"]:checked + .fancy-toggle-slider {
    background: linear-gradient(180deg, #2a5d9d, #1f4a84);
    border-color: #6e97cf;
}

.fancy-toggle input[type="checkbox"]:checked + .fancy-toggle-slider::after {
    transform: translateX(24px);
}

.fancy-toggle-label {
    line-height: 1;
}

.hp-field {
    position: absolute;
    left: -99999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.text-input {
    background: linear-gradient(180deg, #122744, #0d1e35);
    color: #f2f7ff;
    border: 1px solid #43658d;
    border-radius: 8px;
    padding: 8px 10px;
    min-width: 220px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.admin-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 8px 0 10px;
}

.admin-filters .text-input {
    min-width: 180px;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 7, 14, 0.8);
    z-index: 100;
    overflow-y: auto;
}

.modal:target {
    display: block;
}

.modal-content {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 22%),
        linear-gradient(180deg, #24426d, #172a47);
    margin: 40px auto;
    padding: 24px;
    max-width: 960px;
    border-radius: 12px;
    border: 1px solid var(--gold-dark);
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 227, 169, 0.18),
        0 18px 38px rgba(0, 0, 0, 0.45);
}

.help-modal-content {
    max-width: 780px;
}

.help-modal-content p {
    margin: 10px 0;
    line-height: 1.55;
}

.help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.help-tradeable-img {
    display: block;
    max-width: 100%;
    margin: 10px auto 14px;
    border-radius: 10px;
}

#filter-form button,
#filter-form a,
.page-actions .discord-btn,
.page-actions .primary-btn,
.inline-actions .primary-btn,
.contact-btn,
.danger-btn {
    min-height: 40px;
}

.inline-actions .inline-form {
    margin-top: 0;
    display: flex;
    align-items: center;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 18px;
    background: transparent;
    border: none;
    color: #ffefcc;
    cursor: pointer;
}

.confirm-dialog-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(1, 6, 12, 0.78);
    z-index: 250;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.confirm-dialog-backdrop.is-open {
    display: flex;
}

.confirm-dialog {
    width: min(460px, 100%);
    border: 1px solid var(--gold-dark);
    border-radius: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 20%),
        linear-gradient(180deg, #233d64, #15263f 65%, #122136);
    box-shadow:
        inset 0 1px 0 rgba(255, 233, 189, 0.15),
        0 22px 42px rgba(0, 0, 0, 0.5);
    padding: 16px;
    outline: none;
}

.confirm-dialog h3 {
    margin: 0 0 8px;
}

.confirm-dialog p {
    margin: 0;
    line-height: 1.45;
}

.confirm-dialog-note-group {
    margin-top: 14px;
}

.confirm-dialog-note-group label {
    display: block;
.confirm-dialog-note-error {
    display: block;
    margin-top: 6px;
    color: #ff9ea0;
}

    margin-bottom: 6px;
    color: #f8edd8;
    font-weight: 700;
}

.confirm-dialog-note-input {
    width: 100%;
    min-height: 96px;
    resize: vertical;
    font: inherit;
}

.reports-table {
    table-layout: fixed;
}

.report-reason-cell {
    white-space: pre-wrap;
    word-break: break-word;
}
.confirm-dialog-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.two-col {
    display: flex;
    gap: 24px;
}

.col {
    flex: 1;
    min-width: 0;
}

.post {
    border: 1px solid #ccc;
    padding: 10px;
    margin: 10px 0;
}

.pets {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pet {
    width: 84px;
    min-height: 98px;
    text-align: center;
    display: inline-flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 4px;
    margin: 0;
    border-radius: 6px;
    border: 2px solid #cccccc;
}

.pet img {
    width: 52px;
    height: 52px;
    object-fit: contain;
}

.alert {
    background: rgba(32, 193, 111, 0.16);
    color: #cbffe4;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #197f4f;
    border-radius: 5px;
}

.fail {
    background: rgba(255, 158, 160, 0.16);
    color: #ff9ea0;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ff6f70;
    border-radius: 5px;
}

.match-have {
    background-color: rgba(32, 193, 111, 0.28);
    outline: 1px solid rgba(42, 236, 139, 0.75);
}

.match-want {
    background-color: rgba(66, 161, 255, 0.25);
    outline: 1px solid rgba(111, 189, 255, 0.8);
}

.pet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 80px);
    gap: 6px;
}

.pet-option:has(input:checked) {
    background: linear-gradient(180deg, rgba(44, 86, 138, 0.55), rgba(31, 61, 102, 0.52));
    outline: 1px solid #6690cc;
}

.pet-option {
    width: var(--pet-tile-width);
    min-height: 122px;
    display: inline-flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    margin: 4px;
    padding: 4px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: center;
    border: 2px solid #cccccc;
    background: rgba(10, 22, 40, 0.35);
}

.pet-option.selected {
    background: linear-gradient(180deg, rgba(44, 86, 138, 0.55), rgba(31, 61, 102, 0.52));
    outline: 1px solid #6690cc;
}

.pet-option img {
    display: block;
    margin: 0 auto;
    width: var(--pet-thumb-size);
    height: var(--pet-thumb-size);
    object-fit: contain;
}

.pet-option div {
    color: var(--text);
    font-size: 12px;
}

.pet-option input[type="checkbox"] {
    display: none !important;
}

details {
    background: linear-gradient(180deg, rgba(15, 32, 56, 0.62), rgba(12, 25, 44, 0.62));
    border: 1px solid rgba(93, 127, 171, 0.45);
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 6px 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

details summary {
    user-select: none;
    color: #f7e4c0;
    cursor: pointer;
    font-weight: 700;
    margin: 4px 0;
}

.trade-mode-setting {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid rgba(93, 127, 171, 0.5);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(15, 32, 56, 0.42), rgba(12, 25, 44, 0.42));
    color: var(--muted);
}

.trade-mode-setting input[type="checkbox"] {
    margin-top: 2px;
}

.pet-option[data-rarity="Common"],
.pet[data-rarity="Common"] {
    border-color: #cccccc;
}

.pet-option[data-rarity="Uncommon"],
.pet[data-rarity="Uncommon"] {
    border-color: rgb(60, 143, 56);
}

.pet-option[data-rarity="Rare"],
.pet[data-rarity="Rare"] {
    border-color: rgb(91, 24, 99);
}

.pet-option[data-rarity="Legendary"],
.pet[data-rarity="Legendary"] {
    border-color: rgb(160, 135, 45);
}

.pet-option[data-rarity="Mythical"],
.pet[data-rarity="Mythical"] {
    border-color: rgb(27, 108, 155);
}

.pet-option[data-rarity="Exclusive"],
.pet[data-rarity="Exclusive"] {
    border-color: #c24e43;
}

.pet-option[data-rarity="None"],
.pet[data-rarity="None"] {
    border-color: #cccccc;
}

hr {
    border: 0;
    border-top: 1px solid #314c72;
    margin: 18px 0;
}

.site-disclaimer {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(80, 112, 154, 0.45);
    color: #9eb6d8;
    font-size: 12px;
    text-align: center;
}

.site-disclaimer a {
    color: #d8a94f;
}

@media (max-width: 900px) {
    .two-col {
        flex-direction: column;
        gap: 10px;
    }

    .page-actions {
        flex-wrap: wrap;
    }

    .page-actions-right {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .inline-actions {
        flex-wrap: wrap;
    }

    .trades-grid {
        column-width: auto;
        column-count: 1;
    }

    .trade-sections {
        grid-template-columns: 1fr;
    }

    .trade-section + .trade-section {
        border-left: 0;
        border-top: 1px solid rgba(120, 154, 198, 0.35);
        padding-left: 0;
        padding-top: 8px;
        margin-top: 4px;
    }

    body {
        padding: 14px;
    }

    .top-auth {
        top: 10px;
        right: 14px;
    }

    .modal-content {
        margin: 18px auto;
        width: calc(100% - 20px);
        max-width: 100%;
        padding: 16px;
    }

    .pet-option {
        width: 100px;
        min-height: 116px;
    }

    .pet-option img {
        width: 64px;
        height: 64px;
    }

}

@media (max-width: 640px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 24px;
        line-height: 1.2;
        margin-bottom: 10px;
        padding-right: 0;
    }

    .top-auth {
        position: static;
        margin-bottom: 10px;
    }

    .top-auth .discord-btn {
        width: 100%;
        text-align: center;
    }

    .page-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .page-actions-left,
    .page-actions-right,
    .inline-actions {
        width: 100%;
    }

    .page-actions-right {
        margin-left: 0;
    }

    .page-actions .primary-btn,
    .page-actions .discord-btn,
    .inline-actions .primary-btn,
    .contact-btn,
    .danger-btn,
    #filter-form button {
        width: 100%;
        text-align: center;
    }

    .inline-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .section-title {
        display: block;
    }

    .account-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .pet {
        width: 74px;
        min-height: 92px;
        font-size: 12px;
    }

    .pet img {
        width: 48px;
        height: 48px;
    }

    .pet-option {
        width: 92px;
        min-height: 110px;
        margin: 3px;
        padding: 3px;
    }

    .pet-option img {
        width: 56px;
        height: 56px;
    }

    .pet-option div {
        font-size: 11px;
    }

    .trade-card {
        padding: 10px;
    }

    .trade-header {
        font-size: 16px;
    }

    .site-disclaimer {
        font-size: 11px;
        line-height: 1.4;
    }
}

p strong {
    color: #d8a94f;
}