:root {
  color-scheme: dark;
  --bg: #071217;
  --panel: rgba(10, 24, 29, 0.92);
  --panel-soft: rgba(15, 33, 38, 0.78);
  --line: rgba(196, 224, 211, 0.13);
  --line-bright: rgba(244, 204, 118, 0.35);
  --text: #edf4ed;
  --muted: #8ea5a2;
  --gold: #f4cc76;
  --jade: #5de2ce;
  --ember: #ff806b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
.hidden { display: none !important; }
.screen { width: 100%; min-height: 100dvh; }
svg { display: block; }

.lobby-screen, .room-screen { position: relative; min-height: 100dvh; overflow: hidden; background: radial-gradient(circle at 70% 35%, #183936 0, #0b1c22 38%, #071217 76%); }
.lobby-screen::before, .room-screen::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(133, 190, 174, 0.025) 1px, transparent 1px), linear-gradient(90deg, rgba(133, 190, 174, 0.025) 1px, transparent 1px); background-size: 54px 54px; mask-image: linear-gradient(to bottom, black, transparent 85%); }
#ambientCanvas, #roomAmbientCanvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.65; }
.ambient-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4, 13, 18, 0.5), transparent 45%, rgba(4, 13, 18, 0.15)), linear-gradient(0deg, rgba(4, 13, 18, 0.8), transparent 35%); pointer-events: none; }
.lobby-header { position: relative; z-index: 2; width: min(1380px, calc(100% - 80px)); height: 108px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; }
.brand-crest { width: 48px; height: 48px; display: grid; place-items: center; color: var(--gold); border: 1px solid rgba(244, 204, 118, 0.35); background: rgba(244, 204, 118, 0.05); transform: rotate(45deg); }
.brand-crest svg { width: 33px; height: 33px; fill: none; stroke: currentColor; stroke-width: 1.35; transform: rotate(-45deg); }
.brand > span:last-child { display: flex; flex-direction: column; gap: 5px; }
.brand strong { font-size: 21px; letter-spacing: 0.18em; }
.brand small { color: var(--gold); font-size: 9px; letter-spacing: 0.32em; }
.brand-crest.small { width: 36px; height: 36px; }
.brand-crest.small svg { width: 25px; height: 25px; }
.online-pill { display: flex; align-items: center; gap: 9px; padding: 10px 15px; color: #b5c9c4; border: 1px solid var(--line); background: rgba(9, 24, 28, 0.48); border-radius: 99px; font-size: 11px; letter-spacing: 0.08em; }
.live-dot, .map-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--jade); box-shadow: 0 0 0 4px rgba(93, 226, 206, 0.1), 0 0 15px rgba(93, 226, 206, 0.7); animation: breathe 2.2s ease-in-out infinite; }
.lobby-content { position: relative; z-index: 2; width: min(1240px, calc(100% - 100px)); min-height: calc(100dvh - 200px); margin: 0 auto; display: grid; grid-template-columns: 1.25fr 0.75fr; gap: clamp(50px, 8vw, 130px); align-items: center; padding: 30px 0 70px; }
.hero-copy { padding-bottom: 20px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--gold); font-size: 10px; font-weight: 650; letter-spacing: 0.23em; }
.eyebrow > span { width: 28px; height: 1px; background: var(--gold); }
.hero-copy h1 { margin: 25px 0 26px; font-family: "Songti SC", "STSong", serif; font-size: clamp(58px, 6.8vw, 94px); font-weight: 600; line-height: 1.1; letter-spacing: 0.08em; text-shadow: 0 10px 50px rgba(0, 0, 0, 0.3); }
.hero-copy h1 em { color: var(--gold); font-style: normal; background: linear-gradient(120deg, #fff0bb, #d7ae5d); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero-description { max-width: 570px; margin: 0; color: #a9bcb7; font-size: 15px; line-height: 2; letter-spacing: 0.035em; }
.feature-row { display: flex; gap: 0; margin-top: 50px; }
.feature-row > div { position: relative; min-width: 150px; padding: 0 28px; border-left: 1px solid var(--line); display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; row-gap: 7px; }
.feature-row > div:first-child { padding-left: 0; border-left: 0; }
.feature-icon { grid-row: span 2; color: var(--gold); font-family: Georgia, serif; font-size: 12px; padding-top: 2px; }
.feature-row strong { font-size: 13px; letter-spacing: 0.08em; }
.feature-row small { color: var(--muted); font-size: 10px; white-space: nowrap; }
.glass-card { position: relative; border: 1px solid var(--line); background: linear-gradient(145deg, rgba(20, 42, 45, 0.9), rgba(8, 21, 27, 0.94)); box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.035); backdrop-filter: blur(24px); }
.entry-card { padding: 34px; border-radius: 3px; }
.card-corner { position: absolute; width: 22px; height: 22px; pointer-events: none; }
.corner-tl { top: -1px; left: -1px; border-top: 2px solid var(--gold); border-left: 2px solid var(--gold); }
.corner-br { right: -1px; bottom: -1px; border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); }
.entry-heading { display: flex; gap: 14px; align-items: center; margin-bottom: 29px; }
.mini-crest { width: 44px; height: 44px; display: grid; place-items: center; color: var(--gold); border: 1px solid rgba(244, 204, 118, 0.25); background: rgba(244, 204, 118, 0.055); font-size: 21px; }
.entry-heading h2 { margin: 0 0 6px; font-family: "Songti SC", serif; font-size: 22px; letter-spacing: 0.08em; }
.entry-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.field-label { display: block; margin: 18px 0 9px; color: #b9c8c3; font-size: 11px; letter-spacing: 0.08em; }
.input-wrap { height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); background: rgba(2, 12, 17, 0.45); transition: border-color 0.2s; }
.input-wrap:focus-within { border-color: rgba(244, 204, 118, 0.6); }
.input-icon { color: var(--gold); font-size: 17px; }
.input-wrap input, .code-input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; }
.input-wrap input::placeholder, .code-input::placeholder { color: #617874; }
.primary-button, .secondary-button, .invite-button { width: 100%; min-height: 48px; border-radius: 2px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 12px; font-weight: 650; letter-spacing: 0.08em; transition: transform 0.18s, border-color 0.18s, background 0.18s; }
.primary-button { margin-top: 17px; border: 1px solid #e5c274; color: #18211c; background: linear-gradient(110deg, #f6d98e, #d9b360); box-shadow: 0 8px 28px rgba(213, 179, 96, 0.14); }
.primary-button:hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(110deg, #ffe6a5, #e7c373); }
.button-arrow { font-size: 18px; font-weight: 400; }
.secondary-button { border: 1px solid var(--line); color: #d9e6e0; background: rgba(19, 41, 44, 0.6); }
.secondary-button:hover:not(:disabled) { border-color: rgba(93, 226, 206, 0.4); background: rgba(28, 57, 58, 0.75); }
.bot-entry-button { margin-top: 10px; justify-content: flex-start; padding: 0 17px; }
.bot-entry-button .button-arrow { margin-left: auto; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 17px; color: #647d78; font-size: 10px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.join-row { display: grid; grid-template-columns: 1fr 92px; gap: 10px; }
.code-input { height: 46px; padding: 0 15px; border: 1px solid var(--line); background: rgba(2, 12, 17, 0.45); text-transform: uppercase; letter-spacing: 0.25em; font-size: 16px; }
.join-row .secondary-button { min-height: 46px; }
.entry-note { margin: 18px 0 0; color: #718984; font-size: 10px; line-height: 1.7; text-align: center; }
.tiny-shield { color: var(--gold); margin-right: 5px; }
.form-error { min-height: 18px; margin-top: 10px; color: #ff9b87; font-size: 11px; text-align: center; }
.lobby-footer { position: absolute; z-index: 2; bottom: 27px; left: 50%; transform: translateX(-50%); width: min(1380px, calc(100% - 80px)); display: flex; justify-content: space-between; color: #5f7772; font-size: 9px; letter-spacing: 0.16em; }
.text-button { border: 0; padding: 8px 0; color: #9fb5af; background: transparent; font-size: 12px; }
.text-button:hover { color: var(--gold); }
.waiting-wrap { position: relative; z-index: 2; width: min(720px, calc(100% - 40px)); margin: 4vh auto 0; padding-bottom: 40px; }
.waiting-card { padding: 38px 42px; text-align: center; }
.waiting-topline { display: flex; align-items: center; justify-content: space-between; }
.status-chip { padding: 6px 10px; color: var(--gold); border: 1px solid rgba(244, 204, 118, 0.2); background: rgba(244, 204, 118, 0.05); font-size: 10px; }
.waiting-card h2 { margin: 22px 0 9px; font-family: "Songti SC", serif; font-size: 32px; letter-spacing: 0.12em; }
.waiting-subtitle { margin: 0; color: var(--muted); font-size: 12px; }
.room-code-block { margin: 28px 0; padding: 18px; display: flex; align-items: center; justify-content: center; gap: 18px; border: 1px solid var(--line); background: rgba(2, 12, 17, 0.35); }
.room-code-block > span { color: var(--muted); font-size: 11px; }
.room-code-block strong { color: var(--gold); font-size: 30px; letter-spacing: 0.28em; font-family: ui-monospace, monospace; }
.icon-text-button { border: 1px solid var(--line); padding: 6px 10px; color: #b6c8c2; background: transparent; font-size: 10px; }
.seat-row { display: grid; grid-template-columns: 1fr 50px 1fr; align-items: center; gap: 12px; }
.seat { min-height: 170px; padding: 22px 12px; border: 1px solid var(--line); background: rgba(16, 35, 39, 0.6); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.seat-crest { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 5px; border: 1px solid currentColor; transform: rotate(45deg); font-family: Georgia, serif; font-size: 18px; }
.seat-crest span { transform: rotate(-45deg); }
.jade-seat .seat-crest, .jade .empire-dot { color: var(--jade); }
.ember-seat .seat-crest, .ember .empire-dot { color: var(--ember); }
.seat strong { font-size: 14px; }
.seat small { color: var(--muted); font-size: 10px; }
.seat-state { width: 5px; height: 5px; margin-top: 4px; border-radius: 50%; background: currentColor; }
.versus { color: var(--gold); font-family: Georgia, serif; font-size: 17px; }
.invite-button { margin-top: 20px; border: 1px solid var(--line); color: #b9ccc6; background: rgba(16, 35, 39, 0.5); }
.bot-seat-button { margin-top: 10px; }

.game-screen { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #0a171b; }
.game-topbar { position: relative; z-index: 20; min-height: 76px; padding: 0 20px; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); background: rgba(7, 18, 23, 0.97); box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2); }
.game-brand { min-width: 170px; display: flex; align-items: center; gap: 13px; }
.game-brand strong { font-size: 14px; letter-spacing: 0.13em; }
.game-brand small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; letter-spacing: 0.08em; }
.resource-bar { flex: 1; display: flex; justify-content: center; gap: clamp(12px, 2vw, 34px); }
.resource { min-width: 105px; display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; padding: 8px; border: 1px solid transparent; border-radius: 3px; transition: background 0.18s, border-color 0.18s; }
.resource:hover { background: rgba(255, 255, 255, 0.035); border-color: var(--line); }
.resource-icon { width: 31px; height: 31px; display: grid; place-items: center; flex: 0 0 auto; color: var(--resource-color); border: 1px solid color-mix(in srgb, var(--resource-color) 28%, transparent); background: color-mix(in srgb, var(--resource-color) 7%, transparent); border-radius: 50%; }
.resource-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.resource > div { display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 8px; }
.resource small { grid-column: span 2; display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.resource small span { color: var(--resource-color); }
.resource strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.resource em { color: #86a098; font-size: 9px; font-style: normal; }
.resource.gold { --resource-color: #f4cc76; }
.resource.food { --resource-color: #b8d979; }
.resource.wood { --resource-color: #d59a68; }
.resource.stone { --resource-color: #aab9c9; }
.timer-block { min-width: 86px; padding-left: 20px; border-left: 1px solid var(--line); text-align: right; }
.timer-block small { display: block; color: var(--muted); font-size: 9px; }
.timer-block strong { display: block; margin: 3px 0; color: var(--gold); font-family: ui-monospace, monospace; font-size: 21px; letter-spacing: 0.05em; }
.timer-block span { color: #8da59d; font-size: 9px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.connection-badge { display: flex; align-items: center; gap: 6px; margin-right: 4px; color: #8fb0a6; font-size: 9px; white-space: nowrap; }
.connection-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--jade); }
.connection-badge.offline { color: var(--ember); }
.connection-badge.offline i { background: var(--ember); }
.square-button { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--line); color: #a9bdb7; background: rgba(255, 255, 255, 0.025); font-size: 13px; }
.square-button:hover { color: var(--gold); border-color: var(--line-bright); }
.game-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 286px; }
.map-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #203b39; }
#mapCanvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#mapCanvas:active { cursor: grabbing; }
#mapCanvas:focus { outline: none; }
#mapCanvas:focus-visible { outline: 1px solid rgba(93, 226, 206, 0.45); outline-offset: -2px; }
.map-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 100px rgba(3, 12, 15, 0.4); background: linear-gradient(0deg, rgba(4, 14, 18, 0.24), transparent 22%, transparent 78%, rgba(4, 14, 18, 0.16)); }
.selection-box { position: absolute; z-index: 8; border: 1px solid rgba(193, 255, 243, 0.9); background: rgba(93, 226, 206, 0.12); box-shadow: 0 0 18px rgba(93, 226, 206, 0.16), inset 0 0 14px rgba(93, 226, 206, 0.08); pointer-events: none; }
.map-heading { position: absolute; top: 22px; left: 24px; display: flex; align-items: center; gap: 12px; pointer-events: none; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.map-heading small { display: block; margin-bottom: 5px; color: #c0d5cb; font-size: 9px; letter-spacing: 0.14em; }
.map-heading strong { font-family: "Songti SC", serif; font-size: 19px; letter-spacing: 0.12em; }
.placement-banner { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); min-width: 280px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; border: 1px solid rgba(244, 204, 118, 0.35); background: rgba(8, 21, 25, 0.9); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.placement-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px rgba(244, 204, 118, 0.5); }
.placement-banner strong { display: block; font-size: 11px; }
.placement-banner small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.placement-banner button { margin-left: auto; border: 1px solid var(--line); padding: 6px 9px; color: #b7c9c2; background: transparent; font-size: 9px; }
.selection-panel { position: absolute; left: 24px; bottom: 54px; max-width: 330px; padding: 13px 17px; border-left: 2px solid var(--gold); background: linear-gradient(90deg, rgba(6, 18, 22, 0.88), rgba(6, 18, 22, 0.45)); backdrop-filter: blur(10px); pointer-events: none; }
.selection-kicker { display: block; margin-bottom: 5px; color: var(--gold); font-size: 8px; letter-spacing: 0.18em; }
.selection-panel strong { font-size: 12px; }
.selection-panel p { margin: 5px 0 0; color: #9db2aa; font-size: 9px; }
.world-tip { position: absolute; left: 24px; bottom: 20px; max-width: calc(100% - 48px); display: flex; flex-wrap: wrap; gap: 6px 14px; color: rgba(221, 234, 226, 0.68); font-size: 8px; pointer-events: none; text-shadow: 0 1px 4px #000; }
kbd { padding: 2px 4px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 2px; color: #e9eee8; background: rgba(6, 16, 20, 0.5); font-family: inherit; font-size: 8px; }
.map-controls { position: absolute; z-index: 12; right: 20px; top: 22px; display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.map-control { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(220, 237, 227, 0.2); color: #dce9e1; background: rgba(7, 20, 24, 0.82); backdrop-filter: blur(8px); font-size: 17px; cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s; }
.map-control:hover { color: var(--gold); border-color: var(--line-bright); background: rgba(15, 34, 36, 0.94); }
.map-control:active { transform: translateY(1px); background: rgba(28, 49, 47, 0.98); }
.map-control.wide { width: auto; min-height: 36px; padding: 0 12px; font-size: 10px; }
.minimap-wrap { position: absolute; z-index: 12; right: 20px; bottom: 20px; width: 188px; padding: 6px; border: 1px solid rgba(220, 237, 227, 0.17); background: rgba(5, 16, 20, 0.8); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); backdrop-filter: blur(10px); pointer-events: auto; }
.minimap-wrap canvas { width: 100%; height: auto; display: block; cursor: crosshair; image-rendering: auto; }
.minimap-wrap span { display: block; padding: 5px 2px 1px; color: #8ba29a; font-size: 8px; letter-spacing: 0.14em; }
.mobile-intel-button { display: none; }
.toast-region { position: absolute; top: 85px; left: 50%; transform: translateX(-50%); width: min(380px, 80%); display: flex; flex-direction: column; align-items: center; gap: 7px; pointer-events: none; }
.toast { padding: 10px 16px; border: 1px solid var(--line); color: #e1ece5; background: rgba(7, 20, 24, 0.92); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); font-size: 10px; animation: toast-in 0.25s ease-out; }
.toast.error { color: #ffc0b2; border-color: rgba(255, 128, 107, 0.3); }
.toast.success { color: #baf5e6; border-color: rgba(93, 226, 206, 0.28); }
.intel-panel { min-height: 0; padding: 21px 18px 14px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; border-left: 1px solid var(--line); background: linear-gradient(180deg, #0d1d22, #09171c); }
.intel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.intel-heading .eyebrow { font-size: 8px; }
.intel-heading h3, .log-heading h3 { margin: 6px 0 0; font-family: "Songti SC", serif; font-size: 17px; letter-spacing: 0.1em; }
.intel-mark { color: var(--gold); font-size: 22px; }
.power-card { padding: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.018); }
.power-title { display: flex; align-items: center; gap: 8px; }
.empire-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.power-title strong { font-size: 11px; letter-spacing: 0.06em; }
.power-title > span:last-child { margin-left: auto; color: var(--gold); font-family: ui-monospace, monospace; font-size: 11px; }
.stat-line { display: flex; justify-content: space-between; margin: 10px 0 9px; color: var(--muted); font-size: 8px; }
.stat-line b { margin-left: 3px; color: #d7e5de; font-weight: 500; font-variant-numeric: tabular-nums; }
.power-track { height: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.06); }
.power-track span { display: block; width: 50%; height: 100%; background: var(--jade); transition: width 0.4s; }
.ember .power-track span { background: var(--ember); }
.army-card { padding: 13px 12px; border: 1px solid var(--line); background: linear-gradient(120deg, rgba(36, 67, 62, 0.3), rgba(15, 31, 36, 0.4)); }
.army-card > div { display: flex; align-items: center; gap: 11px; }
.army-icon, .army-emblem { width: 38px; height: 38px; display: grid; place-items: center; color: var(--gold); border: 1px solid rgba(244, 204, 118, 0.2); background: rgba(244, 204, 118, 0.05); }
.army-icon svg, .army-emblem svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.army-card small { display: block; color: var(--muted); font-size: 8px; }
.army-card strong { display: block; margin: 2px 0; font-size: 23px; line-height: 1; }
.army-card strong em { margin-left: 4px; color: #7f9990; font-size: 10px; font-style: normal; font-weight: 400; }
.army-composition { margin-top: 4px; color: #b7cbc2 !important; letter-spacing: 0.06em; }
.army-status { display: block; margin-top: 10px; color: var(--jade); font-size: 8px; }
.training-status { width: 100%; margin-top: 7px; padding-top: 8px; border-top: 1px solid var(--line); }
.objective-card { display: flex; gap: 11px; padding: 12px; border: 1px solid rgba(244, 204, 118, 0.15); background: rgba(244, 204, 118, 0.035); }
.objective-icon { color: var(--gold); font-size: 22px; }
.objective-card strong { font-size: 10px; }
.objective-card p { margin: 5px 0 0; color: #91a79f; font-size: 8px; line-height: 1.7; }
.log-heading { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.log-heading h3 { font-size: 13px; }
.log-heading > span { color: var(--jade); font-size: 7px; letter-spacing: 0.15em; }
.battle-log { flex: 1; min-height: 70px; overflow: hidden; display: flex; flex-direction: column; gap: 7px; mask-image: linear-gradient(to bottom, black 75%, transparent); }
.log-entry { padding-left: 9px; border-left: 1px solid #49615b; color: #8fa69e; font-size: 8px; line-height: 1.5; }
.log-entry.jade { border-color: var(--jade); }
.log-entry.ember { border-color: var(--ember); }
.log-entry.chat { color: #d5e4dc; }
.chat-form { height: 34px; display: flex; border: 1px solid var(--line); background: rgba(2, 11, 15, 0.35); }
.chat-form input { flex: 1; min-width: 0; padding: 0 10px; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 9px; }
.chat-form input::placeholder { color: #5d7770; }
.chat-form button { width: 35px; border: 0; color: var(--gold); background: transparent; }
.command-dock { position: relative; z-index: 20; min-height: 92px; padding: 12px 20px; display: flex; align-items: center; gap: 20px; border-top: 1px solid var(--line); background: rgba(7, 18, 23, 0.98); box-shadow: 0 -8px 35px rgba(0, 0, 0, 0.2); }
.army-summary { min-width: 115px; display: flex; align-items: center; gap: 11px; }
.army-emblem { width: 42px; height: 42px; }
.army-summary small { display: block; color: var(--muted); font-size: 8px; }
.army-summary strong { display: block; margin-top: 3px; color: var(--gold); font-size: 24px; }
.command-list { flex: 1; display: flex; gap: 7px; overflow-x: auto; padding: 2px; scrollbar-width: thin; scrollbar-color: #38534c transparent; }
.command-button { position: relative; min-width: 65px; height: 62px; padding: 7px 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--line); color: #b8cac2; background: rgba(18, 37, 41, 0.68); transition: border-color 0.18s, background 0.18s, transform 0.18s; }
.command-button:hover:not(:disabled) { transform: translateY(-1px); border-color: rgba(244, 204, 118, 0.4); background: rgba(31, 54, 55, 0.85); }
.command-button.active { border-color: var(--gold); color: var(--gold); background: rgba(244, 204, 118, 0.08); box-shadow: inset 0 0 18px rgba(244, 204, 118, 0.05); }
.command-button.unavailable { opacity: 0.42; }
.command-icon { height: 22px; color: var(--gold); font-size: 19px; line-height: 1; }
.command-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.command-button > span:last-of-type { font-size: 9px; white-space: nowrap; }
.command-key { position: absolute; top: 4px; right: 5px; color: #69837a; font-family: ui-monospace, monospace; font-size: 7px; }
.command-cost { color: #7f9a90; font-size: 7px; white-space: nowrap; }
.command-hint { min-width: 160px; display: flex; align-items: center; gap: 10px; padding-left: 18px; border-left: 1px solid var(--line); }
.hint-key { min-width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-bright); color: var(--gold); font-family: ui-monospace, monospace; font-size: 10px; }
.command-hint p { margin: 0; color: #7f9890; font-size: 8px; line-height: 1.7; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; padding: 25px; display: grid; place-items: center; background: rgba(2, 9, 12, 0.78); backdrop-filter: blur(12px); }
.modal-card { position: relative; width: min(760px, 100%); max-height: calc(100dvh - 50px); overflow: auto; padding: 40px; border: 1px solid var(--line-bright); background: linear-gradient(145deg, #12282b, #08171d 70%); box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 14px; right: 16px; width: 30px; height: 30px; border: 1px solid var(--line); color: #9eb3ab; background: transparent; font-size: 20px; }
.modal-card h2 { margin: 12px 0 8px; font-family: "Songti SC", serif; font-size: 34px; letter-spacing: 0.12em; }
.modal-subtitle { margin: 0; color: var(--muted); font-size: 12px; }
.help-grid { margin: 28px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help-grid > div { position: relative; padding: 18px 18px 18px 48px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.018); }
.help-grid > div > span { position: absolute; top: 18px; left: 16px; color: var(--gold); font-family: Georgia, serif; font-size: 12px; }
.help-grid h3 { margin: 0 0 8px; font-size: 13px; }
.help-grid p { margin: 0; color: #94aaa2; font-size: 10px; line-height: 1.8; }
.shortcut-row { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 25px; color: #94aaa2; font-size: 9px; }
.shortcut-row kbd { margin-right: 4px; color: var(--gold); border-color: var(--line-bright); }
.help-card .primary-button { max-width: 280px; margin: 0 auto; }
.end-card { width: min(520px, 100%); text-align: center; }
.end-crest { width: 74px; height: 74px; margin: 0 auto 22px; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); background: rgba(244, 204, 118, 0.06); transform: rotate(45deg); box-shadow: 0 0 40px rgba(244, 204, 118, 0.1); }
.end-crest span { transform: rotate(-45deg); font-size: 34px; }
.end-card .eyebrow { justify-content: center; }
.end-card h2 { margin-top: 15px; }
#endDescription { color: var(--muted); font-size: 12px; line-height: 1.8; }
.end-stats { margin: 28px 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.end-stats > div { padding: 15px 6px; border-left: 1px solid var(--line); }
.end-stats > div:first-child { border-left: 0; }
.end-stats small { display: block; color: var(--muted); font-size: 8px; }
.end-stats strong { display: block; margin-top: 7px; color: var(--gold); font-size: 21px; }
.end-card .text-button { margin-top: 12px; }
.disconnect-overlay { position: fixed; z-index: 120; inset: 0; display: grid; place-items: center; background: rgba(3, 11, 15, 0.84); backdrop-filter: blur(9px); }
.disconnect-overlay > div { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.disconnect-overlay strong { font-family: "Songti SC", serif; font-size: 20px; letter-spacing: 0.1em; }
.disconnect-overlay small { color: var(--muted); font-size: 10px; }
.loading-ring { width: 38px; height: 38px; margin-bottom: 8px; border: 2px solid rgba(244, 204, 118, 0.15); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; }

@keyframes breathe { 50% { opacity: 0.5; transform: scale(0.85); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-7px); } }

@media (max-width: 1180px) {
  .lobby-content { width: min(1080px, calc(100% - 70px)); gap: 55px; }
  .feature-row > div { min-width: 130px; padding: 0 18px; }
  .game-topbar { gap: 14px; padding: 0 14px; }
  .game-brand { min-width: 145px; }
  .resource-bar { gap: 8px; }
  .resource { min-width: 88px; padding: 6px; gap: 7px; }
  .resource-icon { width: 27px; height: 27px; }
  .resource small span { display: none; }
  .game-layout { grid-template-columns: minmax(0, 1fr) 258px; }
  .intel-panel { padding: 17px 13px 12px; }
  .command-hint { display: none; }
}

@media (max-width: 900px) {
  .lobby-header { width: calc(100% - 40px); height: 86px; }
  .lobby-content { width: calc(100% - 50px); min-height: calc(100dvh - 150px); grid-template-columns: 1fr; gap: 35px; padding: 35px 0 80px; }
  .hero-copy { text-align: center; }
  .hero-copy .eyebrow { justify-content: center; }
  .hero-copy h1 { font-size: clamp(52px, 10vw, 76px); }
  .hero-description { margin: 0 auto; }
  .feature-row { justify-content: center; margin-top: 32px; }
  .entry-card { width: min(440px, 100%); margin: 0 auto; }
  .lobby-footer { width: calc(100% - 40px); }
  .game-brand { min-width: auto; }
  .game-brand > div { display: none; }
  .resource { min-width: 78px; }
  .resource-icon { display: none; }
  .timer-block { padding-left: 10px; }
  .connection-badge { display: none; }
  .game-layout { grid-template-columns: 1fr; }
  .intel-panel { position: absolute; z-index: 30; top: 76px; right: 0; bottom: 92px; width: 280px; transform: translateX(100%); transition: transform 0.25s; box-shadow: -20px 0 50px rgba(0, 0, 0, 0.35); }
  .intel-panel.open { transform: translateX(0); }
  .mobile-intel-button { position: absolute; right: 20px; bottom: 185px; display: block; padding: 8px 12px; border: 1px solid var(--line); color: #d8e7df; background: rgba(7, 20, 24, 0.8); font-size: 9px; }
  .command-dock { padding: 10px 12px; gap: 12px; }
  .army-summary { min-width: 90px; }
}

@media (max-width: 640px) {
  body { overflow: auto; }
  .lobby-screen, .room-screen { overflow: auto; }
  .brand-crest { width: 39px; height: 39px; }
  .brand-crest svg { width: 28px; height: 28px; }
  .brand strong { font-size: 17px; }
  .online-pill { padding: 8px 10px; font-size: 9px; }
  .lobby-content { width: calc(100% - 32px); padding-top: 20px; }
  .hero-copy h1 { font-size: 48px; }
  .hero-description { font-size: 12px; }
  .feature-row > div { min-width: 0; flex: 1; grid-template-columns: 1fr; text-align: center; padding: 0 8px; }
  .feature-icon { grid-row: auto; margin-bottom: 8px; }
  .feature-row small { font-size: 8px; white-space: normal; }
  .entry-card { padding: 25px 22px; }
  .lobby-footer { position: relative; bottom: auto; left: auto; transform: none; margin: -45px auto 20px; width: calc(100% - 40px); }
  .lobby-footer span:last-child { display: none; }
  .waiting-wrap { margin-top: 2vh; }
  .waiting-card { padding: 28px 18px; }
  .seat-row { grid-template-columns: 1fr 30px 1fr; gap: 5px; }
  .seat { min-height: 145px; }
  .room-code-block { gap: 10px; }
  .room-code-block strong { font-size: 24px; }
  .game-screen { min-height: 100dvh; height: 100dvh; }
  .game-topbar { min-height: 104px; padding: 8px 10px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 30px 48px; gap: 4px 8px; }
  .game-brand { grid-column: 1; grid-row: 1; }
  .game-brand .brand-crest { width: 27px; height: 27px; }
  .game-brand .brand-crest svg { width: 19px; height: 19px; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .resource-bar { grid-column: span 2; grid-row: 2; justify-content: space-between; gap: 2px; }
  .resource { min-width: 0; padding: 3px 6px; }
  .resource small { font-size: 8px; }
  .resource strong { font-size: 15px; }
  .timer-block { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); min-width: 70px; padding: 0; border: 0; }
  .timer-block strong { font-size: 16px; }
  .timer-block small, .timer-block span { display: none; }
  .square-button { width: 27px; height: 27px; }
  .intel-panel { top: 104px; bottom: 84px; }
  .command-dock { min-height: 84px; padding: 9px; gap: 8px; }
  .army-summary { min-width: 55px; }
  .army-summary .army-emblem { display: none; }
  .army-summary strong { font-size: 20px; }
  .command-button { min-width: 58px; height: 58px; padding: 6px; }
  .map-heading { top: 15px; left: 15px; }
  .map-heading strong { font-size: 16px; }
  .map-controls { top: 14px; right: 12px; }
  .minimap-wrap { width: 128px; right: 12px; bottom: 14px; }
  .selection-panel { left: 14px; bottom: 46px; max-width: calc(100% - 165px); padding: 10px 12px; }
  .world-tip { left: 14px; bottom: 17px; gap: 8px; }
  .world-tip span:nth-child(n+3) { display: none; }
  .mobile-intel-button { right: 12px; bottom: 163px; }
  .placement-banner { top: 64px; min-width: 250px; }
  .toast-region { top: 110px; }
  .modal-backdrop { padding: 12px; }
  .modal-card { padding: 28px 20px; }
  .help-grid { grid-template-columns: 1fr; }
  .modal-card h2 { font-size: 28px; }
}

@media (max-height: 700px) and (min-width: 641px) {
  .game-topbar { min-height: 66px; }
  .command-dock { min-height: 80px; padding-top: 8px; padding-bottom: 8px; }
  .command-button { height: 56px; }
  .intel-panel { padding-top: 13px; gap: 8px; }
  .objective-card { display: none; }
  .intel-heading h3 { font-size: 14px; }
  .power-card { padding: 9px 11px; }
  .army-card { padding: 10px; }
  .lobby-header { height: 85px; }
  .lobby-content { padding-top: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
