:root {
    --bg: #191815;
    --panel: #403d32;
    --panel-dark: #2b2923;
    --gold: #c7a317;
    --gold-light: #e2ca70;
    --text: #ffffff;
    --muted: #c9c6bc;
    --danger: #d85c52;
    --success: #63ad6a;
    --border: #1d1c15;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100%;
    margin: 0;
    background: var(--bg) url('../images/background.gif') repeat-x;
    color: var(--text);
    font: 14px/1.55 Arial, Helvetica, sans-serif;
}

a { color: var(--text); text-decoration: none; }
a:hover, a:focus { color: #ff9a26; }
img { max-width: 100%; }

.site-shell {
    width: min(1100px, calc(100% - 24px));
    margin: 18px auto;
}

.site-header,
.site-main,
.site-footer {
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
}

.site-header { overflow: hidden; }

.brand {
    display: block;
    padding: 8px 18px 0;
    background: linear-gradient(180deg, #36332b, var(--panel));
}

.brand img {
    display: block;
    width: min(533px, 100%);
    height: auto;
}

.top-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 14px;
    background: var(--panel-dark);
    border-top: 1px solid #4a463a;
    border-bottom: 1px solid #171611;
}

.top-nav a {
    padding: 9px 13px;
    border-radius: 3px;
    font-weight: bold;
}

.top-nav a:hover,
.top-nav a:focus { background: var(--gold); color: #191815; }

.player-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    padding: 8px 18px;
    color: var(--muted);
    font-size: 12px;
}

.site-main { padding: 22px; min-height: 480px; }
.site-footer { margin-top: 10px; padding: 18px; text-align: center; color: var(--muted); }
.site-footer nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 7px 0; }
.site-footer small { display: block; }

h1, h2, h3 { margin: 0 0 14px; line-height: 1.2; }
h1 { color: var(--gold-light); font-size: 28px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 14px; }
hr { border: 0; border-top: 1px dashed var(--gold); margin: 22px 0; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
    gap: 28px;
    align-items: center;
}

