:root {
    --bg: #07141c;
    --surface: #10232c;
    --surface-strong: #142e38;
    --line: rgba(140, 183, 190, .16);
    --text: #eef6f4;
    --muted: #91aeb2;
    --primary: #43d7bb;
    --primary-strong: #26bda2;
    --danger: #ef7272;
    --amber: #efbe70;
    --shadow: 0 24px 64px rgba(0, 0, 0, .22);
    --radius: 18px;
    --layout-width: 90%;
    --panel-width: 100%;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 "Segoe UI", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.ambient {
    position: fixed;
    pointer-events: none;
    filter: blur(10px);
    border-radius: 999px;
    z-index: -1;
}
.ambient-one {
    top: -300px;
    right: 6%;
    width: 620px;
    height: 620px;
    background: radial-gradient(circle, rgba(25, 151, 149, .2), transparent 68%);
}
.ambient-two {
    bottom: -360px;
    left: -200px;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(42, 119, 134, .14), transparent 68%);
}

.site-header {
    height: 74px;
    width: var(--layout-width);
    max-width: none;
    margin: 0 auto;
    padding: 0 26px;
    display: flex;
    align-items: center;
    gap: 42px;
    border-bottom: 1px solid var(--line);
}
.brand {
    display: inline-flex;
    gap: 11px;
    align-items: center;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -.04em;
}
.brand-wave {
    width: 29px;
    height: 29px;
    border-radius: 10px;
    display: inline-block;
    background: linear-gradient(140deg, var(--primary), #208fa1);
    position: relative;
}
.brand-wave:after {
    content: "";
    position: absolute;
    inset: 10px 5px 7px;
    border-top: 2px solid #07141c;
    border-radius: 50%;
    transform: rotate(-10deg);
}
.nav { display: flex; align-items: center; gap: 26px; }
.nav a,
.nav-dropdown-toggle {
    color: var(--muted);
    padding: 26px 0 24px;
    border-bottom: 2px solid transparent;
    transition: color .18s, border-color .18s;
}
.nav a:hover,
.nav a.active,
.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.active,
.nav-dropdown:focus-within .nav-dropdown-toggle {
    color: var(--text);
    border-color: var(--primary);
}
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-dropdown-toggle {
    appearance: none;
    border-top: 0;
    border-right: 0;
    border-left: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.nav-dropdown-toggle span {
    font-size: 14px;
    line-height: 1;
}
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% - 9px);
    right: 0;
    z-index: 30;
    min-width: 210px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(12, 29, 38, .98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .34);
    display: grid;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity .16s, transform .16s, visibility .16s;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav-dropdown-menu a {
    padding: 9px 10px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    white-space: nowrap;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
    color: var(--text);
    background: rgba(67, 215, 187, .1);
}
.auth-nav { margin-left: auto; }
.logout-form { margin-left: 0; }
.user-chip {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
}

.userbar-wrap {
    width: var(--layout-width);
    margin: 10px auto 0;
}

.userbar {
    width: var(--panel-width);
    margin: 0 auto;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(15, 34, 43, .92);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.userbar-name {
    color: var(--text);
    font-weight: 700;
    margin-right: 0;
}

.userbar-user,
.userbar-text {
    white-space: nowrap;
}

.userbar-icon-link,
.userbar-icon-button {
    min-width: 34px;
    min-height: 34px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(21, 46, 57, .76);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
}

.userbar-icon-button {
    cursor: pointer;
}

.userbar-icon-link:hover,
.userbar-icon-button:hover {
    background: #1b3d49;
}

.userbar-icon-link.disabled {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

.userbar-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #c84f5a;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .25);
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.userbar-badge-admin {
    background: #f0a93f;
    color: #1d1406;
}

.rank {
    --rank-color: #d8e2e2;
    --rank-border: rgba(216, 226, 226, .28);
    --rank-bg: rgba(216, 226, 226, .08);
    --rank-glow: rgba(216, 226, 226, .16);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    border-radius: 999px;
    padding: 3px 10px;
    border: 1px solid var(--rank-border);
    color: var(--rank-color);
    background:
        linear-gradient(180deg, var(--rank-bg), rgba(6, 19, 25, .44)),
        rgba(17, 44, 53, .72);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .06),
        0 0 18px var(--rank-glow);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.35;
    letter-spacing: 0;
    text-shadow: 0 0 14px var(--rank-glow);
    white-space: nowrap;
    vertical-align: middle;
}

.rank-user {
    --rank-color: #d8e2e2;
    --rank-border: rgba(216, 226, 226, .3);
    --rank-bg: rgba(216, 226, 226, .08);
    --rank-glow: rgba(216, 226, 226, .13);
}

.rank-power-user {
    --rank-color: #74e3cf;
    --rank-border: rgba(116, 227, 207, .34);
    --rank-bg: rgba(116, 227, 207, .1);
    --rank-glow: rgba(116, 227, 207, .18);
}

.rank-old-user {
    --rank-color: #a7d778;
    --rank-border: rgba(167, 215, 120, .34);
    --rank-bg: rgba(167, 215, 120, .1);
    --rank-glow: rgba(167, 215, 120, .16);
}

.rank-veteran-user {
    --rank-color: #f1d36b;
    --rank-border: rgba(241, 211, 107, .38);
    --rank-bg: rgba(241, 211, 107, .1);
    --rank-glow: rgba(241, 211, 107, .18);
}

.rank-legend-user {
    --rank-color: #ff9f7a;
    --rank-border: rgba(255, 159, 122, .4);
    --rank-bg: rgba(255, 159, 122, .11);
    --rank-glow: rgba(255, 159, 122, .2);
}

.rank-vip {
    --rank-color: #d8a8ff;
    --rank-border: rgba(216, 168, 255, .4);
    --rank-bg: rgba(216, 168, 255, .11);
    --rank-glow: rgba(216, 168, 255, .22);
}

.rank-uploader {
    --rank-color: #70e0a8;
    --rank-border: rgba(112, 224, 168, .36);
    --rank-bg: rgba(112, 224, 168, .1);
    --rank-glow: rgba(112, 224, 168, .18);
}

.rank-moderator {
    --rank-color: #83d8ff;
    --rank-border: rgba(131, 216, 255, .38);
    --rank-bg: rgba(131, 216, 255, .11);
    --rank-glow: rgba(131, 216, 255, .2);
}

.rank-administrator {
    --rank-color: #efbe70;
    --rank-border: rgba(239, 190, 112, .42);
    --rank-bg: rgba(239, 190, 112, .12);
    --rank-glow: rgba(239, 190, 112, .22);
}

.rank-staff-admin {
    --rank-color: #ff9fcb;
    --rank-border: rgba(255, 159, 203, .44);
    --rank-bg: rgba(255, 159, 203, .12);
    --rank-glow: rgba(255, 159, 203, .24);
}

.rank-site-admin,
.rank-sysop {
    --rank-color: #ff7e88;
    --rank-border: rgba(255, 126, 136, .46);
    --rank-bg: rgba(255, 126, 136, .13);
    --rank-glow: rgba(255, 126, 136, .26);
}

.rank-developer {
    --rank-color: purple;
    --rank-border: rgba(128, 0, 128, .5);
    --rank-bg: rgba(128, 0, 128, .16);
    --rank-glow: rgba(128, 0, 128, .32);
}

.userbar .rank,
.detail-stat-card .rank {
    margin-left: 7px;
}

.user-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    margin-left: 5px;
    border: 0;
    color: #ffe18a;
    background: transparent;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    vertical-align: middle;
}

.user-status-disabled {
    color: #ffe18a;
}

.emoji {
    display: inline-block;
    width: 28px;
    height: 28px;
    margin: 0 2px;
    vertical-align: -7px;
    line-height: 1;
    overflow: hidden;
}

.emoji svg {
    display: block;
    width: 100%;
    height: 100%;
}

.formatted-link {
    color: #9fe4ff;
    font-weight: 700;
    text-decoration: none;
    padding: 1px 6px;
    border: 1px solid rgba(143, 220, 255, .34);
    border-radius: 6px;
    background: rgba(55, 139, 168, .18);
    overflow-wrap: anywhere;
    word-break: break-word;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.formatted-link:hover {
    color: #d8fbff;
    border-color: rgba(143, 220, 255, .7);
    background: rgba(55, 139, 168, .3);
}

.page {
    width: var(--layout-width);
    margin: 0 auto;
    padding: 46px 0 64px;
}
.page-heading {
    width: var(--panel-width);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 22px;
    margin: 0 auto 31px;
}
h1 {
    font-size: clamp(30px, 4vw, 42px);
    font-weight: 650;
    line-height: 1.12;
    letter-spacing: -.055em;
    margin: 0 0 8px;
}
h2 {
    font-size: 22px;
    letter-spacing: -.035em;
    margin: 0 0 18px;
}
.subtitle { color: var(--muted); margin: 0; }

.button {
    appearance: none;
    border: 1px solid transparent;
    border-radius: 11px;
    min-height: 45px;
    padding: 11px 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: #05201e;
    background: var(--primary);
    font: 600 14px/1 "Segoe UI", Arial, sans-serif;
    transition: transform .16s, background .16s, border-color .16s;
}
.button:hover { background: var(--primary-strong); transform: translateY(-1px); }
.button-secondary {
    color: var(--text);
    background: var(--surface-strong);
    border-color: var(--line);
}
.button-secondary:hover { background: #1a3843; }
.button-danger {
    color: #fff;
    background: #b84e55;
}
.button-danger:hover { background: #a54047; }
.button-ghost {
    color: var(--muted);
    background: transparent;
    border-color: var(--line);
    min-height: 39px;
}
.button-ghost:hover { color: var(--text); background: var(--surface); }

.panel {
    width: var(--panel-width);
    margin: 0 auto 24px;
    background: rgba(16, 35, 44, .9);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel:last-child {
    margin-bottom: 0;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 18px;
}

.block-header h2 {
    margin: 0;
}

.table-shell > .block-header {
    padding: 18px 22px;
    margin: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(20, 46, 56, .66);
}

.messages-layout > .block-header {
    grid-column: 1 / -1;
}

.number-guess-levels > .block-header,
.memory-layout > .block-header,
.staff-metrics > .block-header {
    grid-column: 1 / -1;
}

.adm-lottery-metrics > .block-header {
    grid-column: 1 / -1;
}

.panel:not(.form-card):not(.table-shell):not(.featured-strip):not(.game-guide):not(.memory-board):not(.memory-side):not(.memory-legend):not(.scratch-ticket):not(.game-result-card):not(.advent-calendar-panel):not(.number-guess-levels):not(.number-guess-guide):not(.number-guess-play):not(.number-guess-history):not(.detail-card):not(.side-links):not(.reviewer-block):not(.lottery-guide-nav):not(.lottery-guide-content):not(.helpdesk-thread):not(.helpdesk-tabs):not(.adm-helpdesk-thread):not(.adm-helpdesk-tabs):not(.staff-metrics):not(.staff-panel):not(.staff-shortcuts):not(.adm-lottery-metrics):not(.migration-panel) > .block-header:first-child {
    padding: 22px 24px 0;
}

.table-shell { overflow: hidden; }
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    padding: 17px 22px;
    color: var(--muted);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: rgba(20, 46, 56, .66);
}
td {
    padding: 19px 22px;
    border-top: 1px solid var(--line);
}
tbody tr { transition: background .16s; }
tbody tr:hover { background: rgba(40, 83, 91, .18); }
.current-session-row {
    background: rgba(67, 215, 187, .08);
}
.session-current-label {
    display: inline-flex;
    align-items: center;
    margin-left: 7px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(67, 215, 187, .32);
    color: var(--primary);
    background: rgba(67, 215, 187, .1);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.torrent-link { font-size: 16px; font-weight: 600; }
.torrent-link:hover { color: var(--primary); }
.muted { color: var(--muted); }
.seed { color: var(--primary); font-weight: 650; }
.leech { color: var(--amber); font-weight: 650; }
.empty {
    padding: 68px 20px;
    color: var(--muted);
    text-align: center;
}

.form-card {
    width: 100%;
    max-width: none;
    padding: clamp(24px, 4vw, 38px);
}
.form-grid {
    display: grid;
    gap: 20px;
}

.forum-editor {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(13, 31, 40, .76);
    overflow: hidden;
}

.forum-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(18, 42, 52, .86);
}

.forum-editor-toolbar button,
.forum-editor-toolbar a {
    min-width: 36px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(20, 46, 56, .82);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
}

.forum-editor-toolbar button:hover,
.forum-editor-toolbar a:hover {
    background: rgba(31, 69, 84, .92);
}

.forum-editor textarea {
    border: 0;
    border-radius: 0;
    background: rgba(10, 22, 30, .82);
    width: 100%;
    min-height: 180px;
}
.field { display: grid; gap: 8px; }
.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
label {
    font-size: 13px;
    font-weight: 600;
    color: #c3d5d5;
}
input, select, textarea {
    display: block;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 13px 14px;
    color: var(--text);
    background: #0c1d25;
    font: 15px/1.35 "Segoe UI", Arial, sans-serif;
}
textarea { resize: vertical; min-height: 116px; }
input::placeholder, textarea::placeholder { color: #67858a; }
.form-actions { display: flex; gap: 12px; margin-top: 6px; }
.help { margin: 0; color: var(--muted); font-size: 13px; }
.check {
    display: inline-flex;
    gap: 9px;
    align-items: center;
    color: var(--muted);
    font-weight: 400;
}
.check input { width: auto; }
.poll-option-row input[type="radio"] {
    width: auto;
    min-width: 0;
    padding: 0;
    margin: 0 4px 0 0;
    border: 0;
    background: transparent;
    flex: 0 0 auto;
    accent-color: var(--primary);
}
.poll-option-row span {
    flex: 1;
}
.rank-form {
    display: flex;
    gap: 9px;
    align-items: center;
}
.rank-form select {
    width: 148px;
    padding: 9px 11px;
}
.rank-form .button { min-height: 39px; padding: 10px 13px; }

.auth-wrap {
    min-height: calc(100vh - 215px);
    display: grid;
    place-items: center;
}
.auth-card {
    width: min(448px, 100%);
    padding: 38px;
}
.auth-card h1 { font-size: 34px; }
.auth-card .subtitle { margin-bottom: 29px; }
.auth-link {
    margin: 24px 0 0;
    color: var(--muted);
    text-align: center;
}
.auth-link a { color: var(--primary); }

.notice {
    margin: 0 0 27px;
    padding: 13px 16px;
    border-radius: 11px;
    border: 1px solid var(--line);
}
.notice-success { color: #9ef1d6; background: rgba(32, 123, 102, .18); }
.notice-error { color: #ffc0c0; background: rgba(150, 56, 62, .2); }

.stdex {
    margin: 0 0 24px;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(16, 35, 44, .9);
}

.stdex h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.stdex p {
    margin: 0;
    color: #d2dfdf;
}

.stdex-error {
    border-color: rgba(210, 88, 96, .45);
    background: rgba(120, 40, 48, .28);
}

.stdex-info {
    border-color: rgba(87, 167, 190, .44);
    background: rgba(34, 78, 94, .28);
}

.stdex-ok {
    border-color: rgba(78, 173, 137, .45);
    background: rgba(29, 88, 66, .28);
}

.details-layout {
    display: grid;
    grid-template-columns: 1fr;
    width: var(--panel-width);
    margin: 0 auto 24px;
    gap: 24px;
}

.details-layout .panel {
    width: 100%;
    margin: 0;
}

.details-layout.has-sidebar {
    grid-template-columns: minmax(0, 1fr) 300px;
}
.side-column {
    display: grid;
    gap: 16px;
    align-content: start;
}
.detail-card { padding: clamp(24px, 4vw, 38px); }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 25px 0 30px; }
.stat {
    padding: 12px 15px;
    min-width: 112px;
    border-radius: 11px;
    background: var(--surface-strong);
}
.stat span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 31px; }
.description { color: #cbdada; white-space: pre-wrap; }
.poster {
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    display: block;
}
.side-links { padding: 20px; margin-top: 0; display: grid; gap: 10px; }
.side-links a { color: var(--primary); }
.inline-form { display: inline-flex; }

.modal {
    display: none;
    position: fixed;
    inset: 0;
    padding: 40px 24px;
    background: rgba(3, 10, 14, .8);
    align-items: center;
    justify-content: center;
}
.modal.open { display: flex; }
.modal-content {
    width: min(920px, 100%);
    max-height: 82vh;
    padding: 27px;
    position: relative;
}
.modal-close { position: absolute; top: 18px; right: 18px; }
.nfo-content {
    overflow: auto;
    max-height: calc(82vh - 55px);
    margin: 0;
    color: #a5e7d2;
    font: 13px/1.48 Consolas, monospace;
    white-space: pre;
}
.site-footer {
    padding: 0 26px 34px;
    color: #648187;
    text-align: center;
    font-size: 13px;
}

.game-heading {
    align-items: flex-end;
}

.game-balance {
    min-width: 138px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(15, 34, 43, .76);
    text-align: right;
}

.game-balance span,
.game-metric span,
.game-result-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.game-balance strong {
    display: block;
    color: var(--text);
    font-size: 24px;
    line-height: 1.1;
}

.game-metrics,
.game-option-grid,
.game-guide-grid {
    width: var(--panel-width);
    margin: 0 auto 18px;
    display: grid;
    gap: 12px;
}

.game-metrics {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.game-metric,
.game-option,
.game-guide-step,
.game-result-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(10, 31, 42, .46);
}

.game-metric,
.game-guide-step,
.game-result-card {
    padding: 13px;
}

.game-metric strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 24px;
    line-height: 1.15;
}

.game-metric small,
.game-guide-step span,
.game-result-card small {
    display: block;
    color: var(--muted);
    line-height: 1.45;
}

.game-guide {
    width: var(--panel-width);
    margin-left: auto;
    margin-right: auto;
    padding: 16px;
}

.game-guide h2 {
    margin: 0 0 8px;
}

.game-guide-grid {
    width: 100%;
    margin-top: 14px;
    margin-bottom: 0;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.game-guide-step strong {
    display: block;
    margin-bottom: 5px;
}

.game-option-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.game-option {
    min-height: 168px;
    padding: 14px;
    display: grid;
    align-content: space-between;
    gap: 10px;
}

.game-option h2,
.game-option h3,
.game-result-card h2 {
    margin: 0;
}

.game-option p,
.game-result-card p {
    margin: 0;
    color: var(--muted);
}

.game-option .button {
    width: 100%;
}

.game-option.is-disabled {
    opacity: .58;
}

.game-reward-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 10px;
    border: 1px solid rgba(143, 220, 255, .3);
    border-radius: 8px;
    background: rgba(143, 220, 255, .09);
    color: #d8fbff;
    font-weight: 900;
}

.game-reward-upload {
    border-color: rgba(115, 223, 171, .36);
    background: rgba(115, 223, 171, .1);
    color: #d7ffe9;
}

.game-reward-download {
    border-color: rgba(143, 220, 255, .36);
    background: rgba(55, 139, 168, .12);
    color: #d8fbff;
}

.game-reward-vip {
    border-color: rgba(214, 169, 255, .46);
    background: rgba(122, 82, 158, .18);
    color: #efd8ff;
}

.game-reward-invite {
    border-color: rgba(239, 190, 112, .38);
    background: rgba(239, 190, 112, .11);
    color: #ffe6bd;
}

.scratch-stage {
    width: var(--panel-width);
    margin: 0 auto 18px;
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(260px, 390px);
    gap: 18px;
    align-items: stretch;
}

.scratch-ticket {
    min-height: 330px;
    padding: 22px;
    display: grid;
    place-items: center;
    text-align: center;
}

.scratch-surface {
    position: relative;
    width: min(100%, 420px);
    min-height: 210px;
    padding: 22px;
    border: 1px solid rgba(143, 220, 255, .3);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .08), transparent 34%),
        repeating-linear-gradient(-35deg, rgba(143, 220, 255, .12) 0 9px, rgba(67, 215, 187, .08) 9px 18px),
        rgba(10, 31, 42, .74);
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 12px;
    overflow: hidden;
}

.scratch-surface.is-revealed {
    background:
        radial-gradient(circle at top, rgba(67, 215, 187, .24), transparent 58%),
        rgba(10, 31, 42, .76);
}

.scratch-content {
    position: relative;
    z-index: 1;
    display: grid;
    justify-items: center;
    gap: 12px;
}

.scratch-canvas {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
    transition: opacity .22s ease;
}

.scratch-help {
    position: absolute;
    left: 50%;
    bottom: 12px;
    z-index: 4;
    width: calc(100% - 28px);
    transform: translateX(-50%);
    color: rgba(7, 20, 28, .74);
    font-size: 13px;
    font-weight: 900;
    text-align: center;
    pointer-events: none;
    transition: opacity .18s ease;
}

.scratch-surface.is-scratching .scratch-help {
    opacity: 0;
}

.scratch-surface.is-revealed .scratch-canvas,
.scratch-surface.is-revealed .scratch-help {
    opacity: 0;
    pointer-events: none;
}

.scratch-surface strong {
    font-size: clamp(28px, 5vw, 54px);
    line-height: 1;
}

.chest-grid {
    width: var(--panel-width);
    margin: 0 auto 18px;
    display: grid;
    grid-template-columns: repeat(3, minmax(210px, 1fr));
    gap: 14px;
}

.chest-option {
    padding: 16px;
    display: grid;
    gap: 14px;
    text-align: center;
}

.chest-art {
    width: 118px;
    height: 92px;
    margin: 0 auto;
    border: 1px solid rgba(239, 190, 112, .44);
    border-radius: 12px 12px 8px 8px;
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, .12), transparent 42%),
        linear-gradient(135deg, rgba(239, 190, 112, .35), rgba(111, 75, 45, .7));
    position: relative;
    box-shadow: inset 0 -18px 0 rgba(0, 0, 0, .16);
}

.chest-art:before,
.chest-art:after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.chest-art:before {
    top: 38px;
    width: 100%;
    border-top: 4px solid rgba(7, 20, 28, .7);
}

.chest-art:after {
    top: 33px;
    width: 26px;
    height: 24px;
    border: 1px solid rgba(255, 236, 177, .8);
    border-radius: 5px;
    background: rgba(239, 190, 112, .72);
}

.chest-art.wood {
    border-color: rgba(181, 126, 72, .55);
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, .08), transparent 42%),
        repeating-linear-gradient(90deg, rgba(94, 56, 31, .78) 0 17px, rgba(123, 78, 43, .82) 17px 34px);
}

