:root {
  color-scheme: light;
  --page: #edf5ef;
  --paper: #fffdf5;
  --paper-2: #f8f3e3;
  --ink: #203127;
  --muted: #68776f;
  --line: #d9cda9;
  --green: #2f7d4a;
  --green-dark: #1f5d36;
  --gold: #d39b28;
  --brown: #5a3b1c;
  --red: #b94f3b;
  --blue: #356f84;
  --shadow: 0 18px 44px rgba(31, 54, 39, .12);
}

* { box-sizing: border-box; }
html, body { min-width: 1180px; min-height: 100%; margin: 0; }
body {
  color: var(--ink);
  background: linear-gradient(140deg, #dceee2 0%, #edf6ef 42%, #f6f1df 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }

.admin-page { min-height: 100vh; }
.login-view {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 100%;
  min-height: 100vh;
  padding: 64px 7vw;
}
.login-brand, .side-brand { display: inline-flex; align-items: center; gap: 14px; }
.login-brand { width: max-content; }
.login-brand strong, .login-brand em, .side-brand strong, .side-brand em { display: block; }
.login-brand strong { font-size: 27px; font-weight: 950; }
.login-brand em { margin-top: 4px; color: var(--muted); font-size: 15px; font-style: normal; font-weight: 800; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 3px solid #6c4a1e;
  border-radius: 12px;
  color: #fff8d8;
  background: linear-gradient(135deg, var(--gold), #68a65b);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.35);
  font-size: 27px;
  font-weight: 950;
}
.brand-mark.small { width: 44px; height: 44px; border-width: 2px; font-size: 19px; }
.login-card {
  align-self: center;
  width: 620px;
  margin: 30px auto 90px;
  padding: 48px 54px;
  border: 2px solid rgba(90,59,28,.22);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.eyebrow { margin-bottom: 7px; color: var(--green-dark); font-size: 13px; font-weight: 950; letter-spacing: .04em; }
.login-card h1 { font-size: 38px; line-height: 1.15; }
.login-copy { margin-top: 14px; color: #52635a; font-size: 17px; font-weight: 750; line-height: 1.7; }
.login-form { display: grid; gap: 20px; margin-top: 30px; }
.login-form label, .edit-form label { display: grid; gap: 9px; font-size: 14px; font-weight: 900; }
input, select, textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fffaf0;
  outline: none;
}
input, select { min-height: 48px; padding: 0 14px; }
textarea { min-height: 86px; padding: 12px 14px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(47,125,74,.13); }
.login-form input { min-height: 62px; font-size: 18px; font-weight: 800; }
.primary-button, .soft-button, .primary-small, .text-button, .back-button, .icon-button {
  border-radius: 10px;
  cursor: pointer;
  font-weight: 900;
}
.primary-button {
  min-height: 62px;
  border: 2px solid #6c4a1e;
  color: #fff8dc;
  background: linear-gradient(180deg, #3f8a56, var(--green-dark));
  font-size: 18px;
}
.primary-button:disabled, .primary-small:disabled, .soft-button:disabled { cursor: wait; opacity: .55; }
.form-message {
  min-height: 52px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 2px solid #e0d2ad;
  border-radius: 10px;
  color: var(--muted);
  background: #fffaf0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}
.form-message.error { border-color: rgba(185,79,59,.45); color: var(--red); background: #fff1ec; }
.back-link { display: block; width: max-content; margin: 18px auto 0; color: var(--green-dark); font-weight: 900; }

.console-view { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: 100vh; background: #eef4ef; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 20px 22px;
  color: #f8f0d5;
  background: linear-gradient(180deg, #183f2a 0%, #112d20 62%, #0d2218 100%);
  box-shadow: 10px 0 28px rgba(22,52,35,.12);
}
.side-brand { padding: 0 8px 28px; }
.side-brand strong { font-size: 19px; }
.side-brand em { margin-top: 3px; color: #a9c6b0; font-size: 12px; font-style: normal; font-weight: 800; }
.side-nav { display: grid; gap: 10px; }
.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #cfe1d3;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-weight: 900;
}
.nav-button span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #3c2b16; background: #f7d77b; }
.nav-button:hover, .nav-button.active { border-color: rgba(247,215,123,.35); color: #fff9df; background: rgba(255,255,255,.1); }
.sidebar-foot { display: grid; gap: 5px; margin-top: auto; padding: 18px 12px 0; border-top: 1px solid rgba(255,255,255,.14); }
.sidebar-foot span { color: #9eb9a5; font-size: 12px; }
.text-button { width: max-content; margin-top: 8px; padding: 0; border: 0; color: #f7d77b; background: none; }

.workspace { min-width: 0; padding: 30px 36px 60px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.workspace-header h1 { font-size: 31px; }
.header-actions { display: flex; gap: 10px; }
.soft-button, .back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #c9bea0;
  color: #38473e;
  background: #fffdf5;
}
.soft-button:hover, .back-button:hover { border-color: var(--green); color: var(--green-dark); }
.status-bar { margin: 20px 0; padding: 12px 15px; border-left: 4px solid var(--green); border-radius: 6px; color: #4e6256; background: rgba(255,255,255,.68); font-size: 13px; font-weight: 800; }
.status-bar.error { border-left-color: var(--red); color: var(--red); }
.workspace-page { min-width: 0; }
.section-intro { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 8px 0 20px; }
.section-intro h2 { font-size: 25px; }
.section-intro p { max-width: 760px; margin-top: 7px; color: var(--muted); line-height: 1.6; }

.admin-game-grid, .deploy-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.admin-game-card, .deploy-card, .panel-card, .metric-card {
  border: 1px solid rgba(87,75,46,.2);
  border-radius: 15px;
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(31,54,39,.07);
}
.admin-game-card { display: grid; grid-template-columns: 70px minmax(0,1fr); gap: 18px; padding: 24px; }
.admin-game-icon, .game-heading-icon {
  display: grid;
  place-items: center;
  border: 2px solid #8a642d;
  border-radius: 14px;
  color: #4a3317;
  background: linear-gradient(135deg, #f7d77b, #87bd7b);
  font-size: 27px;
  font-weight: 950;
}
.admin-game-icon { width: 70px; height: 70px; }
.admin-game-body h3 { font-size: 21px; }
.admin-game-body p { min-height: 44px; margin-top: 7px; color: var(--muted); line-height: 1.55; }
.card-status-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; }
.card-actions { display: flex; align-items: center; gap: 10px; }
.primary-small {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid #215c38;
  color: #fff9df;
  background: var(--green-dark);
}
.status-pill { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; color: #235839; background: #dff0e3; font-size: 12px; font-weight: 900; }
.status-pill.off { color: #8a4034; background: #f8ddd7; }
.switch-control { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; font-weight: 850; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 44px; height: 24px; border-radius: 999px; background: #bdc8c0; transition: .2s; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s; }
.switch-control input:checked + .switch-track { background: var(--green); }
.switch-control input:checked + .switch-track::after { transform: translateX(20px); }

.back-button { margin-bottom: 18px; }
.game-heading { display: flex; align-items: center; gap: 14px; }
.game-heading-icon { width: 58px; height: 58px; }
.game-heading p { color: var(--green-dark); font-size: 12px; font-weight: 950; }
.game-heading h2 { margin-top: 2px; font-size: 26px; }
.content-tabs { display: flex; gap: 8px; margin: 24px 0 18px; padding-bottom: 10px; border-bottom: 1px solid #d6d9d3; }
.content-tabs button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 900; }
.content-tabs button.active { color: #fff9df; background: var(--green-dark); }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; margin-bottom: 18px; }
.metric-card { padding: 20px; }
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 850; }
.metric-card strong { display: block; margin-top: 9px; font-size: 28px; }
.panel-card { overflow: hidden; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid #e0dccd; }
.panel-heading h3 { font-size: 19px; }
.panel-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.player-toolbar { align-items: end; }
.search-form { display: flex; gap: 8px; width: 420px; }
.search-form input { min-width: 0; min-height: 40px; flex: 1 1 auto; }
.search-form .primary-small { flex: 0 0 auto; min-width: 82px; white-space: nowrap; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 14px; border-bottom: 1px solid #ece7d9; text-align: left; white-space: nowrap; }
th { color: #53625a; background: #f7f3e7; font-size: 12px; font-weight: 950; }
tbody tr:hover { background: #f8fbf8; }
tbody tr:last-child td { border-bottom: 0; }
.table-link { padding: 0; border: 0; color: var(--green-dark); background: none; cursor: pointer; font-weight: 900; }
.empty-cell { padding: 36px; color: var(--muted); text-align: center; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 16px; padding: 15px 20px; border-top: 1px solid #ece7d9; color: var(--muted); font-size: 13px; font-weight: 850; }
.page-size-control { display: inline-flex; align-items: center; gap: 8px; margin-right: auto; white-space: nowrap; }
.page-size-control select { width: auto; min-width: 92px; min-height: 40px; padding: 0 34px 0 12px; border-width: 1px; background-color: #fffdf5; }

.security-note { margin-bottom: 18px; padding: 16px 18px; border: 1px solid #d6c491; border-radius: 12px; color: #5c4c29; background: #fff8da; font-weight: 800; line-height: 1.6; }
.security-note.disabled { border-color: #deb7ad; color: #813e34; background: #fff0ec; }
.deploy-card { padding: 22px; }
.deploy-card h3 { font-size: 20px; }
.deploy-card p { min-height: 42px; margin: 8px 0 18px; color: var(--muted); line-height: 1.55; }
.deploy-actions { display: flex; gap: 10px; }
.deploy-log-card { margin-top: 20px; }
.job-list { display: grid; gap: 1px; max-height: 260px; overflow-y: auto; background: #ece7d9; }
.job-item { display: grid; grid-template-columns: 150px 100px 110px 1fr 100px; gap: 10px; padding: 12px 18px; border: 0; background: #fffdf5; cursor: pointer; text-align: left; font-size: 13px; }
.job-item:hover { background: #f7fbf7; }
.job-output { min-height: 220px; max-height: 420px; margin: 0; padding: 18px; overflow: auto; color: #d6f2dc; background: #10251a; font: 12px/1.65 Consolas, "Courier New", monospace; white-space: pre-wrap; }

.detail-drawer { position: fixed; inset: 0; z-index: 40; display: grid; grid-template-columns: 1fr min(720px, 58vw); }
.drawer-backdrop { background: rgba(10,28,18,.48); backdrop-filter: blur(2px); }
.drawer-panel { height: 100vh; overflow-y: auto; background: #f3f6f1; box-shadow: -14px 0 40px rgba(8,30,18,.2); }
.drawer-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 22px 26px; border-bottom: 1px solid #d9ddd8; background: rgba(255,253,245,.96); backdrop-filter: blur(10px); }
.drawer-header h2 { font-size: 24px; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #cbc1a5; background: #fff; font-size: 25px; }
.drawer-content { display: grid; gap: 18px; padding: 24px 26px 50px; }
.detail-section { overflow: hidden; border: 1px solid #dcd7c8; border-radius: 13px; background: var(--paper); }
.detail-section h3 { padding: 15px 18px; border-bottom: 1px solid #e4dfd1; font-size: 17px; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 18px; }
.detail-item { min-width: 0; padding: 12px; border-radius: 9px; background: #f5f2e6; }
.detail-item span { display: block; color: var(--muted); font-size: 11px; font-weight: 850; }
.detail-item strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 14px; }
.edit-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 18px; }
.edit-form .full { grid-column: 1 / -1; }
.edit-actions { display: flex; justify-content: flex-end; grid-column: 1 / -1; padding-top: 4px; }
.json-block { max-height: 260px; margin: 0; padding: 15px 18px; overflow: auto; color: #d6f2dc; background: #10251a; font: 12px/1.6 Consolas, monospace; white-space: pre-wrap; }

.toast { position: fixed; right: 28px; bottom: 28px; z-index: 60; max-width: 420px; padding: 14px 18px; border: 1px solid #a9c8b1; border-radius: 11px; color: #fff; background: #225c38; box-shadow: var(--shadow); font-weight: 850; }
.toast.error { border-color: #e3a89b; background: #9f4435; }

@media (max-width: 1280px) {
  .workspace { padding-right: 24px; padding-left: 24px; }
  .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