.hero-copy { padding: 18px; }
.hero-copy .welcome-image { width: 480px; max-width: 100%; margin-bottom: 18px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.hero-map { padding: 18px; background: #302e28; border: 1px solid #514c3d; }

.button,
button,
input[type='submit'] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 15px;
    border: 1px solid var(--gold-light);
    border-radius: 3px;
    background: var(--gold);
    color: #1b1914;
    font: inherit;
    font-weight: bold;
    cursor: pointer;
}

.button:hover,
button:hover,
input[type='submit']:hover { background: var(--gold-light); color: #111; }
.button-secondary { background: #34312a; color: #fff; border-color: #77705d; }
.button-danger { background: var(--danger); color: #fff; border-color: #ef8a82; }
.button-small { min-height: 30px; padding: 4px 9px; font-size: 12px; }

input[type='text'],
input[type='email'],
input[type='password'],
input[type='number'],
select,
textarea {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid #887d55;
    border-radius: 3px;
    background: #28261f;
    color: #fff;
    font: inherit;
}

textarea { min-height: 150px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
label { display: block; margin-bottom: 6px; font-weight: bold; }
.form-row { margin-bottom: 16px; }
.form-help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-card { max-width: 660px; padding: 22px; margin: 0 auto; background: var(--panel-dark); border: 1px solid #5a5443; }
.checkbox-row { display: flex; align-items: flex-start; gap: 10px; }
.checkbox-row input { margin-top: 5px; }

.flash { padding: 12px 14px; margin-bottom: 16px; border-left: 4px solid var(--gold); background: #2b2923; }
.flash-success { border-color: var(--success); }
.flash-error { border-color: var(--danger); }
.flash-warning { border-color: #db9c3f; }

.game-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 22px; }
.game-sidebar { background: var(--panel-dark); border: 1px solid #504b3e; padding: 12px; align-self: start; position: sticky; top: 12px; }
.game-sidebar section + section { margin-top: 18px; }
.game-sidebar h2 { padding: 0 8px 7px; margin-bottom: 5px; color: var(--gold-light); font-size: 13px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid #57513e; }
.game-sidebar a { display: block; padding: 7px 8px; border-radius: 3px; }
.game-sidebar a:hover { background: #4b4639; }
.logout-link { margin-top: 18px; color: #ff8078; font-weight: bold; }
.badge { float: right; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--gold); color: #1b1914; text-align: center; font-size: 11px; }
.game-content { min-width: 0; }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card { padding: 17px; background: var(--panel-dark); border: 1px solid #514c3e; }
.card h2, .card h3 { color: var(--gold-light); }
.stat-value { display: block; margin-top: 5px; font-size: 25px; font-weight: bold; color: #fff; }
.muted { color: var(--muted); }
.danger { color: #ff8178; }
.success { color: #82d58a; }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; background: #2c2a24; }
.data-table th, .data-table td { padding: 10px 11px; border: 1px solid #5a5444; text-align: left; vertical-align: top; }
.data-table th { background: #1f1e1a; color: var(--gold-light); }
.data-table tr:nth-child(even) td { background: #312f28; }
.data-table .number { text-align: right; white-space: nowrap; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.inline-form { display: inline; }

.avatar-stage { position: relative; width: 250px; height: 550px; overflow: hidden; background: #000; flex: 0 0 250px; }
.avatar-layer { position: absolute; inset: 0; width: 250px; height: 550px; max-width: none; }
.avatar-small { transform: scale(.55); transform-origin: top left; margin-right: -112px; margin-bottom: -248px; }
.avatar-panel { display: flex; gap: 24px; align-items: flex-start; }
.name-art { display: flex; flex-wrap: wrap; align-items: flex-end; min-height: 34px; }
.name-art img { width: auto; max-height: 35px; }

.equipment-form { display: grid; gap: 12px; width: 100%; }
.equipment-row { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; align-items: center; }

.shop-groups { display: grid; gap: 24px; }
.shop-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.shop-item { display: flex; flex-direction: column; gap: 8px; min-height: 190px; padding: 15px; background: #2c2a24; border: 1px solid #57513f; }
.shop-item-visual { display: grid; place-items: center; height: 150px; overflow: hidden; background: #1f1e1a; border: 1px solid #494437; }
.shop-item-visual img { width: 100%; height: 100%; object-fit: contain; }
.shop-item .price { margin-top: auto; font-size: 18px; color: var(--gold-light); font-weight: bold; }
.shop-item .owned { color: var(--success); font-weight: bold; }

.map-shell { position: relative; width: 699px; max-width: 100%; margin: 0 auto; }
.map-shell .map-image { display: block; width: 100%; height: auto; }
.hood-marker { position: absolute; width: 24px; height: 24px; margin: -12px 0 0 -12px; border: 2px solid #fff; border-radius: 50%; background: var(--gold); color: #171611; font-size: 11px; line-height: 19px; text-align: center; font-weight: bold; box-shadow: 0 2px 5px #000; }
.hood-marker:hover, .hood-marker:focus { z-index: 50; background: #fff; color: #111; }
.hood-marker .hood-tooltip { display: none; position: absolute; left: 28px; top: -10px; width: 230px; padding: 10px; background: #171611; border: 1px solid var(--gold); color: #fff; text-align: left; font-weight: normal; line-height: 1.4; }
.hood-marker:hover .hood-tooltip, .hood-marker:focus .hood-tooltip { display: block; }

.attack-active { border-left: 5px solid var(--gold); }
.countdown { font-family: monospace; font-size: 24px; color: var(--gold-light); }
.progress-track { height: 10px; overflow: hidden; background: #161511; border-radius: 5px; }
.progress-bar { height: 100%; background: var(--gold); }

.profile-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 28px; }
.profile-text { white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 900px) {
    .hero, .game-layout, .profile-layout { grid-template-columns: 1fr; }
    .game-sidebar { position: static; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
    .game-sidebar section + section { margin-top: 0; }
    .grid, .shop-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .avatar-panel { flex-direction: column; }
}

@media (max-width: 620px) {
    .site-shell { width: min(100% - 12px, 1100px); margin: 6px auto; }
    .site-main { padding: 14px; }
    .top-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .player-strip { display: grid; }
    .game-sidebar, .grid, .grid-2, .shop-items, .form-grid { grid-template-columns: 1fr; }
    .equipment-row { grid-template-columns: 1fr; }
    .avatar-stage { transform: scale(.82); transform-origin: top left; margin-right: -45px; margin-bottom: -99px; }
    .hood-marker .hood-tooltip { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
}

input[type='search'] {
    width: 100%;
    min-height: 39px;
    padding: 8px 10px;
    border: 1px solid #887d55;
    border-radius: 3px;
    background: #28261f;
    color: #fff;
    font: inherit;
}

.data-table .badge,
.card .badge { float: none; display: inline-block; vertical-align: middle; }