.chest-art.plastic {
    border-color: rgba(111, 213, 236, .48);
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, .2), transparent 42%),
        linear-gradient(135deg, rgba(58, 189, 213, .45), rgba(25, 78, 102, .8));
}

.chest-art.bronze {
    border-color: rgba(206, 128, 74, .58);
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, .13), transparent 42%),
        linear-gradient(135deg, rgba(210, 124, 68, .46), rgba(92, 53, 34, .78));
}

.chest-art.silver {
    border-color: rgba(202, 222, 230, .5);
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, .18), transparent 42%),
        linear-gradient(135deg, rgba(202, 222, 230, .34), rgba(67, 90, 103, .76));
}

.chest-art.gold {
    border-color: rgba(255, 226, 130, .64);
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, .22), transparent 42%),
        linear-gradient(135deg, rgba(255, 219, 91, .48), rgba(142, 91, 29, .76));
}

.chest-art.diamond {
    border-color: rgba(158, 238, 255, .72);
    background:
        linear-gradient(to bottom, rgba(255, 255, 255, .3), transparent 42%),
        linear-gradient(135deg, rgba(174, 244, 255, .62), rgba(62, 128, 180, .84));
    box-shadow:
        inset 0 -18px 0 rgba(0, 0, 0, .12),
        0 0 24px rgba(109, 222, 255, .18);
}

