body {
    margin: 0;
    min-height: 100vh;
    font-family: Verdana, Helvetica, Arial, sans-serif;
    background:
        radial-gradient(circle at top, rgba(181, 116, 27, 0.14), transparent 28%),
        linear-gradient(180deg, #221d18 0%, #0d0d0f 100%);
    color: #f0f0f0;
}

.app-header {
    margin: 0 auto 12px;
    max-width: 1520px;
    padding: 14px 18px 0;
}

#logo-image {
    display: flex;
    justify-content: center;
}

#logo-image img {
    display: block;
    width: min(100%, 560px);
    height: auto;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.28));
}

.page-shell {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 22px;
    max-width: 1520px;
    margin: 0 auto;
    padding: 0 18px 40px;
}

.page-shell-wide {
    align-items: start;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.player-card,
.nav-card,
.cooldown-card {
    background: linear-gradient(180deg, rgba(29, 26, 24, 0.98) 0%, rgba(18, 18, 20, 0.98) 100%);
    border: 1px solid #4b3a25;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
    padding: 16px;
}

.player-card p {
    margin: 0 0 7px;
}

.player-card h3,
.cooldown-card h4 {
    margin-top: 0;
    margin-bottom: 10px;
}

.player-card h3,
.cooldown-card h4,
.section-card-title {
    padding-left: 0;
    background: none;
    line-height: 1.2;
}

.player-card h3 {
    color: #fff4df;
    font-size: 22px;
}

.sidebar-avatar {
    position: relative;
    margin-bottom: 12px;
    text-align: center;
}

.sidebar-avatar img {
    width: 140px;
    height: 176px;
    object-fit: cover;
    background: #232323;
    border: 1px solid #444;
}

.sidebar-avatar.is-jailed img {
    filter: grayscale(0.35) brightness(0.78);
}

.avatar-status-overlay {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    min-width: 108px;
    padding: 6px 10px;
    border: 1px solid #b62e26;
    background: rgba(86, 9, 9, 0.9);
    color: #fff3f1;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
}

.player-status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    margin: 0 0 12px;
    padding: 0 10px;
    border: 1px solid #4a4139;
    background: rgba(35, 33, 32, 0.94);
    color: #efefef;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.player-status-pill-jailed {
    border-color: #b62e26;
    background: rgba(86, 9, 9, 0.9);
    color: #fff3f1;
}

.nav-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-card a,
.country-tabs a {
    color: #f6f6f6;
    text-decoration: none;
    background: rgba(35, 33, 32, 0.94);
    border: 1px solid #4a4139;
    padding: 10px 12px;
}

.nav-card a.active,
.country-tabs a.active {
    border-color: #d28000;
    background: linear-gradient(180deg, #4d3412 0%, #2e2011 100%);
}

.main-content {
    min-width: 0;
}

.main-content-wide #text_container,
.main-content-wide .text_container {
    width: 100%;
    max-width: none;
}

.main-content-wide .userprof,
.main-content-wide .auth-table {
    width: 100%;
}

.auth-shell {
    max-width: 1520px;
    margin: 0 auto;
    padding: 0 18px 32px;
}

.auth-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 22px;
    align-items: start;
}

.auth-content {
    min-width: 0;
}

.auth-panel {
    padding: 18px;
}

.auth-brand-panel {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(26, 24, 23, 0.96) 0%, rgba(13, 13, 15, 0.98) 100%);
    border: 1px solid #5d4522;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    padding: 20px;
}

.auth-brand-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(160, 31, 22, 0.22), transparent 34%),
        linear-gradient(135deg, rgba(203, 151, 81, 0.12), transparent 42%);
    pointer-events: none;
}

.auth-brand-panel > * {
    position: relative;
    z-index: 1;
}

.auth-brand-badge {
    display: inline-block;
    margin-bottom: 12px;
    padding: 5px 9px;
    border: 1px solid #8f6932;
    background: rgba(92, 53, 11, 0.35);
    color: #f4d29c;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.auth-brand-character {
    display: block;
    width: 100%;
    max-width: 316px;
    height: auto;
    margin: 0 auto 18px;
}

.auth-brand-panel h2 {
    margin: 0 0 10px;
    color: #fff4df;
    font-size: 28px;
    line-height: 1.1;
}

.auth-brand-panel p {
    margin: 0;
    color: #d5c8ba;
    line-height: 1.55;
}

.auth-brand-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.auth-brand-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid #443a2a;
    background: rgba(18, 18, 18, 0.76);
    color: #f0d9b0;
    font-size: 12px;
}

.auth-table {
    width: 100%;
    max-width: 720px;
}

.auth-table input[type="text"],
.auth-table input[type="email"],
.auth-table input[type="password"] {
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
}

.auth-switch {
    margin-top: 16px;
}

.form-errors {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #933;
    background: #331919;
    color: #ffd7d7;
}

.flash-message {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid #4c4c4c;
    background: #262626;
}

.flash-success {
    border-color: #4e8f37;
    background: #1e3217;
    color: #dff3d6;
}

.flash-error {
    border-color: #933;
    background: #331919;
    color: #ffd7d7;
}

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

