/* KixGame 品牌样式：深色侧栏 + 浅色内容区，卡片化布局 */

:root {
  --bg: #f3f4f9;
  --panel: #ffffff;
  --sidebar: #0d1017;
  --sidebar-soft: #171b26;
  --sidebar-line: #232936;
  --ink: #121728;
  --muted: #6b7280;
  --line: #e6e8ef;
  --accent: #6c5ce7;
  --accent-strong: #5a49d6;
  --accent-soft: #eeebff;
  --ok: #0e9f6e;
  --warn: #d97706;
  --danger: #e02424;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 24px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

/* 作者样式里的 display 会盖掉 hidden 的默认行为，这里兜底 */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
p,
figure {
  margin: 0;
}

/* ───────── 外壳 ───────── */

.shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: #c7cddb;
  padding: 22px 16px 26px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.3px;
  color: #fff;
}

.brand img {
  width: 26px;
  height: 26px;
}

.brand small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: #6f7a92;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b6bdcd;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav button:hover {
  background: var(--sidebar-soft);
  color: #fff;
}

.nav button[aria-current="page"] {
  background: var(--accent);
  color: #fff;
}

.sidebar-foot {
  margin-top: auto;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1.7;
  color: #5d6679;
}

.content {
  padding: 30px 34px 60px;
  min-width: 0;
}

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1180px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 26px;
  letter-spacing: -0.6px;
}

.page-head .lead {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

/* ───────── 卡片 ───────── */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.card h2 {
  font-size: 16px;
  letter-spacing: -0.2px;
  margin-bottom: 14px;
}

.card + .card {
  margin-top: 0;
}

/* ───────── 表单 ───────── */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}

input:not([type="checkbox"]),
select,
textarea {
  display: block;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid #d3d8e4;
  border-radius: 10px;
  background: #fff;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input::placeholder,
textarea::placeholder {
  color: #9aa1b1;
}

[aria-invalid="true"] {
  border-color: var(--danger) !important;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.field-wide {
  grid-column: 1 / -1;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
}

.meta {
  font-size: 13px;
  color: var(--muted);
}

.error {
  display: block;
  min-height: 0;
  margin-top: 6px;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.error:empty {
  display: none;
}

.req {
  color: var(--danger);
  margin-left: 3px;
}

/* ───────── 按钮 ───────── */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}

button:hover,
.button:hover {
  background: #f7f8fc;
}

button:active,
.button:active {
  transform: translateY(1px);
}

button:disabled,
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-strong);
}

.block {
  width: 100%;
}

/* ───────── 工具栏与筛选 ───────── */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .search {
  flex: 1;
  min-width: 220px;
}

.toolbar input,
.toolbar select {
  margin: 0;
}

.toolbar > select {
  flex: 1;
  min-width: 160px;
  max-width: 220px;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

#issued {
  margin-top: 18px;
}

#issued textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13.5px;
}

#issued button {
  margin-top: 10px;
}

/* ───────── 表格 ───────── */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8f9fc;
  padding: 11px 14px;
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr:hover {
  background: #fafbfe;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.row-actions button {
  min-height: 30px;
  padding: 4px 11px;
  font-size: 13px;
  border-radius: 8px;
}

.pager {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.wrap-cell {
  max-width: 320px;
  word-break: break-all;
  font-size: 12px;
  line-height: 1.6;
}

.muted-cell {
  color: var(--muted);
}

.empty-state {
  padding: 30px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.6px;
  word-break: break-all;
}

.note-input {
  min-width: 130px;
  padding: 7px 9px;
  font-size: 13.5px;
}

.empty,
td[colspan] {
  color: var(--muted);
  text-align: center;
}

#admin-status {
  margin-top: 18px;
  font-size: 13.5px;
  color: var(--muted);
  min-height: 20px;
}

.hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 4px 0 0;
  padding-left: 20px;
  font-size: 14px;
}

.steps li::marker {
  color: var(--accent);
  font-weight: 600;
}

.steps li > strong {
  display: block;
  margin-bottom: 8px;
  font-size: 14.5px;
}

/* 说明文字里的强调保持行内，别被上面的块级规则带跑 */
.steps .hint strong {
  display: inline;
  font-size: inherit;
}

.steps .hint {
  margin-top: 8px;
}

.steps .button {
  display: block;
  margin-top: 6px;
  text-align: center;
}

.actions.steps-edit {
  margin-top: 22px;
}

.card textarea[readonly] {
  font-size: 13.5px;
  line-height: 1.7;
}

.actions {
  margin-top: 4px;
}

.download-box {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(108, 92, 231, 0.06);
}

.download-box strong {
  font-size: 15px;
}

.download-box .hint {
  margin-top: 4px;
}

.download-box .button {
  margin-left: auto;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: 14px;
}

.script-block {
  margin-top: 16px;
}

.script-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.script-head h2 {
  flex: 1;
  margin: 0;
  font-size: 14.5px;
  color: var(--text);
}