.chest-art.diamond:after {
    border-color: rgba(255, 255, 255, .92);
    background: rgba(177, 244, 255, .82);
}

.memory-game-shell {
    width: 100%;
    margin: 0 auto 28px;
}

.memory-arcade {
    display: grid;
    gap: 14px;
}

.memory-app-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.memory-brand-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.memory-app-icon {
    width: 36px;
    height: 36px;
    color: #8ee7ff;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    flex: 0 0 auto;
}

.memory-app-icon i {
    border: 2px solid currentColor;
    border-radius: 5px;
    opacity: .9;
}

.memory-title-block h1 {
    margin: 0;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.02;
}

.memory-title-block p {
    max-width: 700px;
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

.memory-back-button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(132, 213, 222, .2);
    border-radius: 8px;
    background: rgba(9, 27, 35, .82);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}

.memory-back-button:hover {
    border-color: rgba(67, 215, 187, .42);
    color: #9ef1d6;
}

.memory-back-button span {
    font-size: 24px;
    line-height: 1;
}

.memory-hud-item span {
    display: block;
    color: #74eee0;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.memory-ajax-message {
    padding: 12px 14px;
    border: 1px solid rgba(78, 173, 137, .45);
    border-radius: 8px;
    background: rgba(29, 88, 66, .28);
    color: #9ef1d6;
    font-weight: 700;
    transform-origin: top;
    animation: memory-message-in .18s ease both;
}