.country-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ownership-summary {
    font-size: 11px;
    line-height: 1.45;
}

.ownership-summary span {
    display: block;
    color: #d7d7d7;
}

.sidebar-compact {
    position: sticky;
    top: 12px;
}

.nav-left {
    gap: 16px;
}

.nav-left-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(91, 72, 44, 0.45);
}

.nav-left-group:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.section-card-title {
    margin-bottom: 10px;
    color: #f4cd8b;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: bold;
}

.cooldown-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 0;
    border-bottom: 1px solid #2e2e2e;
}

.cooldown-row:last-child {
    border-bottom: none;
}

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

.plot-card {
    background: #151515;
    border: 2px solid #444;
    padding: 10px;
    min-height: 88px;
}

.plot-number {
    font-weight: bold;
    margin-bottom: 6px;
}

.plot-owner,
.plot-building {
    font-size: 11px;
    color: #d7d7d7;
}

.domination-map-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 18px;
    align-items: start;
}

.domination-map-panel,
.domination-legend-panel {
    background: #171717;
    border: 1px solid #3b3b3b;
    padding: 14px;
}

.domination-map-title {
    font-weight: bold;
    margin-bottom: 6px;
}

.domination-map-subtitle {
    color: #c7c7c7;
    font-size: 12px;
    margin-bottom: 14px;
}

.domination-land-grid {
    display: grid;
    gap: 6px;
    justify-content: start;
}

.domination-plot {
    position: relative;
    min-height: 92px;
    background: #111;
    border: 2px solid #555;
    padding: 16px 8px 8px;
    overflow: hidden;
}

.domination-plot-band {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
}

.domination-plot-id {
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 6px;
}

.domination-plot-owner,
.domination-plot-building,
.domination-plot-crew {
    font-size: 10px;
    line-height: 1.3;
    color: #e5e5e5;
}

.domination-plot-building {
    color: #f1c27a;
}

.domination-plot-crew {
    margin-top: 4px;
    color: #bdbdbd;
}

.domination-plot-empty .domination-plot-building,
.domination-plot-empty .domination-plot-owner,
.domination-plot-empty .domination-plot-crew {
    color: #9a9a9a;
}

.domination-legend-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.domination-legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid #222;
}

.crew-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    background: linear-gradient(135deg, #2d2d2d, #161616);
    border: 1px dashed #666;
    color: #cfcfcf;
}

.avatar-section {
    margin-top: 18px;
}

.avatar-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 240px;
    gap: 18px;
    align-items: start;
}

.avatar-group {
    margin-top: 18px;
}

.avatar-group.is-hidden {
    display: none;
}

.avatar-group-title {
    margin-bottom: 10px;
    font-weight: bold;
}

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

.avatar-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 1px solid #4a4a4a;
    background: #171717;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.avatar-option.selected {
    border-color: #d28000;
    box-shadow: 0 0 0 2px #d28000 inset;
    background: #21180d;
    transform: translateY(-1px);
}

.avatar-option:hover {
    border-color: #b6b6b6;
}

.avatar-option input {
    display: none;
}

.avatar-option img {
    width: 120px;
    height: 150px;
    object-fit: cover;
    background: #232323;
    border: 1px solid #4a4036;
}

.avatar-selected-label {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    background: #d28000;
    color: #fff;
    font-size: 10px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 2px;
    text-transform: uppercase;
}

.avatar-option.selected .avatar-selected-label {
    display: inline-block;
}

.avatar-preview-card {
    background: #1a1a1a;
    border: 1px solid #3b3b3b;
    padding: 14px;
    text-align: center;
}

.avatar-preview-title {
    margin-bottom: 12px;
    font-weight: bold;
}

.avatar-preview-card img {
    width: 160px;
    height: 200px;
    object-fit: cover;
    background: #232323;
    border: 1px solid #444;
}

.avatar-preview-name {
    margin-top: 10px;
    font-weight: bold;
}

.avatar-preview-help {
    margin-top: 6px;
    color: #c8c8c8;
    font-size: 12px;
}

.profile-grid {
    align-items: start;
}

.profile-avatar-cell {
    background: #171717;
}

.profile-avatar {
    width: 180px;
    height: 225px;
    object-fit: cover;
    background: #232323;
    border: 1px solid #444;
    margin: 8px 0;
}

.inbox-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.inline-form {
    display: inline;
}

.trade-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.trade-form input[type="number"] {
    width: 84px;
}

.link-button {
    background: none;
    border: none;
    color: #f0f0f0;
    padding: 0;
    margin-top: 10px;
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.notification-body {
    margin-bottom: 6px;
}

textarea,
input,
button {
    font: inherit;
}

@media (max-width: 900px) {
    .page-shell,
    .grid-two {
        grid-template-columns: 1fr;
    }

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

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

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

    .avatar-layout {
        grid-template-columns: 1fr;
    }

    .domination-map-shell {
        grid-template-columns: 1fr;
    }

    .domination-land-grid {
        transform: scale(0.9);
        transform-origin: top left;
    }

    .sidebar-compact {
        position: static;
    }
}
