* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    padding: 24px;
    background: #fff;
    color: #111;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.user-page {
    padding: 0;
}

body.admin-page {
    padding: 0;
}

body.auth-page {
    display: block;
    padding: 0;
}

a {
    color: #111;
    text-decoration: none;
}

a:hover {
    color: #555;
}

.auth-card {
    width: min(100%, 420px);
    padding: 38px;
    border: 1px solid #ddd;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 70px #00000012;
}

.auth-page .auth-card {
    width: 100%;
    min-height: 100vh;
    padding: clamp(20px, 3vw, 40px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.brand {
    display: inline-block;
    margin-bottom: 30px;
    color: #111;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: 1px;
}

.brand span {
    color: #555;
    font-size: 12px;
}

h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.subtitle {
    margin: 0 0 26px;
    color: #666;
}

form label {
    display: block;
    margin: 17px 0 8px;
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

input:not([type="hidden"]) {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid #ccc;
    border-radius: 9px;
    outline: none;
    background: #fff;
    color: #111;
    font: inherit;
}

input:focus {
    border-color: #111;
}

button {
    width: 100%;
    min-height: 48px;
    margin-top: 24px;
    border: 0;
    border-radius: 9px;
    background: #111;
    color: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

button:hover {
    background: #333;
}

.switch-page {
    margin: 22px 0 0;
    color: #666;
    text-align: center;
    font-size: 14px;
}

.message {
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
}

.error {
    border: 1px solid #999;
    background: #f2f2f2;
    color: #111;
}

.dashboard {
    width: min(100%, 900px);
    min-width: 0;
    align-self: start;
    margin: 30px auto;
    padding-bottom: 108px;
}

.dashboard.user-dashboard {
    width: 100%;
    margin: 0;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

.home-games {
    margin: 0;
    padding: 24px clamp(16px, 2vw, 32px) 0;
}

.home-games h1 {
    margin-bottom: 16px;
    font-size: 22px;
}

.home-games-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.home-game {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    text-align: center;
}

.home-game-content {
    display: block;
    height: 100%;
    padding: 10px 6px;
}

.home-game a:hover {
    background: #f5f5f5;
}

.home-game a:focus-visible {
    outline: 2px solid #111;
    outline-offset: -3px;
}

.home-game-image {
    display: block;
    width: min(64px, 100%);
    aspect-ratio: 1;
    margin: 0 auto;
    border-radius: 8px;
    object-fit: cover;
    background: #f5f5f5;
}

.home-game-placeholder {
    display: grid;
    place-items: center;
    color: #777;
    font-size: 30px;
    font-weight: 700;
}

.home-game h2 {
    margin: 0;
    padding: 8px 0 0;
    overflow-wrap: anywhere;
    font-size: 12px;
    line-height: 1.3;
}

.home-game .game-unavailable {
    margin: 0;
    padding: 4px 0 0;
}

.game-details {
    margin: 24px clamp(16px, 2vw, 32px) 0;
}

.game-selector {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 20px;
}

.game-selector label {
    margin-top: 0;
}

.game-selector-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.game-selector select {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid #ccc;
    border-radius: 9px;
    background: #fff;
    color: #111;
    font: inherit;
}

.game-selector select:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.game-packages-button.button-secondary {
    display: grid;
    flex: none;
    place-items: center;
    width: 48px;
    min-height: 48px;
    margin: 0;
    padding: 0;
}

.game-packages-button:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.game-packages-button svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.game-packages {
    max-width: 960px;
    margin: 28px auto 0;
}

.game-packages h2 {
    margin: 0 0 12px;
    font-size: 18px;
}

.game-packages-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.game-packages-list li {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.game-packages-list strong {
    font-size: 13px;
}

@media (min-width: 700px) {
    .home-games-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .game-packages-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 24px;
    border-bottom: 1px solid #ddd;
}

.topbar .brand {
    margin: 0;
}

.auth-topbar {
    margin-bottom: 30px;
    padding: 0;
    border: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-nav a {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 9px;
    background: #fff;
    color: #111;
}

.user-nav a:hover {
    background: #f5f5f5;
    color: #111;
}

.user-nav a[aria-current="page"],
.user-nav a[aria-current="page"]:hover {
    border-color: #111;
    background: #111;
    color: #fff;
}

.user-nav a:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.user-nav svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.theme-toggle,
.notification-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid #ddd;
    border-radius: 9px;
    background: #fff;
    color: #111;
}

.theme-toggle[hidden] {
    display: none;
}

.theme-toggle:hover {
    background: #f5f5f5;
}

.theme-toggle:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.notification-icon:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.notification-icon {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    display: grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    background: #d60000;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.notification-badge[hidden] {
    display: none;
}

.notification-icon:hover {
    background: #f5f5f5;
    color: #111;
}

.theme-toggle svg,
.notification-icon svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.theme-toggle .theme-sun,
html[data-theme="dark"] .theme-toggle .theme-moon {
    display: none;
}

html[data-theme="dark"] .theme-toggle .theme-sun {
    display: block;
}

.user-dashboard .topbar {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-right: clamp(16px, 2vw, 32px);
    padding-bottom: 16px;
    padding-left: clamp(16px, 2vw, 32px);
}

.home-dashboard .topbar {
    position: sticky;
    z-index: 10;
    top: 0;
    background: #fff;
}

.topbar form {
    margin: 0;
}

.button-secondary {
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 0 18px;
    border: 1px solid #111;
    background: transparent;
    color: #111;
}

.button-secondary:hover {
    color: #fff;
}

.button-secondary svg {
    display: block;
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.welcome {
    margin: 54px 0 30px;
}

.eyebrow {
    margin: 0 0 12px;
    color: #555;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.balance-card {
    max-width: 440px;
    padding: 28px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background: #f5f5f5;
}

.balance {
    margin: 0;
    font-size: 40px;
    font-weight: 750;
}

.balance span {
    color: #666;
    font-size: 18px;
    font-weight: 600;
}

.profile-card {
    width: 100%;
    margin: 24px auto 0;
    padding: 0 clamp(16px, 2vw, 32px);
}

.profile-card h1 {
    margin-bottom: 4px;
    font-size: 22px;
    text-align: center;
    overflow-wrap: anywhere;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    margin: 0 auto 10px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #111;
    color: #fff;
}

.profile-avatar svg {
    width: 34px;
    height: 34px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.profile-balance {
    margin: 14px 0 18px;
    text-align: center;
}

.profile-balance .eyebrow {
    margin-bottom: 6px;
}

.profile-balance .balance {
    overflow-wrap: anywhere;
    font-size: 20px;
}

.profile-balance .balance span {
    font-size: 13px;
}

.profile-menu {
    display: grid;
    gap: 8px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 50px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    color: #111;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
}

.profile-menu-item svg,
.profile-language-form svg {
    flex: none;
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.profile-menu-item > span:not(.profile-menu-status) {
    min-width: 0;
}

.profile-menu a.profile-menu-item:hover {
    background: #f5f5f5;
}

.profile-menu a.profile-menu-item:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.profile-language-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    min-height: 50px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 12px;
    background: #fff;
    color: #111;
    font-size: 14px;
}

.profile-language-form label {
    flex: 1 1 0;
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.profile-language-form select {
    min-width: 0;
    max-width: 50%;
    min-height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #111;
    font: inherit;
    cursor: pointer;
}

.profile-language-form select:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.profile-language-form button {
    width: auto;
    min-height: 40px;
    margin: 0;
    padding: 0 12px;
    font-size: 13px;
}

.profile-menu-status {
    flex-shrink: 0;
    margin-left: auto;
    color: #666;
    font-size: 12px;
    font-weight: 400;
    text-align: right;
}

.profile-menu-logout {
    width: 100%;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
}

.profile-menu-logout svg {
    color: #c62828;
}

.profile-menu-logout:hover {
    background: #f5f5f5;
}

.profile-menu-logout:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.dashboard.admin-dashboard {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 20px clamp(16px, 2vw, 32px) 30px;
}

.admin-drawer {
    position: relative;
    z-index: 20;
}

.admin-drawer summary {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
    list-style: none;
}

.admin-drawer summary::-webkit-details-marker {
    display: none;
}

.admin-drawer summary:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.admin-drawer summary svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2;
}

.drawer-close-icon {
    display: none;
}

.admin-drawer[open] summary {
    position: fixed;
    top: 24px;
    right: 24px;
    border-color: #444;
    background: #222;
    color: #fff;
}

.admin-drawer[open] .drawer-open-icon {
    display: none;
}

.admin-drawer[open] .drawer-close-icon {
    display: block;
}

.admin-drawer-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(250px, calc(100vw - 32px));
    padding: 28px 14px;
    overflow-y: auto;
    border-left: 1px solid #333;
    background: #111;
    color: #fff;
    box-shadow: -12px 0 40px #0004;
}

.drawer-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 50px;
}

.drawer-mark {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #fff;
    color: #111;
    font-size: 16px;
    font-weight: 800;
}

.drawer-heading strong,
.drawer-heading div span {
    display: block;
}

.drawer-heading strong {
    font-size: 13px;
    letter-spacing: 0.5px;
}

.drawer-heading div span {
    margin-top: 3px;
    color: #aaa;
    font-size: 11px;
}

.drawer-label {
    margin: 32px 10px 10px;
    color: #aaa;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.admin-drawer-menu a,
.admin-drawer-menu .admin-logout-button {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    margin-bottom: 6px;
    padding: 8px 10px;
    border-radius: 10px;
    color: #eee;
}

.admin-drawer-menu .admin-logout-button {
    width: 100%;
    margin-top: 0;
    background: transparent;
    font-weight: 400;
    text-align: left;
}

.admin-drawer-menu a:hover,
.admin-drawer-menu .admin-logout-button:hover {
    background: #2a2a2a;
    color: #fff;
}

.admin-drawer-menu .admin-logout-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.admin-drawer-menu a[aria-current="page"] {
    background: #fff;
    color: #111;
}

.drawer-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #333;
}

.admin-drawer-menu a[aria-current="page"] .drawer-icon {
    background: #eee;
}

.drawer-icon svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.drawer-link-text strong,
.drawer-link-text small {
    display: block;
}

.drawer-link-text strong {
    font-size: 13px;
}

.drawer-link-text small {
    margin-top: 3px;
    color: #aaa;
    font-size: 11px;
}

.admin-drawer-menu a[aria-current="page"] small {
    color: #666;
}

.admin-users {
    margin-top: 20px;
}

.admin-users .subtitle {
    margin: 8px 0 0;
}

.api-settings-form {
    max-width: 480px;
}

.users-search {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.users-search input {
    min-width: 0;
}

.users-search button {
    width: auto;
    min-width: 80px;
    margin: 0;
    padding: 0 16px;
}

.users-table tr[hidden],
.users-search-empty[hidden] {
    display: none;
}

.notification-form textarea {
    display: block;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 9px;
    background: #fff;
    color: #111;
    font: inherit;
    resize: vertical;
}

.notification-form input[type="file"] {
    padding: 10px 14px;
}

.notification-form small {
    display: block;
    margin-top: 6px;
    color: #666;
}

.admin-notifications-list {
    margin-top: 32px;
}

.admin-notifications-list h2 {
    margin: 0 0 16px;
    font-size: 20px;
}

.admin-page .notification-delete {
    width: auto;
    min-height: 40px;
    margin-top: 12px;
    padding: 0 16px;
    border: 1px solid #b91c1c;
    background: #fff;
    color: #b91c1c;
}

.admin-page .notification-delete:hover {
    background: #fef2f2;
}

body.admin-page .message[role="status"],
body.admin-auth-page .message[role="status"] {
    border: 1px solid #86c997;
    background: #e8f7ec;
    color: #175c2c;
}

body.admin-page .message.error,
body.admin-auth-page .message.error {
    border: 1px solid #e4a0a0;
    background: #fff0f0;
    color: #922020;
}

.game-unavailable {
    display: block;
    margin-top: 4px;
    color: #666;
    font-size: 12px;
}

.game-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.game-link:hover span {
    text-decoration: underline;
}

.game-logo {
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 9px;
    object-fit: cover;
    background: #f5f5f5;
}

.game-logo-placeholder {
    display: grid;
    place-items: center;
    color: #555;
}

.admin-table-wrap {
    margin-top: 12px;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 12px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
}

.admin-table th {
    background: #f5f5f5;
    white-space: nowrap;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.users-balance {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.balance-credit summary,
.balance-credit-trigger {
    display: grid;
    place-items: center;
    width: 36px;
    min-height: 36px;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    color: #111;
    cursor: pointer;
    list-style: none;
}

.balance-credit-trigger[hidden] {
    display: none;
}

.balance-credit-trigger:hover {
    background: #f5f5f5;
}

.balance-credit summary::-webkit-details-marker {
    display: none;
}

.balance-credit summary:focus-visible,
.balance-credit-trigger:focus-visible,
.user-ban-switch:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.balance-credit svg,
.balance-credit-trigger svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.balance-credit form {
    min-width: 180px;
    max-width: 250px;
}

.balance-credit input,
.balance-credit-dialog input {
    min-height: 40px;
}

.balance-credit form button,
.balance-credit-dialog form button {
    min-height: 40px;
    margin-top: 8px;
}

.balance-credit-dialog .balance-credit-user,
.balance-credit-dialog .balance-credit-current {
    margin: 0 0 8px;
    overflow-wrap: anywhere;
}

.balance-credit-dialog .balance-credit-current {
    color: #666;
    font-size: 14px;
}

.user-ban-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-page .user-ban-switch {
    display: flex;
    align-items: center;
    width: 44px;
    min-height: 26px;
    margin: 0;
    padding: 3px;
    border: 0;
    border-radius: 13px;
    background: #777;
}

.admin-page .user-ban-switch[aria-checked="true"] {
    justify-content: flex-end;
    background: #b91c1c;
}

.user-ban-switch span {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 28px 22px;
    }

    .dashboard {
        margin-top: 12px;
    }

    .admin-dashboard .topbar {
        padding-bottom: 16px;
    }

    .admin-users h1 {
        font-size: 24px;
    }

    .admin-table-wrap {
        max-width: 100%;
    }

    .admin-table {
        font-size: 13px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }

    .game-logo {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 700px) {
    .users-table-wrap {
        overflow: visible;
        border: 0;
        border-radius: 0;
    }

    .users-table,
    .users-table tbody,
    .users-table tr {
        display: block;
        width: 100%;
    }

    .users-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .users-table tr {
        margin-bottom: 12px;
        padding: 4px 12px;
        border: 1px solid #ddd;
        border-radius: 12px;
    }

    .users-table td {
        display: grid;
        grid-template-columns: 72px minmax(0, 1fr);
        gap: 12px;
        padding: 9px 0;
        border-bottom: 1px solid #eee;
        overflow-wrap: anywhere;
    }

    .users-table td::before {
        content: attr(data-label);
        color: #666;
        font-weight: 600;
    }

    .users-table tr:last-child td {
        border-bottom: 1px solid #eee;
    }

    .users-table tr td:last-child {
        border-bottom: 0;
    }

}

@media (max-width: 300px) {
    .home-games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Order Modal Styles */
.order-modal {
    max-width: 420px;
    width: 100%;
    padding: 28px;
    border: 1px solid #ddd;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 60px #00000024;
}

.order-modal::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.order-modal-content {
    min-width: 0;
}

.order-modal h2 {
    margin: 0 0 24px;
    font-size: 20px;
}

.order-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    margin: 0;
    color: #222;
    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
}

.form-group input:focus {
    border-color: #111;
    outline: none;
}

.package-display {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 14px;
}

#package-name-display {
    color: #333;
    font-weight: 600;
}

#package-price-display {
    color: #666;
    font-size: 13px;
}

.optional-label {
    color: #999;
    font-weight: 400;
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.form-actions button {
    flex: 1;
    min-height: 44px;
    margin: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.form-actions .button-primary {
    background: #111;
    color: #fff;
}

.form-actions .button-primary:hover {
    background: #333;
}

.form-actions .button-secondary {
    border: 1px solid #ccc;
    background: #fff;
    color: #111;
}

.form-actions .button-secondary:hover {
    background: #f5f5f5;
    color: #111;
}

.package-item-button {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #111;
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.package-item-button:hover {
    border-color: #111;
    background: #f9f9f9;
}

.package-item-button:focus-visible {
    outline: 2px solid #111;
    outline-offset: 2px;
}

.package-item-button span {
    color: #333;
}

.package-item-button strong {
    color: #111;
    font-size: 13px;
}

/* Messaging Style Order Interface */
.dashboard.user-dashboard.game-dashboard {
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.game-order-section {
    margin: 24px clamp(16px, 2vw, 32px) 0;
    padding: 0 clamp(16px, 2vw, 32px);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 230px;
    gap: 12px;
    align-items: center;
}

.game-order-section .game-selector {
    flex: none;
    margin-bottom: 0;
}

.order-messages-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    min-height: 140px;
    overflow: hidden;
}

.package-dialog {
    width: min(500px, calc(100% - 32px));
    max-width: none;
    min-height: 0;
    max-height: min(80vh, 640px);
    max-height: min(80dvh, 640px);
    margin: auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid #ccc;
    border-radius: 12px;
    background: #fff;
    color: #111;
    box-shadow: 0 20px 60px #0004;
}

.package-dialog[open] {
    display: flex;
    flex-direction: column;
}

.package-dialog::backdrop {
    background: #0009;
}

.package-dialog-header {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #ddd;
}

.package-dialog-header h2 {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 18px;
}

.package-dialog-close {
    display: grid;
    flex: none;
    place-items: center;
    width: 40px;
    min-height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid #ccc;
    background: #fff;
    color: #111;
}

.package-dialog-close:hover {
    background: #f5f5f5;
}

.package-dialog-close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.package-dialog-close svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.package-dialog-content {
    flex: 0 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
}

.messages-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-chat-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
}

.order-chat-pagination a {
    text-decoration: underline;
}

.message-info {
    text-align: center;
    color: #666;
    font-size: 13px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 8px;
}

.message-info p {
    margin: 0;
}

.message-error {
    text-align: center;
    color: #c62828;
    font-size: 13px;
    padding: 12px;
    background: #ffebee;
    border-radius: 8px;
    border: 1px solid #ef5350;
    margin-bottom: 8px;
}

.message-error p {
    margin: 0;
}

.package-table-wrap {
    width: 100%;
    min-width: 0;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.package-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 14px;
}

.package-table th,
.package-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    overflow-wrap: anywhere;
}

.package-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f5f5f5;
}

.package-table th:last-child,
.package-table td:last-child {
    width: 35%;
    text-align: right;
}

.package-table tbody tr:last-child td {
    border-bottom: 0;
}

.order-chat-message {
    align-self: flex-end;
    width: min(100%, 360px);
    padding: 10px 14px;
    border-radius: 12px 12px 2px 12px;
    background: #111;
    color: #fff;
    overflow-wrap: anywhere;
}

.order-chat-message dl {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 6px 12px;
    margin: 0;
    font-size: 13px;
}

.order-chat-message dt {
    color: #ddd;
}

.order-chat-message dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.order-sent-message {
    align-self: flex-end;
    max-width: min(100%, 360px);
    padding: 10px 14px;
    border-radius: 12px 12px 2px 12px;
    background: #111;
    color: #fff;
    font-size: 13px;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.messages-area .order-chat-message {
    align-self: flex-start;
    border: 1px solid #ddd;
    border-radius: 12px 12px 12px 2px;
    background: #f5f5f5;
    color: #111;
}

.messages-area .order-chat-message dt {
    color: #555;
}

.messages-area .order-check-link {
    color: #111;
}

.messages-area .order-check-link:hover {
    color: #555;
}

.game-history {
    padding: 24px clamp(16px, 2vw, 32px) 0;
}

.game-history h1 {
    margin-bottom: 16px;
    font-size: 22px;
}

.game-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 12px;
}

.order-history-page > h1 {
    text-align: center;
}

.order-history-page .game-history-list {
    grid-template-columns: minmax(0, 1fr);
    max-width: 600px;
    margin: 0 auto;
}

.order-history-page .game-history-list .order-chat-message {
    border-radius: 12px;
}

.order-history-page .game-history-pagination {
    justify-content: center;
}

.notification-list {
    display: grid;
    gap: 12px;
}

.notification-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
}

.notification-card img {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 12px;
    border-radius: 8px;
}

.notification-card p {
    margin: 0 0 10px;
    overflow-wrap: anywhere;
}

.notification-card time {
    color: #666;
    font-size: 12px;
}

.transaction-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px 12px;
    margin: 12px 0 0;
    font-size: 14px;
}

.transaction-details dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.transaction-debit {
    color: #b91c1c;
}

html[data-theme="dark"] .transaction-debit {
    color: #fca5a5;
}

.game-history-list .order-chat-message {
    width: 100%;
    align-self: stretch;
}

.game-history-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}

.game-history-pagination a {
    display: inline-flex;
    align-items: center;
    border-radius: 9px;
}

.game-history-pagination a:hover {
    background: #111;
}

.order-check-link {
    color: #fff;
    text-decoration: underline;
}

.order-check-link:hover {
    color: #ddd;
}

/* Input Area */
.order-input-area {
    flex: none;
    padding: 16px;
}

.input-wrapper {
    display: flex;
    gap: 8px;
}

.order-input-field {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #111;
    font-family: inherit;
}

.order-input-field:focus {
    outline: none;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
}

.order-input-field::placeholder {
    color: #999;
}

.order-send-btn {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    border: 1px solid #111;
    border-radius: 8px;
    background: #111;
    color: #fff;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.order-send-btn:hover {
    background: #333;
    border-color: #333;
}

.order-send-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.order-send-btn:active {
    transform: scale(0.95);
}

.order-send-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
}

@media (min-width: 701px) {
    .game-dashboard .game-order-section {
        margin: 24px 0 0;
    }

    .game-dashboard .game-selector,
    .game-dashboard .order-messages-container {
        max-width: none;
    }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    .messages-area {
        padding: 12px;
        gap: 8px;
    }

    .order-input-area {
        padding: 12px;
        gap: 12px;
    }

    .input-wrapper {
        gap: 6px;
    }

    .order-input-area input.order-input-field {
        min-height: 42px;
        font-size: 16px;
    }

    .order-send-btn {
        width: 42px;
        min-height: 42px;
    }

    .game-order-section {
        margin: 16px clamp(12px, 2vw, 24px) 0;
    }

}

@media (max-width: 300px) {
    .order-input-field {
        font-size: 16px;
    }
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .auth-page .auth-card,
html[data-theme="dark"] .home-dashboard .topbar {
    background: #111;
    color: #f5f5f5;
}

html[data-theme="dark"] a,
html[data-theme="dark"] .brand,
html[data-theme="dark"] form label {
    color: #f5f5f5;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] .brand span,
html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .switch-page,
html[data-theme="dark"] .game-unavailable,
html[data-theme="dark"] .profile-menu-status,
html[data-theme="dark"] .balance span,
html[data-theme="dark"] .users-table td::before {
    color: #bbb;
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .admin-table-wrap,
html[data-theme="dark"] .users-table tr,
html[data-theme="dark"] .admin-table th,
html[data-theme="dark"] .admin-table td,
html[data-theme="dark"] .package-table-wrap,
html[data-theme="dark"] .package-table th,
html[data-theme="dark"] .package-table td,
html[data-theme="dark"] .package-dialog-header {
    border-color: #444;
}

html[data-theme="dark"] .home-game,
html[data-theme="dark"] .profile-menu-item,
html[data-theme="dark"] .profile-language-form,
html[data-theme="dark"] .notification-card,
html[data-theme="dark"] .notification-form textarea,
html[data-theme="dark"] .game-selector select,
html[data-theme="dark"] input:not([type="hidden"]),
html[data-theme="dark"] .admin-drawer summary,
html[data-theme="dark"] .package-dialog,
html[data-theme="dark"] .package-dialog-close,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .notification-icon,
html[data-theme="dark"] .user-nav a,
html[data-theme="dark"] .button-secondary {
    border-color: #555;
    background: #222;
    color: #f5f5f5;
}

html[data-theme="dark"] .profile-language-form select {
    color: #f5f5f5;
}

html[data-theme="dark"] .profile-language-form option {
    background: #222;
    color: #f5f5f5;
}

html[data-theme="dark"] input:not([type="hidden"])::placeholder {
    color: #aaa;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] .game-selector select:focus-visible,
html[data-theme="dark"] .profile-language-form select:focus-visible,
html[data-theme="dark"] .profile-menu-item:focus-visible,
html[data-theme="dark"] .game-packages-button:focus-visible,
html[data-theme="dark"] .admin-drawer summary:focus-visible {
    border-color: #ddd;
    outline-color: #ddd;
}

html[data-theme="dark"] button,
html[data-theme="dark"] .order-send-btn {
    background: #3a3a3a;
    color: #f5f5f5;
    border-color: #666;
}

html[data-theme="dark"] button:hover,
html[data-theme="dark"] .order-send-btn:hover {
    background: #4a4a4a;
    color: #fff;
}

html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .profile-menu-item,
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .package-dialog-close {
    background: #222;
    color: #f5f5f5;
    border-color: #555;
}

html[data-theme="dark"] .theme-toggle:hover,
html[data-theme="dark"] .notification-icon:hover,
html[data-theme="dark"] .profile-menu-item:hover,
html[data-theme="dark"] .button-secondary:hover,
html[data-theme="dark"] .package-dialog-close:hover,
html[data-theme="dark"] .home-game a:hover {
    background: #333;
    color: #fff;
}

html[data-theme="dark"] .notification-card time,
html[data-theme="dark"] .notification-form small,
html[data-theme="dark"] .balance-credit-dialog .balance-credit-current {
    color: #bbb;
}

html[data-theme="dark"] .balance-credit summary,
html[data-theme="dark"] .balance-credit-trigger {
    border-color: #555;
    background: #222;
    color: #f5f5f5;
}

html[data-theme="dark"] .balance-credit-trigger:hover {
    background: #333;
}

html[data-theme="dark"] .profile-avatar,
html[data-theme="dark"] .order-sent-message {
    background: #3a3a3a;
    color: #f5f5f5;
}

html[data-theme="dark"] .user-nav a:hover {
    background: #333;
    color: #fff;
}

html[data-theme="dark"] .user-nav a[aria-current="page"],
html[data-theme="dark"] .user-nav a[aria-current="page"]:hover {
    border-color: #f5f5f5;
    background: #f5f5f5;
    color: #111;
}

html[data-theme="dark"] .profile-menu-logout svg {
    color: #ff9999;
}

html[data-theme="dark"] .package-table th,
html[data-theme="dark"] .admin-table th,
html[data-theme="dark"] .message-info,
html[data-theme="dark"] .messages-area .order-chat-message,
html[data-theme="dark"] .game-history-list .order-chat-message {
    background: #292929;
    color: #f5f5f5;
    border-color: #555;
}

html[data-theme="dark"] .messages-area .order-chat-message dt,
html[data-theme="dark"] .messages-area .order-check-link {
    color: #ddd;
}

html[data-theme="dark"] .messages-area .order-check-link:hover {
    color: #fff;
}

html[data-theme="dark"] .error,
html[data-theme="dark"] .message-error {
    border-color: #ad5555;
    background: #3a2020;
    color: #ffd2d2;
}

html[data-theme="dark"] .home-game-image,
html[data-theme="dark"] .game-logo {
    background: #333;
}

html[data-theme="dark"] .home-game-placeholder,
html[data-theme="dark"] .game-logo-placeholder {
    color: #ccc;
}

html[data-theme="dark"] .admin-drawer[open] summary {
    background: #222;
    color: #fff;
}

html[data-theme="dark"] .admin-drawer-menu a[aria-current="page"] {
    color: #111;
}

html[data-theme="dark"] body.admin-page .message[role="status"],
html[data-theme="dark"] body.admin-auth-page .message[role="status"] {
    border-color: #428856;
    background: #173a23;
    color: #c4f1cf;
}

html[data-theme="dark"] body.admin-page .message.error,
html[data-theme="dark"] body.admin-auth-page .message.error {
    border-color: #ad5555;
    background: #3a2020;
    color: #ffd2d2;
}

html[data-theme="dark"] body.admin-page .notification-delete {
    border-color: #ad5555;
    background: #3a2020;
    color: #ffd2d2;
}

html[data-theme="dark"] body.admin-page .notification-delete:hover {
    background: #542b2b;
}

body.user-page,
body.auth-page:not(.admin-auth-page) {
    background: #f5f5f4;
}

body.auth-page:not(.admin-auth-page) {
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

body.auth-page:not(.admin-auth-page) .auth-card {
    width: min(100%, 460px);
    min-height: 0;
    padding: clamp(24px, 5vw, 40px);
    border: 1px solid #e4e4e2;
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 20px 60px #0000000d;
}

body.auth-page:not(.admin-auth-page) .auth-topbar {
    margin-bottom: 36px;
}

body.auth-page:not(.admin-auth-page) h1 {
    font-size: clamp(26px, 5vw, 32px);
    letter-spacing: -0.03em;
}

body.auth-page:not(.admin-auth-page) input:not([type="hidden"]),
.user-page .game-history input:not([type="hidden"]) {
    border-color: #dededb;
    border-radius: 12px;
}

body.auth-page:not(.admin-auth-page) form button,
.user-page .game-history form > button {
    border-radius: 12px;
}

.user-page .user-dashboard .topbar {
    padding-right: max(16px, calc((100% - 1120px) / 2));
    padding-left: max(16px, calc((100% - 1120px) / 2));
    border-color: #e8e8e6;
    background: #fff;
}

.user-page .home-games,
.user-page .game-history {
    width: 100%;
    max-width: 1152px;
    margin: 0 auto;
    padding: 32px 16px 0;
}

.user-page .home-games h1,
.user-page .game-history h1 {
    margin-bottom: 20px;
    font-size: clamp(23px, 3vw, 30px);
    letter-spacing: -0.03em;
}

.user-page .home-games-grid {
    gap: clamp(10px, 1.5vw, 18px);
}

.user-page .home-game {
    border-color: #e7e7e5;
    border-radius: 18px;
    box-shadow: 0 4px 16px #00000008;
}

.user-page .home-game-content {
    padding: 18px 8px;
}

.user-page .home-game-image {
    width: min(72px, 100%);
    border-radius: 15px;
}

.user-page .home-game h2 {
    padding-top: 12px;
    font-size: 13px;
}

.user-page .profile-card {
    max-width: 632px;
    margin-top: 32px;
    padding: 0 16px;
}

.user-page .profile-avatar {
    width: 72px;
    height: 72px;
    box-shadow: 0 8px 20px #0000001a;
}

.user-page .profile-card h1 {
    font-size: 24px;
    letter-spacing: -0.02em;
}

.user-page .profile-balance {
    margin: 20px 0;
    padding: 22px;
    border-radius: 18px;
    background: linear-gradient(135deg, #111, #333);
    color: #fff;
}

.user-page .profile-balance .balance {
    font-size: 26px;
}

.user-page .profile-balance .balance span {
    color: #ddd;
}

.user-page .profile-menu {
    gap: 10px;
}

.user-page .profile-menu-item,
.user-page .profile-language-form,
.user-page .notification-card {
    min-height: 58px;
    border-color: #e7e7e5;
    border-radius: 14px;
    box-shadow: 0 4px 16px #00000006;
}

.user-page .profile-menu-item,
.user-page .profile-language-form {
    padding: 12px 16px;
}

.user-page .game-history > form,
.user-page .game-history > .profile-menu {
    max-width: 600px;
}

.user-page .message-info {
    border-radius: 12px;
}

.user-page .game-order-section {
    width: 100%;
    max-width: 1152px;
    margin: 24px auto 0;
    padding: 0 16px;
}

html[data-theme="dark"] body.user-page,
html[data-theme="dark"] body.auth-page:not(.admin-auth-page) {
    background: #111;
}

html[data-theme="dark"] body.auth-page:not(.admin-auth-page) .auth-card,
html[data-theme="dark"] .user-page .user-dashboard .topbar {
    border-color: #383838;
    background: #1b1b1b;
}

html[data-theme="dark"] .user-page .home-game,
html[data-theme="dark"] .user-page .profile-menu-item,
html[data-theme="dark"] .user-page .profile-language-form,
html[data-theme="dark"] .user-page .notification-card {
    border-color: #383838;
}

html[data-theme="dark"] .user-page .profile-balance {
    border: 1px solid #444;
    background: linear-gradient(135deg, #292929, #171717);
}

html[data-theme="dark"] .user-page .profile-balance .balance span {
    color: #ddd;
}

@media (max-width: 600px) {
    .user-page .home-games,
    .user-page .game-history {
        padding-top: 24px;
    }

    @media (max-width: 430px) {
        .user-page .topbar-actions,
        .user-page .user-nav {
            gap: 4px;
        }

        .user-page .user-nav a,
        .user-page .theme-toggle,
        .user-page .notification-icon {
            width: 36px;
            height: 36px;
            min-height: 36px;
        }

        .user-page .topbar .brand {
            font-size: 15px;
        }

        .user-page .topbar .brand span {
            font-size: 10px;
        }
    }

    @media (max-width: 350px) {
        .user-page .user-dashboard .topbar {
            flex-wrap: wrap;
            gap: 12px;
        }
    }

    .user-page .home-game-content {
        padding: 14px 6px;
    }

    .user-page .home-game-image {
        width: min(60px, 100%);
    }

    .user-page .home-game h2 {
        font-size: 12px;
    }

    .user-page .profile-card {
        margin-top: 24px;
    }

    .user-page .game-order-section {
        margin-top: 16px;
    }
}