.memory-ajax-message[hidden] {
    display: none;
}

.memory-ajax-message-error {
    border-color: rgba(210, 88, 96, .45);
    background: rgba(120, 40, 48, .28);
    color: #ffc0c0;
}

.memory-hud {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.memory-hud-item {
    min-height: 92px;
    padding: 14px;
    border: 1px solid rgba(132, 213, 222, .15);
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(16, 45, 56, .92), rgba(9, 27, 35, .92));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.memory-hud-item strong {
    display: block;
    margin-top: 7px;
    color: var(--text);
    font-size: clamp(22px, 3vw, 32px);
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.memory-hud-item small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.memory-hud-balance {
    border-color: rgba(67, 215, 187, .34);
    background:
        linear-gradient(180deg, rgba(18, 57, 61, .92), rgba(9, 27, 35, .92)),
        linear-gradient(135deg, rgba(67, 215, 187, .12), transparent 58%);
}

.memory-progress {
    height: 7px;
    margin-top: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
}

.memory-progress i {
    display: block;
    width: var(--value, 0%);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #43d7bb, #8ee7ff);
    transition: width .28s ease;
}

.memory-progress-danger i {
    background: linear-gradient(90deg, #43d7bb, #efbe70);
}

[data-memory-game].is-ajax-busy {
    cursor: progress;
}

[data-memory-game].is-ajax-busy[data-memory-busy="start"] .memory-board,
[data-memory-game].is-ajax-busy[data-memory-busy="start"] .memory-side,
[data-memory-game].is-ajax-busy[data-memory-busy="reset"] .memory-board,
[data-memory-game].is-ajax-busy[data-memory-busy="reset"] .memory-side {
    opacity: .74;
    transform: scale(.997);
}

.memory-layout {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 370px);
    gap: 14px;
    align-items: start;
    transition: opacity .18s ease, transform .18s ease;
}

.memory-layout.is-entering {
    opacity: .86;
    transform: translateY(5px);
}

.memory-board,
.memory-side,
.memory-guide,
.memory-legend {
    width: 100%;
    border-radius: 8px;
    border-color: rgba(132, 213, 222, .16);
    background: linear-gradient(180deg, rgba(13, 35, 45, .94), rgba(7, 22, 30, .96));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045), 0 18px 50px rgba(0, 0, 0, .18);
}

.memory-board {
    padding: 0;
    border-color: rgba(0, 194, 224, .34);
    overflow: hidden;
}

.memory-board-header {
    min-height: 76px;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(132, 213, 222, .12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.memory-board-header h2,
.memory-side h2,
.memory-guide h2,
.memory-legend h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.15;
}

.memory-board-header p,
.memory-side p {
    margin: 5px 0 0;
    color: var(--muted);
}

.memory-status-chip {
    flex: 0 0 auto;
    padding: 7px 10px;
    border: 1px solid rgba(67, 215, 187, .28);
    border-radius: 8px;
    color: #9ef1d6;
    background: rgba(67, 215, 187, .1);
    font-size: 13px;
    font-weight: 800;
}

.memory-empty-state {
    min-height: 360px;
    margin: 18px;
    padding: 24px;
    border: 1px dashed rgba(132, 213, 222, .24);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(67, 215, 187, .08), transparent 45%),
        rgba(5, 18, 26, .45);
    display: grid;
    place-content: center;
    gap: 8px;
    text-align: center;
}

.memory-empty-state strong {
    font-size: 28px;
}

.memory-empty-state span {
    max-width: 440px;
    color: var(--muted);
}

.memory-board-frame {
    padding: clamp(14px, 2vw, 24px);
    background:
        linear-gradient(90deg, rgba(67, 215, 187, .07), transparent 28%, transparent 72%, rgba(143, 220, 255, .06)),
        rgba(5, 18, 26, .44);
}

.memory-cards {
    max-width: min(760px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(var(--memory-columns, 4), minmax(54px, 1fr));
    gap: clamp(8px, 1.1vw, 14px);
    perspective: 1000px;
}

.memory-cards form {
    margin: 0;
    min-width: 0;
}

.memory-card {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    overflow: hidden;
    border: 1px solid rgba(132, 213, 222, .22);
    border-radius: 8px;
    background:
        linear-gradient(145deg, rgba(25, 64, 78, .98), rgba(8, 24, 33, .98)),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, .03) 0 5px, transparent 5px 13px);
    color: #eafffb;
    font-size: clamp(25px, 4.2vw, 46px);
    font-weight: 900;
    cursor: pointer;
    display: grid;
    place-items: center;
    backface-visibility: hidden;
    transform: translateZ(0);
    transform-style: preserve-3d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 10px 22px rgba(0, 0, 0, .2);
    transition:
        background-color .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        color .18s ease,
        transform .18s ease,
        filter .18s ease;
    will-change: transform;
}

