:root { --gold:#e8c060; --ink:#f0e6d0; --bg:#1b140e; --bg2:#2a1f15; --line:#6b4f2a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--ink); font: 14px Georgia, 'Times New Roman', serif; user-select: none; }
canvas#game { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: var(--ink); background: linear-gradient(#5a4128, #3a2a18); border: 1px solid var(--line); border-radius: 4px; padding: 4px 10px; cursor: pointer; }
button:hover { border-color: var(--gold); }
button.big { display: block; width: 100%; padding: 12px; font-size: 17px; margin: 8px 0; }
button.ghost { background: transparent; }
input { font: inherit; background: #120d08; color: var(--ink); border: 1px solid var(--line); border-radius: 3px; padding: 5px; }
.panel { background: rgba(27, 20, 14, .93); border: 2px solid var(--line); border-radius: 6px; box-shadow: 0 4px 18px rgba(0,0,0,.6), inset 0 0 0 1px #000; }
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(#2a1f15, #000); z-index: 50; }
.login-panel { width: min(520px, 94vw); padding: 26px 30px; }
.login-panel h1 { margin: 0; font-size: 40px; color: var(--gold); text-align: center; letter-spacing: 2px; text-shadow: 0 2px 0 #000; }
.login-panel h1 span { color: var(--ink); font-size: 24px; }
.sub { text-align: center; opacity: .8; }
.hint { font-size: 12px; opacity: .7; }
.err { color: #f77; min-height: 1em; }
.templates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.templates label { border: 1px solid var(--line); border-radius: 4px; padding: 8px; cursor: pointer; font-size: 12px; }
.templates input { display: none; }
.templates label:has(input:checked) { border-color: var(--gold); background: #3a2a18; }
.templates b { display: block; font-size: 15px; color: var(--gold); }
.row { display: flex; gap: 18px; align-items: center; }
label input#cName { width: 100%; margin-top: 4px; }

#status { position: fixed; left: 10px; top: 10px; width: 250px; padding: 8px 10px; z-index: 5; }
#status .nm { font-size: 16px; font-weight: bold; }
.bar { height: 11px; background: #200; border: 1px solid #000; margin: 3px 0; position: relative; }
.bar > i { display: block; height: 100%; }
.bar > span { position: absolute; inset: 0; font-size: 10px; text-align: center; line-height: 11px; text-shadow: 0 0 2px #000; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 8px; font-size: 12px; margin-top: 6px; }
.lock { cursor: pointer; color: var(--gold); font-size: 11px; padding: 0 3px; }
#toolbar { position: fixed; left: 270px; top: 10px; display: flex; gap: 4px; flex-wrap: wrap; z-index: 5; }
#btnWar.war { background: linear-gradient(#8a2020, #501010); }
#minimap { position: fixed; right: 10px; top: 10px; width: 200px; height: 200px; border: 2px solid var(--line); border-radius: 6px; z-index: 5; image-rendering: pixelated; }
#journal { position: fixed; left: 10px; bottom: 10px; width: min(560px, 60vw); height: 190px; display: flex; flex-direction: column; z-index: 5; background: rgba(15,10,7,.75); }
#journalLog { flex: 1; overflow-y: auto; padding: 6px 8px; font-size: 13px; user-select: text; }
#journalLog div { text-shadow: 0 1px 1px #000; }
#chat { margin: 4px; }
#targetHint { position: fixed; top: 60px; left: 50%; transform: translateX(-50%); padding: 6px 14px; background: rgba(80,0,0,.8); border: 1px solid #f66; border-radius: 4px; z-index: 20; }
#tooltip { position: fixed; pointer-events: none; z-index: 100; max-width: 260px; padding: 6px 9px; background: rgba(10,8,5,.96); border: 1px solid var(--line); border-radius: 4px; font-size: 12px; }
#tooltip .t { font-weight: bold; font-size: 13px; }
#tooltip .p { color: #8cf; }

.win { position: fixed; min-width: 230px; max-width: 420px; max-height: 70vh; display: flex; flex-direction: column; z-index: 10; }
.win header { cursor: move; padding: 5px 9px; background: linear-gradient(#4a3520, #2a1f15); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; color: var(--gold); font-weight: bold; }
.win header .x { cursor: pointer; color: var(--ink); padding: 0 4px; }
.win .body { padding: 8px; overflow-y: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, 48px); gap: 5px; }
.slot { width: 48px; height: 48px; background: #120d08; border: 1px solid #3a2a18; border-radius: 4px; position: relative; cursor: pointer; display: grid; place-items: center; }
.slot:hover { border-color: var(--gold); }
.slot .ic { width: 26px; height: 26px; border-radius: 5px; border: 2px solid #000; }
.slot .n { position: absolute; right: 2px; bottom: 0; font-size: 10px; text-shadow: 0 0 2px #000; }
.slot .nft { position: absolute; left: 1px; top: 0; font-size: 9px; color: #c9f; }
.list { width: 100%; border-collapse: collapse; font-size: 13px; }
.list td { padding: 2px 4px; border-bottom: 1px solid #2a1f15; }
.list tr:hover td { background: #2a1f15; }
.muted { opacity: .65; font-size: 12px; }
.pd { display: grid; grid-template-columns: 70px 1fr; gap: 4px 8px; align-items: center; }
.ctx { position: fixed; z-index: 120; display: flex; flex-direction: column; min-width: 120px; }
.ctx button { border-radius: 0; text-align: left; }
a { color: #c9f; }
