* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #6b7385;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --line: #e4e7f0;
  --danger: #dc2626;
  --ok: #16a34a;
}
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }

/* 顶部导航 */
.nav {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.nav-inner {
  max-width: 1080px; margin: 0 auto; padding: 0 16px; height: 56px;
  display: flex; align-items: center; gap: 14px;
}
.logo { font-size: 19px; font-weight: 800; color: var(--ink); white-space: nowrap; flex-shrink: 0; }
.logo span { color: var(--brand); }
.nav-links {
  display: flex; gap: 14px; font-size: 14px; flex: 1;
  white-space: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--muted); flex-shrink: 0; }
.nav-links a.active, .nav-links a:hover { color: var(--brand); }
.nav-user {
  font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 8px;
  white-space: nowrap; flex-shrink: 0;
}
@media (max-width: 480px) {
  .nav-user .nick { display: none; }
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 60px; }
.wrap.narrow { max-width: 720px; }

h2.page-title { font-size: 22px; margin-bottom: 18px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; font-size: 15px; font-weight: 600;
  padding: 10px 22px; border-radius: 10px; color: #fff;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: opacity .15s, transform .1s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn.plain { background: #eef0f7; color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }

/* 卡片与表单 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%; padding: 10px 12px; font-size: 15px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--ink); font-family: inherit;
}
textarea { resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid #c7d2fe; border-color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.error-text { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }

.tag { display: inline-block; background: #eef0f7; color: var(--muted); font-size: 12px; padding: 2px 8px; border-radius: 6px; margin-right: 4px; }

/* 小红书式瀑布流 */
.masonry { display: flex; align-items: flex-start; gap: 10px; }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.xhs-card {
  display: block; background: #fff; border-radius: 12px; overflow: hidden; color: inherit;
  box-shadow: 0 1px 3px rgba(29,36,51,.06); transition: box-shadow .15s, transform .12s;
}
.xhs-card:hover { box-shadow: 0 8px 22px rgba(29,36,51,.12); transform: translateY(-2px); }
.xhs-cover { display: block; width: 100%; height: auto; }
.xhs-body { padding: 8px 10px 10px; }
.xhs-title {
  font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.xhs-type { margin-top: 5px; font-size: 11px; color: var(--muted); }
.xhs-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.xhs-author { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12px; color: var(--muted); }
.xhs-author .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xhs-avatar {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 600;
}
.xhs-like { display: flex; align-items: center; gap: 3px; flex-shrink: 0; font-size: 12px; color: var(--muted); }
.xhs-like svg { display: block; }

/* 工具条 */
.toolbar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.toolbar input[type=text] { max-width: 260px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 8px 16px; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--brand); color: #fff; }

.creator-mode {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: 8px; background: #eef0f7;
}
.creator-mode button {
  min-height: 42px; border: none; border-radius: 6px; background: transparent; color: var(--muted);
  cursor: pointer; font: inherit; font-size: 14px; font-weight: 700;
}
.creator-mode button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(29,36,51,.1); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading.compact { margin-bottom: 16px; }
.section-heading h3 { font-size: 17px; margin-bottom: 5px; }
.section-heading p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.type-badge { flex-shrink: 0; border-radius: 6px; padding: 4px 8px; font-size: 12px; font-weight: 700; }
.type-badge.standalone { background: #dcfce7; color: #166534; }
.type-badge.template { background: #e0e7ff; color: #3730a3; }
.package-spec-link { margin: -5px 0 14px; font-size: 13px; }
input[type=file] { width: 100%; color: var(--muted); font: inherit; font-size: 14px; }
input[type=file]::file-selector-button {
  margin-right: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px;
  background: #fff; color: var(--ink); cursor: pointer; font: inherit; font-weight: 600;
}
.cover-picker { display: flex; align-items: center; gap: 16px; }
.cover-preview {
  width: 104px; aspect-ratio: 679 / 960; flex: 0 0 104px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed #4a504c; border-radius: 7px; background: #161817; color: var(--muted);
  font-size: 13px; font-weight: 700;
}
.cover-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-picker-actions { min-width: 0; flex: 1; }
.cover-picker-actions .btn { margin-top: 10px; }
.my-game-cover {
  width: 52px; aspect-ratio: 679 / 960; flex: 0 0 52px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 6px; background: #161817; font-size: 25px;
}
.my-game-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }

body.cover-crop-open { overflow: hidden; }
.cover-crop-dialog { position: fixed; inset: 0; z-index: 1200; display: grid; place-items: center; padding: 18px; }
.cover-crop-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.72); }
.cover-crop-panel {
  position: relative; width: min(440px, 100%); max-height: calc(100vh - 36px); overflow: auto;
  padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.42);
}
.cover-crop-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cover-crop-header h2 { margin: 0; font-size: 20px; }
.cover-crop-close {
  width: 36px; height: 36px; padding: 0; border: 0; background: transparent; color: var(--ink);
  font: 28px/1 sans-serif; cursor: pointer;
}
.cover-crop-stage { min-height: 260px; display: grid; place-items: center; overflow: hidden; background: #0f1110; }
.cover-crop-stage canvas { display: block; max-width: 100%; max-height: 48vh; cursor: grab; touch-action: none; }
.cover-crop-stage canvas:active { cursor: grabbing; }
.cover-ratio-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.cover-ratio-options button {
  min-width: 0; padding: 8px 4px; border: 1px solid var(--line); border-radius: 6px;
  background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
}
.cover-ratio-options button.active { border-color: var(--brand); background: var(--brand); color: #fff; }
.cover-ratio-options button:disabled { opacity: 0.35; cursor: not-allowed; }
.cover-zoom { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.cover-zoom input { width: 100%; accent-color: var(--brand); }
.cover-crop-error { min-height: 18px; margin: 8px 0 0; color: #c62828; font-size: 13px; }
.cover-crop-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* 创建器步骤 */
.steps { display: flex; gap: 8px; margin-bottom: 20px; font-size: 13px; flex-wrap: wrap; }
.step { padding: 6px 14px; border-radius: 999px; background: #eef0f7; color: var(--muted); }
.step.active { background: var(--brand); color: #fff; }
.step.done { background: #dcfce7; color: var(--ok); }

.tpl-option {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 2px solid var(--line);
  border-radius: 12px; cursor: pointer; margin-bottom: 10px; background: #fff; transition: border-color .15s;
}
.tpl-option:hover { border-color: #c7d2fe; }
.tpl-option.selected { border-color: var(--brand); background: #f5f6ff; }
.tpl-option .tpl-icon { font-size: 26px; }
.tpl-option .tpl-name { font-weight: 700; font-size: 15px; }
.tpl-option .tpl-desc { font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.5; }
.recommend-badge { display: inline-block; background: #fef3c7; color: #b45309; font-size: 12px; padding: 2px 8px; border-radius: 6px; margin-left: 8px; }

/* 知识点编辑器 */
.k-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: #fff; }
.k-item .k-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.k-item .k-index { font-size: 13px; font-weight: 700; color: var(--muted); }
.k-item input, .k-item textarea { margin-bottom: 8px; font-size: 14px; padding: 8px 10px; }
.k-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.k-row input { margin-bottom: 0; }
.k-row .radio { flex-shrink: 0; }

/* 预览 iframe */
.preview-frame {
  width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 14px;
  background: #111; display: block;
}
@media (max-width: 640px) { .preview-frame { height: 480px; } }

/* 播放页为独立全屏布局，样式内联于 play.html */

/* 表格（管理后台） */
table.admin { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 12px; overflow: hidden; }
table.admin th, table.admin td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.admin th { background: #f8f9fd; color: var(--muted); font-weight: 600; }
table.admin .metric-number, table.admin .metric-duration { white-space: nowrap; font-variant-numeric: tabular-nums; }
table.admin .metric-number { text-align: right; }
.stats-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 22px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-align: center; }
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--brand); }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card .note { min-height: 34px; margin-top: 9px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.analytics-summary { margin-bottom: 26px; }
.analytics-filter {
  display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card);
}
.date-presets { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; }
.date-presets button {
  min-height: 32px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; font-weight: 700;
}
.date-presets button:hover { color: var(--ink); }
.date-presets button.active { background: var(--brand); color: #07120d; }
.date-range-fields { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.date-range-fields label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.date-range-fields > span { align-self: center; margin-top: 16px; color: var(--muted); font-size: 12px; }
.date-range-fields input[type=date] {
  width: 142px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px;
  background: #121413; color: var(--ink); color-scheme: dark; font: inherit; font-size: 12px;
}
.date-range-fields .btn { min-height: 34px; }
.core-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card.core { min-width: 0; padding: 20px 16px; text-align: left; }
.stat-card.core .num { overflow-wrap: anywhere; font-size: 30px; line-height: 1.15; }
.stat-card.core .label { color: var(--ink); font-size: 13px; font-weight: 700; }
.h5-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card.source-stat { min-width: 0; padding: 17px 16px; text-align: left; }
.stat-card.source-stat .num { font-size: 27px; line-height: 1.15; }
.stat-card.source-stat .label { color: var(--ink); font-size: 13px; font-weight: 700; }
.metric-link {
  min-width: 28px; padding: 2px 5px; border: 0; border-bottom: 1px solid currentColor;
  background: transparent; color: var(--brand); cursor: pointer; font: inherit; font-weight: 800;
}
.metric-link:hover { color: #6ef0ae; }
.metric-link:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.metric-zero { display: inline-block; min-width: 28px; padding: 2px 5px; color: var(--muted); }

.visitor-dialog {
  width: min(1040px, calc(100vw - 32px)); max-height: min(760px, calc(100dvh - 32px)); margin: auto; padding: 0;
  border: 1px solid #3b413d; border-radius: 8px; background: var(--card); color: var(--ink); box-shadow: 0 24px 90px rgba(0,0,0,.58);
}
.visitor-dialog::backdrop { background: rgba(0,0,0,.74); }
.visitor-dialog-head, .visitor-dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; }
.visitor-dialog-head { border-bottom: 1px solid var(--line); }
.visitor-dialog-head h3 { margin: 0 0 4px; font-size: 17px; }
.visitor-dialog-head p, .visitor-dialog-foot { color: var(--muted); font-size: 12px; }
.dialog-close {
  width: 34px; height: 34px; flex: 0 0 34px; padding: 0; border: 1px solid var(--line); border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer; font: 24px/1 system-ui, sans-serif;
}
.dialog-close:hover { border-color: var(--brand); color: var(--brand); }
.visitor-table-wrap { max-height: calc(100dvh - 190px); overflow: auto; }
.visitor-table { border-radius: 0 !important; }
.visitor-table th { position: sticky; top: 0; z-index: 1; }
.visitor-table td { vertical-align: top; line-height: 1.5; }
.visitor-table small { display: block; max-width: 260px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.visitor-ip code { color: var(--ink); font-size: 12px; }
.visitor-time { min-width: 178px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.visitor-device { min-width: 170px; max-width: 280px; }
.visitor-value { min-width: 105px; }
.detail-muted { color: var(--muted); }
.visitor-empty { padding: 54px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.visitor-dialog-foot { min-height: 62px; border-top: 1px solid var(--line); }

.rename-game-dialog {
  width: min(480px, calc(100vw - 32px)); margin: auto; padding: 0;
  border: 1px solid #3b413d; border-radius: 8px; background: var(--card); color: var(--ink); box-shadow: 0 24px 90px rgba(0,0,0,.58);
}
.rename-game-dialog::backdrop { background: rgba(0,0,0,.74); }
.rename-game-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px; border-bottom: 1px solid var(--line); }
.rename-game-dialog-head h3 { margin: 0 0 5px; font-size: 18px; }
.rename-game-dialog-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.rename-game-dialog-body { display: grid; gap: 8px; padding: 20px 18px; }
.rename-game-dialog-body label { color: var(--muted); font-size: 13px; font-weight: 650; }
.rename-game-dialog-body input { width: 100%; min-height: 44px; padding: 10px 12px; }
.rename-game-dialog-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.rename-game-dialog-meta span:first-child { max-width: 350px; }
.rename-game-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px 18px; border-top: 1px solid var(--line); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #1d2433; color: #fff; font-size: 14px; padding: 10px 20px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 99;
}
.toast.show { opacity: 1; }
.status-pill { font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.status-draft { background: #fef3c7; color: #b45309; }
.status-published { background: #dcfce7; color: var(--ok); }
.status-removed { background: #fee2e2; color: var(--danger); }
.visibility-pill { font-size: 12px; padding: 2px 9px; border-radius: 6px; }
.visibility-public { background: #dcfce7; color: #166534; }
.visibility-private { background: #eef0f7; color: #5d6575; }
.visibility-control {
  min-height: 32px; display: inline-flex; align-items: center; gap: 7px; padding: 0 4px;
  color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap;
}
.visibility-switch {
  position: relative; width: 42px; height: 24px; flex: 0 0 42px; padding: 0;
  border: 1px solid #8b9290; border-radius: 12px; background: #747a77; cursor: pointer;
  transition: background .16s, border-color .16s;
}
.visibility-switch-thumb {
  position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .16s;
}
.visibility-switch.is-public { border-color: var(--ok); background: var(--ok); }
.visibility-switch.is-public .visibility-switch-thumb { transform: translateX(18px); }
.visibility-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.visibility-switch:disabled { cursor: wait; opacity: .55; }

/* 首页 AI 输入框 */
.ai-hero { padding: 10px 0 30px; text-align: center; }
.ai-hero h1 { font-size: 26px; margin-bottom: 18px; line-height: 1.35; }
.ai-box {
  position: relative; max-width: 720px; margin: 0 auto; text-align: left;
  background: #fff; border: 1px solid var(--line); border-radius: 20px;
  box-shadow: 0 10px 30px rgba(29,36,51,.07); padding: 18px 18px 62px;
  transition: box-shadow .15s, border-color .15s;
}
.ai-box:focus-within { border-color: var(--brand); box-shadow: 0 12px 34px rgba(79,70,229,.15); }
.ai-box textarea {
  width: 100%; border: none; outline: none; resize: none; background: transparent;
  font-family: inherit; font-size: 16px; line-height: 1.65; color: var(--ink); min-height: 92px;
}
.ai-send {
  position: absolute; right: 14px; bottom: 14px;
  display: inline-flex; align-items: center; gap: 7px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 700; color: #fff; padding: 10px 20px; border-radius: 12px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); box-shadow: 0 4px 12px rgba(79,70,229,.3);
  transition: opacity .15s, transform .1s;
}
.ai-send:hover { opacity: .93; }
.ai-send:active { transform: scale(.97); }
.ai-send:disabled { opacity: .5; cursor: not-allowed; }
.ai-hint2 { max-width: 720px; margin: 12px auto 0; padding-left: 6px; font-size: 12.5px; color: var(--muted); text-align: left; }

/* 加载转圈 */
.spinner {
  width: 40px; height: 40px; margin: 0 auto; border-radius: 50%;
  border: 4px solid #e4e7f0; border-top-color: var(--brand); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.autopilot-mask {
  position: fixed; inset: 0; z-index: 60; display: none;
  align-items: center; justify-content: center; background: rgba(244,246,251,.92);
}

/* 2026 dark arcade refresh */
:root {
  color-scheme: dark;
  --bg: #0a0b0b;
  --card: #151716;
  --ink: #f4f6f5;
  --muted: #969c98;
  --brand: #18e58d;
  --brand-2: #0fcf7c;
  --line: #2a2e2c;
  --danger: #ff6268;
  --ok: #18e58d;
  --accent: #ffc45c;
}
html { background: var(--bg); }
body { background: var(--bg); color: var(--ink); letter-spacing: 0; }
body.game-overlay-open { overflow: hidden; }
a { color: var(--brand); }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.nav { background: rgba(10,11,11,.96); border-bottom-color: #202321; z-index: 40; }
.nav-inner { max-width: 1600px; height: 58px; padding: 0 20px; gap: 26px; }
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 18px; }
.logo > span { color: inherit; }
.logo-name b { color: var(--ink); }
.logo-mark {
  position: relative; width: 30px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px 8px 11px 11px; background: #f4f6f5; color: #0a0b0b !important;
  font-size: 14px; line-height: 1; font-weight: 900; font-style: normal;
}
.logo-mark::before, .logo-mark::after {
  content: ""; position: absolute; bottom: -3px; width: 8px; height: 7px; background: #f4f6f5;
}
.logo-mark::before { left: 2px; transform: rotate(24deg); }
.logo-mark::after { right: 2px; transform: rotate(-24deg); }
.logo-mark i {
  position: absolute; right: 3px; top: 2px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--brand); border: 2px solid #0a0b0b;
}
.nav-links { gap: 22px; }
.nav-links a { color: #a1a6a2; line-height: 58px; border-bottom: 2px solid transparent; }
.nav-links a.active, .nav-links a:hover { color: #fff; border-bottom-color: var(--brand); }
.nav-user a { color: #d7dad8; }
.nav-avatar {
  width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; margin-right: 7px; background: #6d3db6; color: #fff; font-weight: 800;
}
.theme-toggle {
  width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #343936; border-radius: 50%; background: #171918; color: #f6c85f;
  font: 700 18px/1 inherit; cursor: pointer;
}
.theme-toggle:hover { border-color: #626864; background: #222523; }

.wrap { max-width: 1160px; padding-top: 30px; }
.wrap.plaza-wrap { max-width: 1600px; padding: 0 26px 70px; }
h2.page-title { font-size: 24px; }
.btn { background: var(--brand); color: #07120d; border-radius: 7px; box-shadow: none; }
.btn:hover { opacity: 1; background: #3aeea3; }
.btn.ghost { background: transparent; color: var(--ink); border-color: #444946; }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); background: transparent; }
.btn.plain { background: #242725; color: #e5e8e6; }
.btn.danger { background: var(--danger); color: #190405; }
.btn.sm { border-radius: 6px; }
.card { background: var(--card); border-color: var(--line); border-radius: 8px; }
input[type=text], input[type=email], input[type=password], textarea, select {
  background: #121413; border-color: #343936; color: var(--ink); border-radius: 7px;
}
input::placeholder, textarea::placeholder { color: #696f6b; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(24,229,141,.25); border-color: var(--brand); }
.tag, .step { background: #242725; }
.step.active { color: #07120d; }
.step.done { background: #143725; }
.creator-mode { background: #111312; border-color: var(--line); }
.creator-mode button.active { background: #2a2e2c; color: var(--ink); box-shadow: none; }
.type-badge.standalone { background: #133e28; color: #6ef0ae; }
.type-badge.template { background: #3a3217; color: #ffd776; }
input[type=file]::file-selector-button { background: #242725; color: var(--ink); border-color: #444946; }
.tpl-option, .k-item { background: #131514; border-color: var(--line); border-radius: 8px; }
.tpl-option:hover, .tpl-option.selected { border-color: var(--brand); background: #11251b; }
.preview-frame { border-radius: 8px; border-color: var(--line); }
table.admin { background: var(--card); border-radius: 8px; }
table.admin th { background: #1c1f1d; }
.stat-card { background: var(--card); border-color: var(--line); border-radius: 8px; }
.status-draft { background: #3a3217; color: #ffd776; }
.status-published { background: #133e28; color: #6ef0ae; }
.status-removed { background: #411f22; color: #ff9a9e; }
.visibility-public { background: #133e28; color: #6ef0ae; }
.visibility-private { background: #2a2d2b; color: #b4bab6; }
.pin-pill { font-size: 12px; padding: 2px 9px; border-radius: 6px; background: #3a3217; color: #ffd776; }
.my-game-card.is-pinned { border-color: rgba(255, 215, 118, .48); }
.visibility-switch { border-color: #555b57; background: #3a3f3c; }
.visibility-switch.is-public { border-color: var(--brand); background: var(--brand); }
.toast { background: #f3f5f4; color: #111312; border-radius: 7px; z-index: 120; }
.autopilot-mask { background: rgba(10,11,11,.94); }

/* Plaza */
.plaza-page .nav { position: sticky; }
.ai-hero { min-height: 390px; padding: 76px 0 44px; display: flex; flex-direction: column; align-items: center; }
.hero-brand-mark { display: none; }
.ai-hero h1 { max-width: 1100px; margin: 0 0 30px; font-size: 48px; line-height: 1.18; font-weight: 850; }
.ai-hero h1 span { color: var(--brand); }
.ai-box {
  width: min(760px, 100%); min-height: 126px; margin: 0; padding: 18px 64px 18px 20px;
  background: #191b1a; border: 1px solid #565c58; border-radius: 8px; box-shadow: none;
}
.ai-box:focus-within { border-color: #8a918c; box-shadow: 0 0 0 1px #8a918c; }
.ai-box textarea { min-height: 88px; padding: 0; font-size: 16px; color: var(--ink); }
.ai-actions { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.icon-btn {
  width: 34px; height: 34px; padding: 0; border: 1px solid #555b57; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center; background: #222523; color: #d8dcda;
  font: 700 22px/1 inherit; cursor: pointer;
}
.icon-btn:hover { border-color: #7b827e; background: #2b2e2c; color: #fff; }
.ai-send { position: static; box-shadow: none; font-size: 21px; }
.ai-upload { font-size: 24px; }
.prompt-chips { margin-top: 12px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.prompt-chips button {
  min-height: 34px; padding: 0 15px; border: 1px solid transparent; border-radius: 6px;
  background: #202321; color: #a8ada9; font: 600 12px/1 inherit; cursor: pointer;
}
.prompt-chips button:hover { color: #fff; border-color: #444946; }
.feed-bar {
  min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-bottom: 1px solid #202321; position: sticky; top: 58px; z-index: 18; background: rgba(10,11,11,.96);
}
.feed-tabs { align-self: stretch; display: flex; gap: 32px; overflow-x: auto; scrollbar-width: none; }
.feed-tabs::-webkit-scrollbar { display: none; }
.feed-tabs button {
  position: relative; flex: 0 0 auto; border: none; background: transparent; color: #989e9a;
  padding: 0 2px; font: 650 14px/1 inherit; cursor: pointer;
}
.feed-tabs button::after { content: ""; position: absolute; height: 2px; left: 0; right: 0; bottom: 0; background: transparent; }
.feed-tabs button.active, .feed-tabs button:hover { color: #fff; }
.feed-tabs button.active::after { background: var(--brand); }
.feed-tools { display: flex; align-items: center; gap: 8px; }
.feed-tools select { width: 122px; padding: 7px 9px; font-size: 12px; background: #151716; }
.feed-search {
  width: 190px; height: 34px; padding: 0 9px; display: flex; align-items: center; gap: 6px;
  border: 1px solid #303432; border-radius: 7px; color: #8e9490; background: #151716;
}
.feed-search input[type=text] { border: none; background: transparent; padding: 0; font-size: 13px; }
.feed-search input:focus { outline: none; }
.plaza-wrap main { padding-top: 34px; }
.masonry { gap: 28px; }
.masonry-col { gap: 30px; }
.xhs-card { background: transparent; border-radius: 0; overflow: visible; box-shadow: none; }
.xhs-card:hover { box-shadow: none; transform: none; }
.xhs-cover-wrap { position: relative; display: block; border-radius: 8px; overflow: hidden; background: #171918; }
.xhs-cover { transition: transform .22s ease, opacity .22s ease; }
.xhs-card:hover .xhs-cover { transform: scale(1.018); opacity: .84; }
.xhs-play {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px;
  display: flex; align-items: center; justify-content: center; padding-left: 3px; border-radius: 50%;
  background: rgba(8,10,9,.8); color: #fff; border: 1px solid rgba(255,255,255,.3);
  opacity: 0; transform: scale(.9); transition: opacity .18s, transform .18s;
}
.xhs-card:hover .xhs-play, .xhs-card:focus-visible .xhs-play { opacity: 1; transform: scale(1); }
.xhs-body { padding: 10px 1px 0; }
.xhs-title { color: #f1f3f2; font-size: 14px; line-height: 1.35; font-weight: 700; -webkit-line-clamp: 1; }
.xhs-foot { justify-content: flex-start; margin-top: 7px; }
.xhs-author { color: #b9bdbb; }
.xhs-avatar { width: 22px; height: 22px; font-size: 11px; }
.xhs-age { color: #6f7571; font-size: 11px; white-space: nowrap; }
.xhs-stats { margin-top: 7px; display: flex; gap: 12px; color: #777d79; font-size: 11px; }
.xhs-stats span { display: inline-flex; align-items: center; gap: 4px; }
.xhs-stats .xhs-type { margin-left: auto; max-width: 48%; overflow: hidden; color: #777d79; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); }

/* In-page game player */
.game-overlay {
  position: fixed; inset: 0; z-index: 100; background: #090a0a;
  display: flex; flex-direction: column; isolation: isolate;
}
.game-overlay-controls { position: absolute; right: 14px; top: 14px; z-index: 4; display: flex; gap: 10px; }
.overlay-icon, .overlay-action {
  display: inline-flex; align-items: center; justify-content: center; border: 1px solid #383c3a;
  background: #111312; color: #c7cbc8; cursor: pointer; font-family: inherit;
}
.overlay-icon { width: 36px; height: 36px; border-radius: 50%; font-size: 20px; }
.overlay-icon:hover, .overlay-action:hover { color: #fff; border-color: #666c68; background: #1d201e; }
.game-overlay-stage {
  flex: 1; min-height: 0; padding: 8px 64px 8px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.game-overlay-loading { display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--muted); text-align: center; }
.game-overlay-loading .spinner { width: 34px; height: 34px; border-color: #2c302e; border-top-color: var(--brand); }
.game-overlay-loading strong { color: var(--ink); }
.game-viewport {
  display: flex; align-items: stretch; justify-content: stretch; max-width: 100%; max-height: 100%;
  overflow: hidden; background: #111; border: 1px solid #333735; border-radius: 8px;
}
.game-viewport.is-portrait { height: min(calc(100dvh - 96px), calc((100vw - 80px) * 1.7778)); aspect-ratio: 9 / 16; }
.game-viewport.is-landscape { width: min(calc(100vw - 128px), calc((100dvh - 100px) * 1.7778)); aspect-ratio: 16 / 9; }
.game-viewport iframe {
  flex: 1 1 auto; width: 100%; height: 100%; min-width: 100%; min-height: 100%;
  border: 0; background: #111; display: block;
}
.game-overlay-footer {
  flex: 0 0 72px; min-width: 0; padding: 0 14px; display: flex; align-items: center; gap: 16px;
  border-top: 1px solid #232624; background: #070808;
}
.overlay-brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; border-right: 1px solid #2c302e; padding-right: 16px; }
.overlay-brand .logo-mark { width: 26px; height: 21px; font-size: 11px; }
.overlay-game-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.overlay-game-info > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.overlay-game-info strong { max-width: 360px; color: #f3f5f4; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.overlay-game-info small { margin-top: 3px; color: #7f8581; font-size: 11px; }
.overlay-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; }
.overlay-metrics { margin-left: auto; display: flex; align-items: center; gap: 9px; color: #909692; font-size: 12px; }
.overlay-metrics > span { min-width: 74px; min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; border-radius: 20px; background: #171918; }
.overlay-action { min-width: 42px; height: 38px; padding: 0 13px; gap: 6px; border-radius: 20px; font-size: 15px; }
.overlay-action svg { width: 15px; height: 15px; }
.game-overlay.is-minimized {
  inset: auto 16px 16px auto; width: 360px; height: 230px; border: 1px solid #3d423f;
  border-radius: 8px; overflow: hidden; box-shadow: 0 18px 70px rgba(0,0,0,.6);
}
.game-overlay.is-minimized .game-overlay-stage { padding: 0; }
.game-overlay.is-minimized .game-viewport { width: 100%; height: 100%; border: 0; border-radius: 0; aspect-ratio: auto; }
.game-overlay.is-minimized .game-overlay-footer { display: none; }
.game-overlay.is-minimized .game-overlay-controls { top: 8px; right: 8px; }
.game-overlay.is-minimized .overlay-icon { width: 30px; height: 30px; background: rgba(9,10,10,.82); }

@media (max-width: 760px) {
  .core-stats, .h5-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analytics-filter, .date-range-fields { align-items: stretch; }
  .analytics-filter { display: grid; }
  .date-presets { overflow-x: auto; }
  .date-presets button { flex: 1 0 auto; }
  .date-range-fields label { flex: 1 1 130px; }
  .date-range-fields input[type=date] { width: 100%; }
  .visitor-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
  .visitor-table-wrap { max-height: calc(100dvh - 172px); }
  .nav-inner { padding: 0 12px; gap: 12px; }
  .logo-name b { display: none; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 12px; }
  .wrap.plaza-wrap { padding-left: 12px; padding-right: 12px; }
  .ai-hero { min-height: 330px; padding: 48px 0 34px; }
  .ai-hero h1 { font-size: 34px; }
  .ai-hero h1 { margin-bottom: 24px; }
  .ai-box { min-height: 118px; }
  .prompt-chips { flex-wrap: nowrap; align-self: stretch; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; }
  .prompt-chips button { flex: 0 0 auto; }
  .feed-bar { top: 58px; min-height: 94px; padding: 8px 0; align-items: stretch; flex-direction: column; gap: 8px; }
  .feed-tabs { min-height: 38px; gap: 22px; }
  .feed-tools { justify-content: stretch; }
  .feed-search { flex: 1; width: auto; }
  .feed-tools select { width: 108px; }
  .plaza-wrap main { padding-top: 20px; }
  .masonry { gap: 10px; }
  .masonry-col { gap: 22px; }
  .xhs-title { font-size: 13px; }
  .xhs-age, .xhs-stats { font-size: 10px; }
  .xhs-stats { gap: 7px; }
  .game-overlay-controls { top: 8px; right: 8px; }
  .game-overlay-stage { padding: 50px 10px 6px; }
  .game-viewport.is-portrait { height: min(calc(100dvh - 126px), calc((100vw - 20px) * 1.7778)); }
  .game-viewport.is-landscape {
    width: calc(100vw - 20px); height: calc(100dvh - 126px); aspect-ratio: auto;
  }
  .game-overlay-footer { flex-basis: 66px; padding: 0 10px; gap: 9px; }
  .overlay-brand { display: none; }
  .overlay-game-info { flex: 1; }
  .overlay-game-info strong { max-width: 120px; }
  .overlay-metrics { margin-left: 0; gap: 5px; }
  .overlay-metrics > span { display: none; }
  .overlay-action { min-width: 36px; height: 36px; padding: 0 10px; }
  .game-overlay.is-minimized { width: calc(100vw - 24px); height: 210px; right: 12px; bottom: 12px; }
}

@media (max-width: 430px) {
  .core-stats, .h5-stats { grid-template-columns: 1fr; }
  .nav-user .btn { display: none; }
  .nav-links { gap: 10px; }
  .nav-links a { max-width: 52px; overflow: hidden; text-overflow: ellipsis; }
  .ai-hero h1 { font-size: 30px; }
  .cover-picker { align-items: flex-start; }
  .cover-preview { width: 84px; flex-basis: 84px; }
}

/* Day theme. The game overlay intentionally stays dark. */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7f6;
  --card: #ffffff;
  --ink: #171a18;
  --muted: #68706b;
  --brand: #0cae69;
  --brand-2: #07995b;
  --line: #d9dedb;
  --danger: #d9474e;
  --ok: #087a49;
  --accent: #b27600;
}
html[data-theme="light"], html[data-theme="light"] body { background: var(--bg); color: var(--ink); }
html[data-theme="light"] a { color: #087d4c; }
html[data-theme="light"] .nav { background: rgba(255,255,255,.96); border-bottom-color: #dfe3e1; }
html[data-theme="light"] .nav .logo { color: #171a18; }
html[data-theme="light"] .nav .logo-mark { background: #171a18; color: #fff !important; }
html[data-theme="light"] .nav .logo-mark::before,
html[data-theme="light"] .nav .logo-mark::after { background: #171a18; }
html[data-theme="light"] .nav .logo-mark i { border-color: #fff; }
html[data-theme="light"] .nav-links a { color: #646b67; }
html[data-theme="light"] .nav-links a.active,
html[data-theme="light"] .nav-links a:hover { color: #111412; }
html[data-theme="light"] .nav-user a { color: #333835; }
html[data-theme="light"] .theme-toggle { background: #f2f4f3; border-color: #d2d7d4; color: #303532; }
html[data-theme="light"] .theme-toggle:hover { background: #e8ecea; border-color: #aeb5b1; }
html[data-theme="light"] .btn { background: #12c878; color: #06140d; }
html[data-theme="light"] .btn:hover { background: #20d888; }
html[data-theme="light"] .btn.ghost { background: #fff; color: #1c2922; border-color: #bfc6c2; }
html[data-theme="light"] .btn.ghost:hover { color: #087d4c; border-color: #0cae69; }
html[data-theme="light"] .btn.plain { background: #e9edeb; color: #2c312e; }
html[data-theme="light"] .btn.danger { background: #e9575e; color: #fff; }
html[data-theme="light"] .card { background: #fff; border-color: #d9dedb; }
html[data-theme="light"] input[type=text],
html[data-theme="light"] input[type=email],
html[data-theme="light"] input[type=password],
html[data-theme="light"] textarea,
html[data-theme="light"] select { background: #fff; border-color: #cfd5d1; color: #171a18; }
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder { color: #929994; }
html[data-theme="light"] .tag,
html[data-theme="light"] .step { background: #e9edeb; color: #616964; }
html[data-theme="light"] .step.active { background: #18d482; color: #072116; }
html[data-theme="light"] .step.done { background: #d8f5e6; color: #087a49; }
html[data-theme="light"] .creator-mode { background: #edf0ee; border-color: #d6dcD8; }
html[data-theme="light"] .creator-mode button.active { background: #fff; color: #171a18; box-shadow: 0 1px 3px rgba(24,31,27,.12); }
html[data-theme="light"] .type-badge.standalone { background: #d8f5e6; color: #12633f; }
html[data-theme="light"] .type-badge.template { background: #fff0c9; color: #795500; }
html[data-theme="light"] input[type=file]::file-selector-button { background: #f0f3f1; color: #202522; border-color: #cbd1cd; }
html[data-theme="light"] .cover-preview { background: #f0f3f1; border-color: #b9c0bc; }
html[data-theme="light"] .my-game-cover { background: #f0f3f1; }
html[data-theme="light"] .tpl-option,
html[data-theme="light"] .k-item { background: #fff; border-color: #d9dedb; }
html[data-theme="light"] .tpl-option:hover,
html[data-theme="light"] .tpl-option.selected { border-color: #0cae69; background: #effbf5; }
html[data-theme="light"] table.admin { background: #fff; }
html[data-theme="light"] table.admin th { background: #eef1ef; color: #5f6762; }
html[data-theme="light"] .stat-card { background: #fff; border-color: #d9dedb; }
html[data-theme="light"] .analytics-filter { background: #fff; }
html[data-theme="light"] .date-range-fields input[type=date] { background: #fff; color: #171a18; color-scheme: light; }
html[data-theme="light"] .date-presets button.active { color: #06140d; }
html[data-theme="light"] .visitor-dialog { background: #fff; border-color: #cfd5d1; }
html[data-theme="light"] .visitor-dialog::backdrop { background: rgba(10,14,12,.64); }
html[data-theme="light"] .rename-game-dialog { background: #fff; border-color: #cfd5d1; }
html[data-theme="light"] .rename-game-dialog::backdrop { background: rgba(10,14,12,.64); }
html[data-theme="light"] .visitor-ip code { color: #171a18; }
html[data-theme="light"] .status-draft { background: #fff0c9; color: #795500; }
html[data-theme="light"] .status-published { background: #d8f5e6; color: #12633f; }
html[data-theme="light"] .status-removed { background: #ffe1e3; color: #9d252b; }
html[data-theme="light"] .visibility-public { background: #d8f5e6; color: #12633f; }
html[data-theme="light"] .visibility-private { background: #e9edeb; color: #59615c; }
html[data-theme="light"] .visibility-switch { border-color: #aeb5b1; background: #aeb5b1; }
html[data-theme="light"] .visibility-switch.is-public { border-color: #0cae69; background: #0cae69; }
html[data-theme="light"] .toast { background: #171a18; color: #fff; }
html[data-theme="light"] .autopilot-mask { background: rgba(245,247,246,.95); }
html[data-theme="light"] .spinner { border-color: #dce1de; border-top-color: #0cae69; }
html[data-theme="light"] .ai-box { background: #fff; border-color: #afb6b2; }
html[data-theme="light"] .ai-box:focus-within { border-color: #69716c; box-shadow: 0 0 0 1px #69716c; }
html[data-theme="light"] .icon-btn { background: #f0f3f1; border-color: #c8ceca; color: #333835; }
html[data-theme="light"] .icon-btn:hover { background: #e7ebe9; border-color: #9ea6a1; color: #111412; }
html[data-theme="light"] .prompt-chips button { background: #e7ebe9; color: #525a55; }
html[data-theme="light"] .prompt-chips button:hover { color: #111412; border-color: #bcc3bf; }
html[data-theme="light"] .feed-bar { background: rgba(245,247,246,.96); border-bottom-color: #dce1de; }
html[data-theme="light"] .feed-tabs button { color: #626a65; }
html[data-theme="light"] .feed-tabs button.active,
html[data-theme="light"] .feed-tabs button:hover { color: #111412; }
html[data-theme="light"] .feed-search,
html[data-theme="light"] .feed-tools select { background: #fff; border-color: #d1d7d3; }
html[data-theme="light"] .xhs-cover-wrap { background: #e5e9e7; }
html[data-theme="light"] .xhs-title { color: #171a18; }
html[data-theme="light"] .xhs-author { color: #4f5752; }
html[data-theme="light"] .xhs-age,
html[data-theme="light"] .xhs-stats,
html[data-theme="light"] .xhs-stats .xhs-type { color: #727a75; }
html[data-theme="light"] .empty { color: #6c746f; }