.script-head .button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.script {
  margin: 10px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(108, 92, 231, 0.06);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.roles {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.role {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(108, 92, 231, 0.06);
}

.role .tag {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(108, 92, 231, 0.14);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}

.role strong {
  display: block;
  font-size: 14.5px;
}

.role .hint {
  margin-top: 4px;
}

.shot {
  margin: 12px 0 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot figcaption {
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.shot figcaption strong {
  color: var(--text);
  display: inline;
  font-size: inherit;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 8px 0 4px;
}

.qr-item {
  margin: 0;
  text-align: center;
}

.qr-item img {
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: 12px;
  background: #fff;
  display: block;
  margin: 0 auto 8px;
}

.qr-item .button {
  display: block;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  padding: 9px 8px;
  min-height: 0;
}

.qr-item #save {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.qr-item figcaption {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

@media (max-width: 480px) {
  .qr-grid {
    grid-template-columns: 1fr;
  }
}

.qr-download {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(108, 92, 231, 0.06);
  text-align: center;
}

.qr-download img {
  width: 148px;
  height: 148px;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  display: block;
  margin: 0 auto 8px;
}

.qr-download .hint {
  margin: 0;
}

@media (max-width: 640px) {
  .roles {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.role {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(108, 92, 231, 0.06);
}

.role .tag {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(108, 92, 231, 0.14);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}

.role strong {
  display: block;
  font-size: 14.5px;
}

.role .hint {
  margin-top: 4px;
}

.shot {
  margin: 12px 0 0;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
}

.shot figcaption {
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.shot figcaption strong {
  color: var(--text);
  display: inline;
  font-size: inherit;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 8px 0 4px;
}

.qr-item {
  margin: 0;
  text-align: center;
}

.qr-item img {
  width: 100%;
  max-width: 220px;
  height: auto;
  border-radius: 12px;
  background: #fff;
  display: block;
  margin: 0 auto 8px;
}

.qr-item .button {
  display: block;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  padding: 9px 8px;
  min-height: 0;
}

.qr-item #save {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}

.qr-item figcaption {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

@media (max-width: 480px) {
  .qr-grid {
    grid-template-columns: 1fr;
  }
}

.qr-download {
    display: none;
  }
}

.guide-foot {
  margin: 4px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.guide-foot a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.guide-link {
  margin-top: 12px;
  text-align: center;
}

.guide-link a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.user-shell .guide-warning {
  color: var(--danger);
  font-weight: 700;
}

.doc-steps li {
  margin-bottom: 4px;
}

.doc-steps strong {
  font-size: 15px;
}

.faq {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.faq:first-of-type {
  border-top: 0;
  padding-top: 4px;
}

.faq h2 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
}

.faq .hint {
  margin: 0;
}

.user-bar .brand {
  text-decoration: none;
  color: inherit;
}

.user-bar .button {
  margin-left: auto;
  min-height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  text-decoration: none;
}

/* ───────── 弹窗与抽屉 ───────── */

body.modal-open {
  overflow: hidden;
}

.icon {
  min-height: 34px;
  width: 34px;
  padding: 0;
  font-size: 19px;
  line-height: 1;
  color: var(--muted);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 16, 25, 0.45);
}

.modal-card {
  position: relative;
  width: min(100%, 540px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(12, 16, 25, 0.28);
  overflow: hidden;
}

.modal-card.narrow {
  width: min(100%, 420px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px 14px;
  margin: 0;
  font-size: 13.5px;
}

.detail dt {
  color: var(--muted);
}

.detail dd {
  margin: 0;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
}

.detail dd.detail-wide {
  grid-column: 2;
}

.modal-body textarea {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 13.5px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  background: #fafbfd;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(100%, 560px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  box-shadow: -20px 0 50px rgba(12, 16, 25, 0.18);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.drawer-body {
  padding: 16px 20px 28px;
  overflow-y: auto;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(12, 16, 25, 0.35);
}

/* ───────── 用户页 ───────── */

.user-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 420px at 12% -10%, #e9e5ff 0%, transparent 62%),
    radial-gradient(760px 380px at 92% 0%, #e4f2ff 0%, transparent 58%),
    var(--bg);
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  max-width: 620px;
  width: 100%;
  margin: 0 auto;
}

.user-bar .brand {
  padding: 0;
  color: var(--ink);
}

.user-bar .brand small {
  color: var(--muted);
}

.session {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--muted);
}

.session button {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
}

.user-main {
  flex: 1;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 6px 20px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.user-main .card {
  padding: 26px 26px 28px;
}

.user-main h1 {
  font-size: 24px;
  letter-spacing: -0.6px;
  margin-bottom: 18px;
}

.user-main .lead {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.user-main label {
  margin-top: 16px;
}

.user-main label:first-of-type {
  margin-top: 0;
}



.user-main #submit {
  margin-top: 20px;
}

figure {
  text-align: center;
  margin: 8px 0 22px;
}

figure img {
  display: block;
  width: min(100%, 320px);
  margin: 0 auto 12px;
  border-radius: 12px;
  image-rendering: pixelated;
}

figcaption {
  font-size: 13px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.actions > * {
  flex: 1;
  min-width: 140px;
}

.success-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #e6f7f0;
  color: var(--ok);
  font-weight: 700;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px 16px;
  }
  .sidebar-foot {
    display: none;
  }
  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .nav button {
    justify-content: center;
    white-space: nowrap;
    padding: 10px 8px;
    font-size: 13.5px;
  }
  .content {
    padding: 20px 16px 48px;
  }
  .card {
    padding: 18px 16px;
  }
}
