/* Layout & chrome aligned with 众玩拼图·后台 (.phone 9:16 shell). */
:root {
  --bg: #f7fbf9;
  --panel: #ffffff;
  --line: #cfe4d9;
  --text: #1f332b;
  --muted: #5e7a6e;
  --accent: #1fad90;
  --accent-soft: rgba(31, 173, 144, 0.12);
  --danger: #e25c5c;
  --ok: #1fad90;
  --input: #ffffff;
  --inset: #eef6f2;
  --tab: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #dceee6;
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 12px;
}

/* 显示比例：竖屏 9:16 手机壳，桌面居中；窄屏铺满 */
.phone {
  width: min(100%, max(390px, (100dvh - 24px) * 9 / 16));
  height: calc(100dvh - 24px);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 16px 40px rgba(40, 90, 70, 0.12);
}

@media (max-width: 430px) {
  body { padding: 0; }
  .phone {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

.top {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  background: var(--panel);
}

.top h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.02em;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top .sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 12px 14px;
  -webkit-overflow-scrolling: touch;
}

.tabs {
  flex: 0 0 auto;
  height: calc(var(--tab) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: none;
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.tabs.on { display: flex; }

.tabs button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
}

.tabs button.on { color: var(--accent); }

.tabs .ico {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ver {
  flex: 0 0 auto;
  padding: 2px 0 6px;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.login {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 28px;
}

label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

input:focus, select:focus { border-color: var(--accent); }

.btn {
  appearance: none;
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  width: 100%;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn:disabled { opacity: 0.45; cursor: default; }

.mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.mode-row .btn.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.msg {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(226, 92, 92, 0.12);
  color: var(--danger);
  font-size: 13px;
  white-space: pre-wrap;
}

.msg.ok {
  background: var(--accent-soft);
  color: var(--ok);
}

.msg[hidden], [hidden] { display: none !important; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 650;
}

.card p.hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }

.stack { display: flex; flex-direction: column; gap: 10px; }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.foot-links {
  margin-top: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.foot-links a {
  color: var(--accent);
  text-decoration: none;
}

.users {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}

.users table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.users th, .users td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.users th {
  background: var(--inset);
  color: var(--muted);
  font-weight: 600;
}

.users tr:last-child td { border-bottom: 0; }

.users .empty {
  margin: 0;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  background: var(--inset);
  padding: 1px 5px;
  border-radius: 6px;
  word-break: break-all;
}

.session-box {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--inset);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}