.memory-card:before {
    content: "";
    position: absolute;
    inset: 9%;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 7px;
    pointer-events: none;
}

.memory-card-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, .12), transparent 34%, transparent 72%, rgba(67, 215, 187, .08));
    opacity: .72;
    pointer-events: none;
}

.memory-card-value {
    position: relative;
    z-index: 1;
    line-height: 1;
}

.memory-card:hover:not(:disabled) {
    border-color: rgba(143, 220, 255, .58);
    filter: brightness(1.08);
    transform: translateY(-2px) scale(1.01);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 16px 28px rgba(0, 0, 0, .26);
}

.memory-card.is-open,
.memory-card.is-matched {
    background: linear-gradient(145deg, rgba(51, 157, 139, .94), rgba(14, 61, 67, .98));
    border-color: rgba(94, 237, 207, .58);
    color: #f5fffc;
}

.memory-card.is-matched {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 0 0 3px rgba(67, 215, 187, .13), 0 14px 28px rgba(0, 0, 0, .22);
}

.memory-card.is-mismatch-review {
    background: linear-gradient(145deg, rgba(168, 108, 42, .96), rgba(64, 45, 28, .98));
    border-color: rgba(239, 190, 112, .72);
    color: #fff0c7;
    box-shadow: 0 0 0 3px rgba(239, 190, 112, .12), 0 14px 28px rgba(0, 0, 0, .22);
}

