* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --border: #e5e9f0;
  --border-strong: #d4dae3;
  --text: #1f2a37;
  --text-2: #667085;
  --text-3: #98a2b3;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff4ff;
  --danger: #d92d20;
  --danger-soft: #fee4e2;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, button { -webkit-tap-highlight-color: transparent; }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand { font-size: 17px; font-weight: 700; letter-spacing: 0; }

.brand-sub {
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Layout */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: 0; }
.page-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #d6e4ff;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: background .15s ease;
}

.btn-back:hover { background: #e0ebff; }

/* Game menu */
.menu-section { margin-bottom: 28px; }

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 12px;
  letter-spacing: 0;
}

.section-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.section-dot-official { background: var(--danger); }
.section-dot-system { background: var(--primary); }

.game-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.game-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  min-height: 52px;
  border-bottom: 1px solid var(--border);
  transition: background .15s ease;
}

.game-item:last-child { border-bottom: none; }
.game-item:hover { background: #f8fafc; }
.game-name { font-size: 15px; font-weight: 600; }
.game-arrow { color: var(--text-3); flex: none; transition: transform .15s ease, color .15s ease; }
.game-item:hover .game-arrow { color: var(--primary); transform: translateX(3px); }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px;
}

.login-logo { font-size: 22px; font-weight: 700; text-align: center; letter-spacing: 0; }
.login-sub { text-align: center; color: var(--text-2); font-size: 13px; margin: 6px 0 22px; }

.pwd-wrap { position: relative; }
.pwd-wrap .field-input { padding-right: 64px; }

.pwd-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
}

/* Form fields */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

.field-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.field-input::placeholder { color: var(--text-3); }
.field-tip { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  min-height: 42px;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  user-select: none;
}

.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-block { width: 100%; }

.btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #d6e4ff;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  min-height: 34px;
  transition: background .15s ease;
}

.btn-edit:hover { background: #e0ebff; }

/* Data list */
.data-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }

.data-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.row-main { padding: 12px 14px; }

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

.qishu { font-size: 13px; font-weight: 700; color: var(--primary); }
.kaijian { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: auto;
}

.tag-wait { color: var(--amber); background: var(--amber-soft); border: 1px solid #fde68a; }
.tag-done { color: var(--text-2); background: var(--bg); border: 1px solid var(--border); }

.row-bottom { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.haoma {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 28px;
}

.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--danger-soft);
  color: #b42318;
  border: 1px solid #fecaca;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Edit panel */
.change-panel {
  display: none;
  background: #f8fafc;
  border-top: 1px dashed var(--border-strong);
  padding: 14px;
}

.change-panel.open { display: block; animation: panelIn .16s ease; }

@keyframes panelIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.panel-field { margin-bottom: 12px; }
.panel-actions { display: flex; gap: 10px; }

.is-done .row-main { background: #fbfcfd; }
.is-done .haoma { opacity: .55; }
.is-done .ball { background: var(--bg); color: var(--text-2); border-color: var(--border); }

/* Add card */
.add-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.add-head { margin-bottom: 16px; }
.add-head h2 { font-size: 16px; font-weight: 700; letter-spacing: 0; }
.add-head p { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.tip-list {
  list-style: none;
  margin: 4px 0 16px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12px;
}

.tip-list li { position: relative; padding-left: 16px; margin: 4px 0; }

.tip-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
}

/* Number picker */
.picker { margin-top: 10px; }

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.picker-count { font-size: 12px; color: var(--text-2); }

.picker-clear {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  transition: background .15s ease, color .15s ease;
}

.picker-clear:hover { background: var(--bg); color: var(--text); }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
}

.picker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .05s ease;
  user-select: none;
}

.picker-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.picker-btn:active:not(:disabled) { transform: translateY(1px); }

.picker-btn.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.picker-btn.is-on:hover { background: var(--primary-dark); color: #fff; }
.picker-btn:disabled { opacity: .45; cursor: not-allowed; }

/* Responsive */
@media (max-width: 520px) {
  .container { padding: 18px 14px 48px; }
  .topbar-inner { padding: 10px 14px; }
  .page-head h1 { font-size: 20px; }
  .game-item { padding: 13px 14px; }
  .row-main { padding: 12px; }
  .ball { min-width: 25px; height: 25px; font-size: 12px; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 7px; }
  .picker-btn { min-width: 38px; height: 38px; font-size: 13px; }
}
