:root {
  color-scheme: dark;
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  color: #e6eeea;
  background: #101817;
  --surface: #17211f;
  --surface-raised: #1b2825;
  --border: #2b3a36;
  --muted: #91a39c;
  --accent: #c4a878;
  --green: #70c4a0;
  --red: #e58b80;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.auth-view { display: grid; min-height: 100vh; place-content: center; padding: 24px; }
.wordmark { color: #edf2eb; font-size: 15px; font-weight: 750; letter-spacing: .12em; text-decoration: none; }
.wordmark span { margin-left: 6px; color: var(--accent); font-size: 11px; letter-spacing: .18em; }
.auth-view > .wordmark { margin-bottom: 22px; }
.auth-card, .panel, .metric-card { border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.auth-card { width: min(420px, calc(100vw - 32px)); padding: 28px; }
h1, h2, h3, p { margin-top: 0; }
.auth-card h1 { margin-bottom: 8px; font-size: 25px; }
.auth-card form, .settings-form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: #c4d0ca; font-size: 12px; font-weight: 600; }
input { width: 100%; padding: 10px 11px; color: #e7eee9; background: #111a18; border: 1px solid #35443f; border-radius: 5px; outline: none; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button { padding: 9px 13px; color: #17211d; background: var(--accent); border: 1px solid var(--accent); border-radius: 5px; font-weight: 650; }
button:disabled { opacity: .5; cursor: wait; }
.button-secondary { color: #dce5df; background: transparent; border-color: #44554e; }
.button-quiet { padding: 5px 8px; color: #a9bbb3; background: transparent; border-color: transparent; font-size: 12px; }
.auth-actions, .form-actions, .topbar-actions { display: flex; align-items: center; gap: 9px; }
.auth-actions { margin-top: 3px; }
.message { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.eyebrow, .sidebar-caption { margin: 0 0 7px; color: #94a69e; font-size: 12px; font-weight: 700; letter-spacing: .12em; }

.app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 23px 15px 15px; border-right: 1px solid var(--border); background: #131d1b; }
.sidebar .wordmark { padding: 0 10px; }
.sidebar-caption { margin: 37px 10px 9px; font-size: 11px; }
.side-nav { display: grid; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; color: #a9b9b2; text-align: left; background: transparent; border-color: transparent; font-weight: 500; }
.nav-item:hover, .nav-item.active { color: #f0f3ed; background: #25332e; border-color: #303e38; }
.nav-item.active { box-shadow: inset 2px 0 var(--accent); }
.nav-icon { width: 17px; color: var(--accent); text-align: center; font-size: 16px; }
.sidebar-bottom { display: grid; grid-template-columns: 10px 1fr; align-items: center; gap: 7px; margin-top: auto; padding: 12px 9px; color: #a4b5ad; font-size: 11px; border-top: 1px solid var(--border); }
.sidebar-bottom a { grid-column: 2; margin-top: 10px; color: var(--muted); text-decoration: none; }
.connection-dot, .live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px #70c4a055; }
.workspace { width: min(1320px, 100%); margin: 0 auto; padding: 0 34px 40px; }
.topbar { display: flex; min-height: 92px; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; border-bottom: 1px solid var(--border); }
.topbar .eyebrow { margin-bottom: 3px; }
.topbar h1 { margin: 0; font-size: 21px; font-weight: 620; }
.topbar-actions { gap: 13px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.avatar { display: grid; width: 26px; height: 26px; place-items: center; color: #15201b; background: var(--accent); border-radius: 50%; font-weight: 750; }
.section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading { margin-bottom: 14px; }
.section-heading h2, .panel-heading h2 { margin: 0 0 3px; font-size: 16px; font-weight: 620; }
.section-heading .muted, .panel-heading .muted { margin: 0; }
.live-pill, .state-pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px; color: var(--green); background: #1d322b; border: 1px solid #315141; border-radius: 20px; font-size: 11px; font-weight: 750; letter-spacing: .06em; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-width: 0; padding: 14px 15px 9px; }
.metric-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.metric-label span { color: var(--accent); font-size: 13px; }
.metric-value { display: flex; align-items: baseline; gap: 6px; margin-top: 11px; }
.metric-value strong { overflow: hidden; color: #edf2ed; font-size: 25px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.metric-value small { color: var(--muted); font-size: 11px; }
.metric-card canvas { display: block; width: 100%; height: 46px; margin-top: 6px; }
.metric-foot { min-height: 46px; margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.panel { margin-top: 18px; padding: 18px; }
.deployment-card { margin-top: 20px; }
.panel-heading { margin-bottom: 15px; }
.panel-heading .eyebrow { margin-bottom: 4px; }
.deployment-grid { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.5fr); gap: 12px; }
.pm2-card, .console-card { min-width: 0; padding: 13px; background: #111a18; border: 1px solid var(--border); border-radius: 6px; }
.pm2-title, .console-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.pm2-card > strong { display: block; margin: 13px 0; font-size: 15px; }
.pm2-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.pm2-card dl div { display: flex; justify-content: space-between; gap: 7px; padding-top: 7px; border-top: 1px solid #293531; }
.pm2-card dt { color: var(--muted); font-size: 11px; }
.pm2-card dd { margin: 0; color: #e1ebe5; font-size: 11px; }
.pm2-card .state-pill { padding: 2px 6px; font-size: 10px; }
.pm2-card .state-pill.stopped { color: var(--red); border-color: #62403a; background: #362421; }
.pm2-card .message { margin-top: 10px; }
.console-heading { margin-bottom: 8px; }
.console-heading > span { display: inline-flex; align-items: center; gap: 7px; }
.console-heading i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.console-card pre { height: 150px; overflow: auto; margin: 0; padding: 9px; color: #b2c7ba; background: #0c1312; border-radius: 4px; font: 11px/1.55 ui-monospace, "Cascadia Code", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.deploy-log-build { color: #c3adff; }
.deploy-log-progress { color: #82caff; }
.deploy-log-startup { color: #9dc7ff; }
.deploy-log-success { color: #79d6a5; }
.deploy-log-warning { color: #e7c779; }
.deploy-log-failure { color: #f08e86; }
.panel-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 13px; }
.panel-actions .muted { margin: 0; }
.table-panel { padding: 0 16px; }
.worlds-heading { align-items: flex-start; }
.create-world-button { white-space: nowrap; }
.create-world-button:disabled { cursor: not-allowed; }
.create-world-button span { margin-left: 6px; color: var(--muted); font-size: 11px; }
.worlds-table-panel { padding: 14px 16px 12px; }
.game-category-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 0; border-bottom: 1px solid #ffffff20; }
.game-category-tab { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 10px; border: 1px solid #ffffff35; border-radius: 999px; background: #14251e; color: #c8d6ca; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.game-category-tab[data-type="single-player-timebound"] { color: #e9c679; background: #4a391a; }
.game-category-tab[data-type="open-world"] { color: #9bd5ae; background: #183c2b; }
.game-category-tab[data-type="one-vs-one"] { color: #f0a3a0; background: #492623; }
.game-category-tab[data-type="team-play"] { color: #c4b1f1; background: #33284a; }
.game-category-tab[aria-pressed="true"] { box-shadow: 0 0 0 2px currentColor; }
.game-category-tab:focus-visible { outline: 2px solid #f0d496; outline-offset: 3px; }
.game-category-tab-count { min-width: 1.4em; padding: 1px 5px; border-radius: 999px; background: #0004; text-align: center; }
.worlds-toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 0 8px 12px; }
.worlds-toolbar label { min-width: 165px; }
.worlds-toolbar .world-search { flex: 1 1 260px; }
.worlds-toolbar select { width: 100%; padding: 9px 10px; color: #e7eee9; background: #111a18; border: 1px solid #35443f; border-radius: 5px; }
.worlds-toolbar input[type="search"] { padding: 9px 10px; }
.worlds-table-scroll { overflow-x: auto; }
.worlds-table-scroll table { min-width: 1020px; }
.worlds-table-panel #worlds-message { margin: 10px 8px 0; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
td { font-size: 13px; }
.table-sort-button { padding: 0; color: inherit; background: transparent; border: 0; font-size: inherit; font-weight: inherit; letter-spacing: inherit; text-align: left; }
.table-sort-button:hover { color: #f0f3ed; }
.world-status { display: inline-block; padding: 3px 7px; border-radius: 20px; font-size: 11px; white-space: nowrap; }
.world-status.campaign { color: var(--green); background: #1d322b; }
.world-status.scenario { color: #d7bd85; background: #302b20; }
.worlds-table-panel .game-type-badges { display: flex; flex-wrap: wrap; gap: 6px; min-width: 150px; margin: 0; padding: 0; list-style: none; }
.worlds-table-panel .game-type-badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 5px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; font-weight: 650; line-height: 1.35; white-space: nowrap; }
.worlds-table-panel .game-type-icon { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.worlds-table-panel .game-type-badge[data-type="single-player-timebound"] { color: #e9c679; background: #4a391a; }
.worlds-table-panel .game-type-badge[data-type="open-world"] { color: #9bd5ae; background: #183c2b; }
.worlds-table-panel .game-type-badge[data-type="one-vs-one"] { color: #f0a3a0; background: #492623; }
.worlds-table-panel .game-type-badge[data-type="team-play"] { color: #c4b1f1; background: #33284a; }
.world-play-link { display: inline-block; padding: 5px 9px; color: #17211d; background: var(--accent); border-radius: 4px; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.world-play-link:hover { background: #d6bd91; }
tbody tr:last-child td { border-bottom: 0; }
.access-badge { padding: 3px 7px; color: #bda87c; background: #302b20; border-radius: 20px; font-size: 10px; }
.settings-panel { max-width: 720px; margin-top: 13px; }
.settings-panel h3 { margin: 0 0 8px; font-size: 14px; }
.settings-panel .eyebrow { margin-bottom: 9px; }
.setting-value { display: inline-block; margin: 0 0 7px; padding: 5px 9px; background: #111a18; border-radius: 4px; font-size: 13px; }
.settings-form { max-width: 460px; margin-top: 17px; }
.settings-form .muted { margin: 0; }
.auto-sync-toggle, .auto-sync-confirm-label { display: flex; align-items: flex-start; gap: 9px; margin: 14px 0; font-size: 13px; }
.auto-sync-toggle input, .auto-sync-confirm-label input { flex: 0 0 auto; width: auto; margin: 2px 0 0; padding: 0; accent-color: var(--accent); }
.auto-sync-warning { padding: 10px 12px; color: #e7c779; background: #302b20; border-left: 3px solid var(--accent); }
.auto-sync-error { color: var(--red); }
.github-setup { max-width: 460px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.github-setup h3 { margin-bottom: 7px; font-size: 15px; }
.github-setup textarea { display: block; width: 100%; margin-top: 10px; padding: 9px; color: #b2c7ba; background: #0c1312; border: 1px solid var(--border); border-radius: 4px; font: 11px/1.5 ui-monospace, "Cascadia Code", monospace; overflow-wrap: anywhere; }
.github-setup a { color: #9dc7ff; }
.form-actions { flex-wrap: wrap; margin-top: 2px; }
.form-actions .message { min-width: 100px; }
.setup-dialog { width: min(500px, calc(100vw - 28px)); max-height: 90vh; padding: 24px; color: #e6eeea; background: #17211f; border: 1px solid #465950; border-radius: 9px; }
.setup-dialog::backdrop { background: #050a09c9; }
.setup-dialog h2 { margin-bottom: 7px; font-size: 20px; }
.setup-dialog form { display: grid; gap: 13px; }
.setup-dialog .eyebrow, .setup-dialog p { margin-bottom: 0; }
.setup-dialog .form-actions { justify-content: flex-start; }

@media (max-width: 940px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .deployment-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; z-index: 2; height: auto; padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .wordmark, .sidebar-caption, .sidebar-bottom { display: none; }
  .side-nav { grid-template-columns: repeat(4, 1fr); }
  .nav-item { justify-content: center; gap: 6px; padding: 8px 4px; font-size: 12px; }
  .workspace { padding: 0 15px 25px; }
  .topbar { min-height: 72px; margin-bottom: 20px; }
  .topbar-actions { gap: 5px; }
  .user-chip { font-size: 12px; }
  .metric-grid { gap: 8px; }
  .metric-card { padding: 11px; }
  .metric-value strong { font-size: 21px; }
  .panel { padding: 13px; }
  .panel-actions { align-items: flex-start; flex-direction: column; }
  .worlds-heading { align-items: flex-start; flex-direction: column; }
  .worlds-toolbar { align-items: stretch; flex-direction: column; }
  .worlds-toolbar label, .worlds-toolbar .world-search { flex: auto; }
}