.memory-card.is-pending {
    border-color: rgba(143, 220, 255, .82);
    box-shadow: 0 0 0 3px rgba(143, 220, 255, .13), 0 12px 24px rgba(0, 0, 0, .2);
    transform: scale(.97);
}

.memory-card.is-just-opened {
    animation: memory-card-open .34s cubic-bezier(.2, .75, .2, 1) both;
}

.memory-card.is-just-matched {
    animation: memory-card-match .52s cubic-bezier(.18, .8, .22, 1) both;
}

.memory-card.is-returning {
    animation: memory-card-return .34s ease both;
}

.memory-card:disabled {
    cursor: default;
}

[data-memory-game].is-reviewing-mismatch .memory-card:not(.is-open):not(.is-matched) {
    pointer-events: none;
}

.memory-side {
    padding: 16px;
    display: grid;
    gap: 14px;
}

.memory-side-head {
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(132, 213, 222, .12);
}

.memory-side-head h2 {
    color: #b6c8d8;
    font-size: 18px;
    text-transform: uppercase;
}

.memory-control-label {
    margin: 0;
    color: #9fb4ca;
    font-size: 13px;
    text-transform: uppercase;
}

.memory-levels {
    display: grid;
    gap: 10px;
}

.memory-level {
    padding: 12px;
    border: 1px solid rgba(132, 213, 222, .16);
    border-radius: 8px;
    background: rgba(10, 31, 42, .48);
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 9px 12px;
    align-items: center;
    transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

.memory-level:hover {
    border-color: rgba(67, 215, 187, .36);
    background: rgba(12, 40, 50, .72);
    transform: translateY(-1px);
}

.memory-level.is-current {
    border-color: rgba(67, 215, 187, .58);
    background: rgba(34, 112, 97, .18);
}

.memory-level.is-disabled {
    opacity: .58;
}

.memory-level h3 {
    margin: 0;
    font-size: 16px;
}

.memory-level-bars {
    width: 24px;
    height: 24px;
    color: #74eee0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
}

.memory-level-bars i {
    width: 5px;
    border-radius: 3px 3px 0 0;
    background: currentColor;
    box-shadow: 0 0 12px rgba(67, 215, 187, .14);
}

.memory-level-bars i:nth-child(1) {
    height: 8px;
    opacity: .54;
}

.memory-level-bars i:nth-child(2) {
    height: 14px;
    opacity: .76;
}

.memory-level-bars i:nth-child(3) {
    height: 20px;
}

.memory-level small,
.memory-level-cost {
    color: var(--muted);
}

.memory-level-cost {
    text-align: right;
    white-space: nowrap;
    font-weight: 800;
}

.memory-level .button {
    grid-column: 1 / -1;
    width: 100%;
}

.memory-reset-form {
    margin: 0;
}

.memory-reset-form .button {
    width: 100%;
}

.memory-guide {
    padding: 16px;
}

.memory-guide .game-guide-grid {
    margin-top: 12px;
}

.memory-legend {
    padding: 16px;
}

.memory-legend dl {
    margin: 14px 0 0;
    display: grid;
    gap: 10px;
}

.memory-legend div {
    display: flex;
    align-items: center;
    gap: 10px;
}

.memory-legend dt,
.memory-legend dd {
    margin: 0;
}

.memory-legend i {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(132, 213, 222, .22);
    border-radius: 5px;
    display: block;
    background: rgba(10, 31, 42, .62);
}

.memory-legend .legend-open {
    border-color: rgba(94, 237, 207, .58);
    background: rgba(51, 157, 139, .62);
}

.memory-legend .legend-match {
    border-color: rgba(67, 215, 187, .74);
    background: linear-gradient(145deg, rgba(51, 157, 139, .92), rgba(14, 61, 67, .98));
    box-shadow: 0 0 0 3px rgba(67, 215, 187, .12);
}

.memory-legend .legend-miss {
    border-color: rgba(239, 190, 112, .72);
    background: rgba(168, 108, 42, .72);
}

@keyframes memory-message-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes memory-card-open {
    0% {
        transform: rotateY(0deg) scale(.98);
    }

    48% {
        transform: rotateY(88deg) scale(.985);
    }

    100% {
        transform: rotateY(0deg) scale(1);
    }
}

@keyframes memory-card-match {
    0%,
    100% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.055);
        box-shadow: 0 0 0 6px rgba(67, 215, 187, .16), 0 14px 28px rgba(0, 0, 0, .24);
    }
}

