:root {
  --ink: #0d1b1e;
  --ink2: #12282b;
  --panel: #173235;
  --panel2: #1d3d40;
  --cream: #f1e8d2;
  --muted: #b8b09a;
  --gold: #d4af37;
  --gold2: #f0d473;
  --copper: #b96f4b;
  --sage: #7fb3a6;
  --rose: #c97b63;
  --line: rgba(212,175,55,.28);
  --shadow: 0 18px 60px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  color: var(--cream);
  background:
    radial-gradient(circle at 12% 10%, rgba(127,179,166,.13), transparent 32rem),
    radial-gradient(circle at 88% 18%, rgba(212,175,55,.10), transparent 30rem),
    linear-gradient(145deg, #0a1517 0%, #0d1b1e 45%, #102326 100%);
  min-height: 100vh;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.grain {
  pointer-events: none; position: fixed; inset: 0; opacity: .07; z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.auth-panel {
  width: min(460px, 100%); padding: 42px 38px; text-align: center; position: relative;
  background: linear-gradient(160deg, rgba(29,61,64,.96), rgba(13,27,30,.98));
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.auth-panel::before, .auth-panel::after {
  content: ""; position: absolute; width: 54px; height: 54px; border: 1px solid var(--gold);
}
.auth-panel::before { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.auth-panel::after { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.crest {
  width: 72px; height: 72px; margin: 0 auto 16px; display: grid; place-items: center;
  border: 1px solid var(--gold); color: var(--gold2); font-size: 38px;
  transform: rotate(45deg); background: rgba(212,175,55,.06);
}
.crest::first-letter { transform: rotate(-45deg); }
h1 { font-size: clamp(44px, 10vw, 66px); margin: 0; letter-spacing: .12em; color: var(--gold2); font-weight: 400; }
.subtitle { margin: 2px 0 26px; letter-spacing: .26em; text-transform: uppercase; color: var(--muted); font-size: 11px; }
.eyebrow { color: var(--gold); letter-spacing: .22em; text-transform: uppercase; font-size: 10px; margin: 0 0 8px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.auth-tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 10px; border-bottom: 2px solid transparent; }
.auth-tabs button.active { color: var(--gold2); border-bottom-color: var(--gold); }
.stack { display: grid; gap: 14px; text-align: left; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
input, select {
  width: 100%; padding: 11px 12px; border: 1px solid rgba(212,175,55,.24); background: rgba(0,0,0,.25);
  color: var(--cream); border-radius: 2px; outline: none;
}
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(212,175,55,.12); }
select option { background: var(--ink2); }
.btn { border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--cream); padding: 9px 14px; border-radius: 2px; transition: .18s; letter-spacing: .04em; }
.btn:hover { border-color: var(--gold); background: rgba(212,175,55,.09); }
.btn.gold { background: linear-gradient(180deg, var(--gold2), var(--gold)); color: #1a1a11; border-color: var(--gold2); font-weight: 700; }
.btn.gold:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.tiny { padding: 5px 9px; font-size: 12px; }
.btn.danger { border-color: rgba(201,123,99,.5); color: #f0b6a5; }
.btn.wide { width: 100%; }
.fineprint { color: var(--muted); font-size: 11px; margin: 24px 0 0; letter-spacing: .06em; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(13,27,30,.9); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold2); transform: rotate(45deg); }
.brand strong { display: block; color: var(--gold2); letter-spacing: .14em; font-weight: 400; }
.brand small { display: block; color: var(--muted); letter-spacing: .18em; text-transform: uppercase; font-size: 8px; }
.status-strip { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.status-strip b { color: var(--cream); font-weight: 400; }
.user-area { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.main-tabs { display: flex; gap: 4px; padding: 10px 22px; border-bottom: 1px solid rgba(212,175,55,.12); overflow-x: auto; }
.main-tabs button { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 7px 12px; white-space: nowrap; }
.main-tabs button.active { color: var(--gold2); border-color: var(--line); background: rgba(212,175,55,.06); }
main { padding: 24px 22px 60px; max-width: 1500px; margin: 0 auto; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid.map-grid { grid-template-columns: minmax(0,1.7fr) minmax(300px,.8fr); }
.card { background: linear-gradient(160deg, rgba(29,61,64,.72), rgba(13,27,30,.86)); border: 1px solid rgba(212,175,55,.16); padding: 18px; position: relative; }
.card h2, .card h3 { margin: 0 0 12px; color: var(--gold2); font-weight: 400; letter-spacing: .08em; }
.card h2 { font-size: 20px; }
.card h3 { font-size: 15px; text-transform: uppercase; font-size: 11px; color: var(--gold); }
.card .lede { color: var(--muted); font-size: 13px; line-height: 1.55; }
.metric { padding: 14px 12px; border-left: 2px solid var(--gold); background: rgba(0,0,0,.14); }
.metric small { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; display: block; }
.metric b { display: block; font-size: 21px; color: var(--cream); font-weight: 400; margin-top: 4px; }
.metric.good b { color: var(--sage); }
.metric.warn b { color: var(--rose); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid rgba(212,175,55,.12); }
th { color: var(--gold); text-transform: uppercase; letter-spacing: .1em; font-size: 9px; font-weight: 400; }
td.num, th.num { text-align: right; }
tr:hover td { background: rgba(212,175,55,.035); }
.tag { display: inline-block; padding: 2px 7px; border: 1px solid var(--line); font-size: 10px; color: var(--muted); margin: 1px 2px; }
.tag.good { color: var(--sage); border-color: rgba(127,179,166,.4); }
.tag.bad { color: var(--rose); border-color: rgba(201,123,99,.4); }
.tag.gold { color: var(--gold2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.plant-card { border: 1px solid rgba(212,175,55,.18); padding: 14px; background: rgba(0,0,0,.13); }
.plant-card h4 { margin: 0 0 4px; color: var(--gold2); font-weight: 400; font-size: 16px; }
.plant-card .where { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.bar { height: 5px; background: rgba(255,255,255,.08); margin: 8px 0; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--copper), var(--gold2)); }
.formline { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.formline label { flex: 1; min-width: 90px; }
.formline .btn { flex: 0 0 auto; }
.map-shell { background: radial-gradient(circle at 50% 45%, #1b3b3e, #0a1719); border: 1px solid var(--line); padding: 8px; }
.map-svg { width: 100%; height: auto; display: block; }
.city-dot { fill: var(--gold2); stroke: #2a1e08; stroke-width: 1.5; }
.city-label { fill: #d9cfb6; font-size: 7px; font-family: Georgia, serif; }
.city-market { fill: #fff0b8; }
.player-marker { stroke: #0d1b1e; stroke-width: 2; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 10px; color: var(--muted); margin-top: 8px; }
.legend i { width: 8px; height: 8px; display: inline-block; border-radius: 50%; margin-right: 4px; }
.log { max-height: 420px; overflow: auto; display: grid; gap: 8px; }
.log-item { border-left: 1px solid var(--line); padding-left: 10px; font-size: 12px; color: #d6cdb8; line-height: 1.45; }
.log-item small { color: var(--gold); display: block; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.lobby-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; flex-wrap: wrap; margin-bottom: 18px; }
.lobby-head h1 { font-size: 38px; letter-spacing: .06em; }
.game-card { border: 1px solid var(--line); padding: 18px; background: rgba(0,0,0,.14); }
.game-card h3 { margin: 0 0 6px; font-size: 18px; color: var(--gold2); }
.game-card .meta { color: var(--muted); font-size: 12px; }
.notice { border: 1px solid rgba(212,175,55,.3); background: rgba(212,175,55,.06); padding: 12px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.empty { color: var(--muted); font-size: 13px; padding: 20px; text-align: center; border: 1px dashed rgba(212,175,55,.2); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--panel2); border: 1px solid var(--gold); color: var(--cream); padding: 11px 18px; z-index: 2000; opacity: 0; transition: .25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--rose); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 1500; display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(760px, 100%); max-height: 86vh; overflow: auto; background: var(--ink2); border: 1px solid var(--gold); padding: 24px; position: relative; box-shadow: var(--shadow); }
.modal-close { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--muted); font-size: 28px; }
.auction { border: 1px solid rgba(212,175,55,.45); padding: 18px; background: linear-gradient(145deg, rgba(212,175,55,.1), rgba(0,0,0,.15)); }
.auction h3 { color: var(--gold2); font-size: 22px; margin: 0 0 4px; }
.countdown { font-size: 12px; color: var(--rose); }
.painting { border: 1px solid var(--line); padding: 12px; background: rgba(0,0,0,.18); }
.painting .frame { aspect-ratio: 4/3; background: linear-gradient(135deg, #3b2b18, #1b2c2a); border: 6px solid #6e5425; display: grid; place-items: center; color: rgba(212,175,55,.6); font-size: 28px; margin-bottom: 8px; }
.painting b { color: var(--gold2); font-weight: 400; display: block; }
.painting small { color: var(--muted); }
@media (max-width: 900px) {
  .grid.two, .grid.three, .grid.four, .grid.map-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .status-strip { order: 3; flex-basis: 100%; }
  .brand { min-width: 0; }
  main { padding: 16px 14px 50px; }
}
