* { box-sizing: border-box; }

:root {
    --bg: #0b1120;
    --panel: #111827;
    --panel-2: #1f2937;
    --line: #334155;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --blue: #2563eb;
    --green: #86efac;
    --red: #fca5a5;
    --amber: #f59e0b;
}

body {
    margin: 0;
    background: radial-gradient(circle at top, #172554 0, var(--bg) 420px);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
}

a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: rgba(2, 6, 23, 0.98);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.game-header-top {
    min-height: 74px;
    padding: 14px 24px 10px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

h1, h2, h3 { margin-top: 0; }
h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: 0.5px;
}
h1 a { color: #fff; }
.tagline { color: var(--muted); margin: 4px 0 0; }

nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
nav a {
    display: inline-block;
    color: #dbeafe;
    background: #0f172a;
    border: 1px solid #1e3a8a;
    padding: 8px 10px;
    border-radius: 999px;
    font-size: 14px;
}
nav a:hover {
    text-decoration: none;
    background: #1e3a8a;
}

.player-dashboard {
    border-top: 1px solid #1e293b;
    padding: 10px 24px 14px;
    display: grid;
    grid-template-columns: repeat(7, minmax(120px, 1fr));
    gap: 10px;
}

.stat-card {
    background: linear-gradient(180deg, #172033, #0f172a);
    border: 1px solid #263449;
    border-radius: 12px;
    padding: 10px 12px;
    min-height: 58px;
}
.stat-label {
    display: block;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}
.stat-card strong {
    display: block;
    color: #fff;
    font-size: 16px;
    white-space: nowrap;
}

main {
    max-width: 1250px;
    margin: 0 auto;
    padding: 24px;
}
main.with-player-dashboard {
    padding-top: 270px;
}
main.guest-main {
    padding-top: 105px;
}

.card {
    background: rgba(31, 41, 55, 0.94);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 18px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.flash {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
}
.flash.info { background: #1e3a8a; }
.flash.success { background: #166534; }
.flash.error { background: #7f1d1d; }

table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(31, 41, 55, 0.96);
    border-radius: 12px;
    overflow: hidden;
}
th, td {
    padding: 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}
th {
    background: #0f172a;
}
input, select, button {
    padding: 9px;
    border-radius: 7px;
    border: 1px solid #475569;
}
input, select {
    background: #020617;
    color: var(--text);
}
button {
    background: var(--blue);
    color: white;
    cursor: pointer;
}
button:hover { background: #1d4ed8; }

form.inline {
    display: flex;
    gap: 6px;
    align-items: center;
}
.small { color: var(--muted); font-size: 0.9em; }
.event {
    border-left: 4px solid var(--amber);
    padding-left: 12px;
    margin-bottom: 10px;
}
.profit { color: var(--green); }
.loss { color: var(--red); }

footer {
    color: var(--muted);
    text-align: center;
    padding: 24px;
}

@media (max-width: 1000px) {
    .player-dashboard {
        grid-template-columns: repeat(4, minmax(120px, 1fr));
    }
    main.with-player-dashboard {
        padding-top: 320px;
    }
}

@media (max-width: 760px) {
    .game-header-top {
        align-items: flex-start;
        flex-direction: column;
    }
    nav {
        justify-content: flex-start;
    }
    .player-dashboard {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
    main.with-player-dashboard {
        padding-top: 390px;
    }
    main.guest-main {
        padding-top: 170px;
    }
}


.price-up {
    color: #86efac;
    font-weight: bold;
}

.price-down {
    color: #fca5a5;
    font-weight: bold;
}

.price-flat {
    color: #94a3b8;
}


.trade-actions button {
    white-space: nowrap;
}

button:disabled,
input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


.secondary-button {
    background: #475569;
}

.secondary-button:hover {
    background: #64748b;
}

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

.trade-actions button {
    white-space: nowrap;
}

button:disabled,
input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* Mobile/table responsiveness */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

.table-wrap table {
    min-width: 900px;
}

@media (max-width: 760px) {
    body {
        background: #0b1120;
    }

    .game-header {
        max-height: 100vh;
        overflow-y: auto;
    }

    .game-header-top {
        padding: 10px 12px;
        gap: 10px;
    }

    h1 {
        font-size: 22px;
    }

    .tagline {
        display: none;
    }

    nav {
        gap: 6px;
    }

    nav a {
        font-size: 12px;
        padding: 7px 8px;
    }

    .player-dashboard {
        padding: 8px 12px 10px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .stat-card {
        min-height: auto;
        padding: 8px;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-card strong {
        font-size: 13px;
    }

    main.with-player-dashboard {
        padding: 390px 10px 16px;
    }

    main.guest-main {
        padding: 135px 10px 16px;
    }

    .card {
        padding: 12px;
        margin-bottom: 12px;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    table {
        font-size: 13px;
    }

    th, td {
        padding: 8px;
    }

    input, select, button {
        font-size: 14px;
        padding: 8px;
    }

    form.inline,
    .trade-actions {
        align-items: stretch;
        flex-direction: column;
        gap: 5px;
    }

    form.inline input[type="number"] {
        width: 100% !important;
    }

    .trade-actions button {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .player-dashboard {
        grid-template-columns: 1fr 1fr;
    }

    main.with-player-dashboard {
        padding-top: 430px;
    }

    nav a {
        flex: 1 1 auto;
        text-align: center;
    }
}


/* v0.2.12 header spacing fix */
html {
    scroll-padding-top: 240px;
}

@media (max-width: 1000px) {
    html {
        scroll-padding-top: 330px;
    }
}

@media (max-width: 760px) {
    html {
        scroll-padding-top: 400px;
    }
}

@media (max-width: 430px) {
    html {
        scroll-padding-top: 440px;
    }
}


/* v0.4.2 mobile market cards */
.market-mobile {
    display: none;
}

@media (max-width: 760px) {
    .market-desktop {
        display: none;
    }

    .market-mobile {
        display: block;
    }

    .market-item-card {
        background: rgba(31, 41, 55, 0.96);
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 12px;
        margin-bottom: 12px;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
    }

    .market-item-title {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        align-items: flex-start;
        margin-bottom: 10px;
    }

    .market-item-title h3 {
        margin: 0;
        font-size: 16px;
    }

    .market-item-title span {
        color: var(--muted);
        font-size: 12px;
        background: #0f172a;
        border: 1px solid #263449;
        padding: 4px 7px;
        border-radius: 999px;
        white-space: nowrap;
    }

    .market-stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }

    .market-stats-grid div {
        background: #0f172a;
        border: 1px solid #263449;
        border-radius: 10px;
        padding: 8px;
    }

    .market-stats-grid span {
        display: block;
        color: var(--muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-bottom: 3px;
    }

    .market-stats-grid strong {
        display: block;
        font-size: 14px;
        color: #fff;
    }

    .mobile-trade-panels {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .mobile-trade-form {
        display: grid !important;
        grid-template-columns: 1fr;
        gap: 6px;
        background: #111827;
        border: 1px solid #263449;
        border-radius: 10px;
        padding: 8px;
    }

    .mobile-trade-form input[type="number"],
    .mobile-trade-form button {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .mobile-trade-panels {
        grid-template-columns: 1fr;
    }
}


/* v0.4.3 collapsible player stats */
.stats-toggle {
    background: #334155;
    border: 1px solid #64748b;
    color: #e5e7eb;
    border-radius: 999px;
    padding: 8px 11px;
    white-space: nowrap;
}

.stats-toggle:hover {
    background: #475569;
}

body.stats-collapsed .player-dashboard {
    display: none;
}

body.stats-collapsed main.with-player-dashboard {
    padding-top: 105px;
}

body.stats-collapsed html {
    scroll-padding-top: 115px;
}

@media (max-width: 1000px) {
    body.stats-collapsed main.with-player-dashboard {
        padding-top: 125px;
    }
}

@media (max-width: 760px) {
    .stats-toggle {
        width: 100%;
    }

    body.stats-collapsed main.with-player-dashboard {
        padding-top: 175px;
    }
}

@media (max-width: 430px) {
    body.stats-collapsed main.with-player-dashboard {
        padding-top: 205px;
    }
}

.unlocked-card{border-color:#166534}.locked-card{opacity:.6;border-color:#7f1d1d}


/* v0.5.2 pagination and quick trade */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 18px;
}

.pagination a,
.pagination span {
    min-width: 38px;
    padding: 8px 10px;
    border: 1px solid #334155;
    border-radius: 8px;
    text-align: center;
    background: #0f172a;
}

.pagination .current-page {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    font-weight: bold;
}

.quick-trade-button {
    background: #0f766e;
}

.quick-trade-button:hover {
    background: #0d9488;
}

@media (max-width: 760px) {
    .mobile-trade-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mobile-trade-form input[type="number"] {
        grid-column: 1 / -1;
    }

    .mobile-trade-form button {
        min-height: 42px;
    }
}

@media (max-width: 430px) {
    .pagination a,
    .pagination span {
        min-width: 34px;
        padding: 7px 8px;
    }
}

.department-card{margin-bottom:0}.department-card h3{margin-bottom:8px}


.account-card {
    max-width: 560px;
}

.account-card label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
}

.account-card input {
    width: 100%;
}


.danger-card {
    max-width: 700px;
    border-color: #991b1b;
    background: rgba(69, 10, 10, 0.45);
}

.danger-card h3 {
    color: #fca5a5;
}

.danger-button {
    background: #b91c1c;
}

.danger-button:hover {
    background: #dc2626;
}


/* v0.6.8 sell buttons */
.sell-button {
    background: #b91c1c;
    border-color: #dc2626;
    color: #fff;
}

.sell-button:hover:not(:disabled) {
    background: #dc2626;
    border-color: #ef4444;
}

.sell-button:disabled {
    background: #4b1d1d;
    border-color: #6b2424;
    color: #9ca3af;
}


/* v0.6.9 login introduction */
.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 0.8fr);
    gap: 22px;
    align-items: start;
}

.login-intro-panel {
    min-width: 0;
}

.login-hero {
    background:
        linear-gradient(135deg, rgba(30, 64, 175, 0.45), rgba(15, 23, 42, 0.96)),
        rgba(31, 41, 55, 0.94);
    border: 1px solid #31528d;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 18px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.28);
}

.login-kicker {
    display: inline-block;
    color: #93c5fd;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
}

.login-hero h2 {
    margin-bottom: 12px;
    font-size: clamp(28px, 4vw, 44px);
}

.login-hero p {
    max-width: 850px;
    color: #cbd5e1;
    line-height: 1.65;
    font-size: 17px;
    margin-bottom: 0;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.feature-card {
    background: rgba(31, 41, 55, 0.94);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
}

.feature-card h3 {
    margin-bottom: 7px;
    color: #bfdbfe;
    font-size: 16px;
}

.feature-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 14px;
}

.login-card {
    position: sticky;
    top: 115px;
}

.login-card label {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.login-card input,
.login-card .login-button {
    width: 100%;
}

.login-button {
    font-weight: bold;
    min-height: 44px;
}

.register-link-button {
    display: block;
    width: 100%;
    padding: 10px;
    text-align: center;
    border: 1px solid #2563eb;
    border-radius: 8px;
    background: #172554;
    color: #dbeafe;
}

.register-link-button:hover {
    background: #1e3a8a;
    text-decoration: none;
}

@media (max-width: 900px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-card {
        position: static;
        order: -1;
    }
}

@media (max-width: 600px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }

    .login-hero {
        padding: 18px;
    }

    .login-hero p {
        font-size: 15px;
    }
}


/* v0.7.5 login rules */
.game-rules-panel {
    margin-top: 18px;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid #334155;
    border-radius: 16px;
    padding: 20px;
}

.rules-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 15px;
}

.rules-heading h2 {
    margin-bottom: 0;
}


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

.rule-card {
    background: rgba(30, 41, 59, 0.78);
    border: 1px solid #334155;
    border-radius: 11px;
    padding: 14px;
}

.rule-card h3 {
    color: #bfdbfe;
    font-size: 15px;
    margin-bottom: 7px;
}

.rule-card p {
    margin: 0;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.55;
}

.rule-card .rule-detail {
    margin-top: 7px;
    color: #94a3b8;
}

@media (max-width: 700px) {
    .rules-heading {
        flex-direction: column;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    }


/* v1.0.0 live server status */
.server-status-panel {
    border: 1px solid #2563eb;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
    background:
        linear-gradient(135deg, rgba(30, 64, 175, 0.32), rgba(15, 23, 42, 0.95));
}

.server-status-panel.server-open {
    border-color: #15803d;
    box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.08);
}

.server-status-panel.server-full {
    border-color: #b91c1c;
    box-shadow: inset 0 0 0 1px rgba(239, 68, 68, 0.08);
}

.server-status-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 14px;
}

.server-status-header h2 {
    margin-bottom: 0;
}

.server-state {
    display: inline-block;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

.server-open .server-state {
    background: #14532d;
    border: 1px solid #22c55e;
    color: #dcfce7;
}

.server-full .server-state {
    background: #7f1d1d;
    border: 1px solid #ef4444;
    color: #fee2e2;
}

.server-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.server-stat {
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 11px;
}

.server-stat-label {
    display: block;
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

.server-stat strong {
    display: block;
    color: #fff;
    font-size: 16px;
}

@media (max-width: 760px) {
    .server-status-header {
        flex-direction: column;
    }

    .server-state {
        white-space: normal;
    }

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

@media (max-width: 430px) {
    .server-stats-grid {
        grid-template-columns: 1fr;
    }
}


/* v1.0.4 unread notifications */
.game-header nav a.notifications-unread {
    background: #b45309;
    border-color: #f59e0b;
    color: #fff7ed;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.55);
    animation: notification-pulse 1.8s ease-in-out infinite;
}

.game-header nav a.notifications-unread:hover {
    background: #d97706;
}

.notification-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-left: 5px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
}

@keyframes notification-pulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(245, 158, 11, 0.35);
    }
    50% {
        box-shadow: 0 0 18px rgba(245, 158, 11, 0.75);
    }
}

@media (prefers-reduced-motion: reduce) {
    .game-header nav a.notifications-unread {
        animation: none;
    }
}


/* v1.0.5 notifications controls */
.notifications-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.notifications-heading form {
    flex: 0 0 auto;
}

@media (max-width: 650px) {
    .notifications-heading {
        flex-direction: column;
    }

    .notifications-heading form,
    .notifications-heading button {
        width: 100%;
    }
}


/* v1.1.0 enterprise contracts */
.contract-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.contract-card {
    margin: 0;
}

.contract-card h3 {
    color: #bfdbfe;
}

.contract-requirements {
    padding: 10px;
    margin: 12px 0;
    border: 1px solid #334155;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.55);
}

.contract-requirements > div {
    margin: 4px 0;
}

.contract-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.contract-actions form {
    margin: 0;
}

@media (max-width: 760px) {
    .contract-grid {
        grid-template-columns: 1fr;
    }

    .contract-actions,
    .contract-actions form,
    .contract-actions button {
        width: 100%;
    }
}


/* v1.1.4 personal market notes */
.market-notes-panel {
    padding: 0;
    overflow: hidden;
}

.market-notes-panel summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    font-weight: bold;
    user-select: none;
}

.market-notes-panel summary:hover {
    background: rgba(30, 64, 175, 0.16);
}

.market-notes-panel[open] summary {
    border-bottom: 1px solid var(--line);
}

.market-notes-content {
    padding: 16px 18px 18px;
}

.market-notes-content textarea {
    display: block;
    width: 100%;
    min-height: 145px;
    resize: vertical;
    box-sizing: border-box;
    line-height: 1.5;
}

.market-notes-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

@media (max-width: 600px) {
    .market-notes-panel summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .market-notes-actions button {
        width: 100%;
    }
}


/* v1.1.5 contract notes */
.contract-actions .secondary-button {
    white-space: nowrap;
}

@media (max-width: 760px) {
    .contract-actions .secondary-button {
        width: 100%;
    }
}


/* v1.1.6 home page logo */
.home-logo-hero {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 16px 24px;
    text-align: center;
}

.home-game-logo {
    display: block;
    width: min(620px, 92vw);
    height: auto;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.42));
    transition: transform 0.22s ease, filter 0.22s ease;
}

.home-game-logo:hover {
    transform: translateY(-2px) scale(1.01);
    filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.5));
}

@media (max-width: 600px) {
    .home-logo-hero {
        padding: 0 4px 16px;
    }

    .home-game-logo {
        width: min(100%, 470px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-game-logo {
        transition: none;
    }
}


/* v1.1.7 donation banner */
.donation-banner-section {
    margin: 0 0 18px;
}

.donation-banner-link {
    display: block;
    border-radius: 18px;
    overflow: hidden;
    line-height: 0;
    box-shadow: 0 15px 34px rgba(0, 0, 0, 0.34);
    border: 1px solid #2563eb;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.donation-banner-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.46);
    text-decoration: none;
}

.donation-banner-image {
    display: block;
    width: 100%;
    height: auto;
}

@media (max-width: 760px) {
    .donation-banner-section {
        margin-bottom: 12px;
    }

    .donation-banner-link {
        border-radius: 12px;
    }

    /* Keep flash messages fully below the mobile Show/Hide Stats control. */
    main.with-player-dashboard {
        padding-top: 425px;
    }

    body.stats-collapsed main.with-player-dashboard {
        padding-top: 215px;
    }
}

@media (max-width: 430px) {
    main.with-player-dashboard {
        padding-top: 470px;
    }

    body.stats-collapsed main.with-player-dashboard {
        padding-top: 245px;
    }
}