@keyframes memory-card-return {
    0% {
        transform: rotateY(0deg) scale(1);
    }

    55% {
        transform: rotateY(88deg) scale(.98);
    }

    100% {
        transform: rotateY(0deg) scale(.96);
    }
}

@media (prefers-reduced-motion: reduce) {
    .memory-card,
    .memory-level,
    .memory-progress i {
        transition: none;
    }

    .memory-ajax-message,
    .memory-card.is-just-opened,
    .memory-card.is-just-matched,
    .memory-card.is-returning {
        animation: none;
    }
}

@media (max-width: 900px) {
    .chest-grid,
    .memory-layout,
    .scratch-stage {
        grid-template-columns: 1fr;
    }

    .memory-hud {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .memory-hud-balance {
        grid-column: span 2;
    }

    .memory-cards {
        grid-template-columns: repeat(var(--memory-mobile-columns, 4), minmax(48px, 1fr));
    }
}

@media (max-width: 760px) {
    .site-header { height: auto; min-height: 70px; padding: 14px 18px; gap: 18px; flex-wrap: wrap; }
    .nav { order: 3; width: 100%; gap: 22px; flex-wrap: wrap; }
    .nav a,
    .nav-dropdown-toggle { padding: 10px 0; }
    .nav-dropdown-menu { top: 100%; left: 0; right: auto; }
    .auth-nav { order: initial; width: auto; }
    .user-chip { margin-left: auto; }
    .page { width: min(100% - 34px, 1148px); padding-top: 32px; }
    .userbar-wrap { width: min(100% - 34px, 1148px); }
    .userbar { width: 100%; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .panel,
    .page-heading,
    .details-layout { width: 100%; }
    .table-shell { overflow-x: auto; }
    table { min-width: 650px; }
    .field-row, .details-layout { grid-template-columns: 1fr; }
    .announce-row { flex-direction: column; }
    .side-column { order: -1; max-width: 310px; }
    .game-heading { align-items: stretch; }
    .game-balance { text-align: left; }
    .memory-game-shell { width: 100%; }
    .memory-app-header { align-items: flex-start; flex-direction: column; }
    .memory-back-button { align-self: flex-start; }
    .memory-hud { grid-template-columns: 1fr; }
    .memory-hud-balance { grid-column: auto; }
    .memory-board-header { align-items: flex-start; flex-direction: column; }
    .game-metrics,
    .game-option-grid,
    .game-guide,
    .chest-grid,
    .memory-layout,
    .memory-ajax-message,
    .scratch-stage { width: 100%; }
}
