/* ==============================
   HFGameAccountWeb — 轻量前台样式（移动优先）
   Brand：乔宝网络 · JoBaoNet
============================== */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --brand-primary: #2563eb;
  --brand-primary-soft: #dbeafe;
  --brand-accent-gold: #f59e0b;
  --brand-accent-gold-soft: #fef3c7;

  --neutral-900: #0f172a;
  --neutral-700: #334155;
  --neutral-500: #64748b;
  --neutral-200: #e2e8f0;
  --neutral-100: #f8fafc;
  --neutral-50:  #ffffff;

  --surface:     var(--neutral-50);
  --surface-alt: var(--neutral-100);
  --muted:       var(--neutral-500);
  --text:        var(--neutral-900);

  --success:     #10b981;
  --success-bg:  #dcfce7;
  --warning:     #f59e0b;
  --warning-bg:  #fef3c7;
  --danger:      #ef4444;
  --danger-bg:   #fee2e2;
  --info:        #3b82f6;

  --radius-sm:   8px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   18px;

  --shadow-xs:   0 1px 2px rgba(15,23,42,0.05);
  --shadow-sm:   0 1px 4px rgba(15,23,42,0.08);
  --shadow-md:   0 4px 12px rgba(15,23,42,0.10);

  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
             "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Noto Mono", Menlo, Consolas, monospace;

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 20px;

  --wt-normal: 400;
  --wt-medium: 500;
  --wt-semibold: 600;
  --wt-bold: 700;
}

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

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: radial-gradient(circle at top, var(--brand-primary-soft) 0%, var(--neutral-100) 40%, #f3f4f6 100%);
}

a { color: var(--brand-primary); text-decoration: none; }

/* Utility */
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ------ Buttons ------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-md);
  padding: 9px 15px;
  font-size: var(--fs-md);
  font-weight: var(--wt-medium);
  cursor: pointer;
  transition: all 0.18s ease-out;
  -webkit-tap-highlight-color: transparent;
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--neutral-200);
  flex-shrink: 0;
}
.btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm  { padding: 5px 10px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn-md  { padding: 9px 14px; font-size: var(--fs-sm); }
.btn-lg  { padding: 11px 16px; font-size: var(--fs-md); border-radius: var(--radius-md); }

.btn-primary {
  background: linear-gradient(135deg, var(--brand-primary) 0%, #3b82f6 100%);
  color: #ffffff;
  border-color: transparent;
}
.btn-primary:hover { background: linear-gradient(135deg, #1d4ed8 0%, var(--brand-primary) 100%); }

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #22c55e 100%);
  color: #ffffff;
  border-color: transparent;
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, #f97316 100%);
  color: #ffffff;
  border-color: transparent;
}

.btn-outline {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline:hover { background: var(--brand-primary-soft); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--neutral-200);
}
.btn-ghost:hover { background: var(--surface-alt); }

/* ------ Cards & Layout ------ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(148,163,184,0.18);
}
.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 6px;
}
.section-title {
  font-size: var(--fs-sm);
  font-weight: var(--wt-semibold);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-hint {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.inline-badge {
  font-size: var(--fs-xs);
  color: var(--brand-primary);
  font-weight: var(--wt-medium);
}

/* Inputs */
.input,
.textarea,
select.input {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--neutral-200);
  font-family: inherit;
  font-size: var(--fs-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
.textarea:focus,
select.input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-soft);
}
.textarea { resize: vertical; min-height: 80px; }

/* ------ Header ------ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: linear-gradient(right, rgba(255,255,255,0.96), rgba(237,242,255,0.94));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(148,163,184,0.18);
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-logo {
  width: 30px; height: 30px;
  border-radius: 9px;
  padding: 4px;
  background: linear-gradient(135deg, var(--brand-accent-gold-soft) 0%, var(--surface) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.app-logo img { width: 100%; height: 100%; object-fit: contain; }

.app-brand-title {
  display: flex;
  flex-direction: column;
}
.app-brand-main {
  font-size: var(--fs-lg);
  font-weight: var(--wt-bold);
  background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.app-brand-sub {
  font-size: var(--fs-xs);
  color: var(--muted);
}
.app-actions { display: flex; align-items: center; }

/* Container */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px;
}

/* Search area */
.filter-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.row-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.row-actions .btn { flex: 1; }
.row-actions .btn-sm { flex: unset; min-width: 60px; white-space: nowrap; }

/* Progress */
.progress-zone { padding-top: 10px; }
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--neutral-200);
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-primary), var(--brand-accent-gold));
  transition: width 0.25s ease-out;
}
.progress-text {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-top: 3px;
}

/* Stats */
.stats { background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%); }
.stat-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stat-card {
  flex: 1;
  min-width: 86px;
  padding: 8px 6px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.stat-card--gold {
  background: linear-gradient(135deg, var(--brand-accent-gold-soft), #eefcef);
  border: 1px solid rgba(245,158,11,0.28);
}
.stat-number {
  font-size: var(--fs-xl);
  font-weight: var(--wt-bold);
  color: var(--brand-primary);
}
.stat-card--gold .stat-number { color: var(--brand-accent-gold); }
.stat-label {
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* Toolbar */
.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.tool-row .btn { flex: 1; min-width: 0; }

/* PC: show secondary buttons inline */
/* Mobile default: only primary-first buttons tightly, second row handled via UI class below */

/* Table */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.result-table th {
  text-align: left;
  padding: 8px 6px;
  background: #f1f5f9;
  color: var(--muted);
  font-weight: var(--wt-semibold);
  border-bottom: 1px solid var(--neutral-200);
  position: sticky;
  top: 0;
  white-space: nowrap;
}
.result-table td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--neutral-200);
  vertical-align: middle;
  word-break: break-all;
}
.result-table tbody tr:hover td {
  background: #f8fafc;
}

.col-check { width: 36px; text-align: center; }
/* mobile: checkbox slightly bigger hit area */
.result-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  cursor: pointer;
}

/* table columns mobile hiding for tiny screens */
.col-md-only { }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 24px 0;
  font-size: var(--fs-sm);
}

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: var(--wt-medium);
}
.tag--lock { background: var(--danger-bg); color: var(--danger); }
.tag--unlock { background: var(--success-bg); color: var(--success); }

/* Heading extra actions */
.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Log */
.log-box {
  background: #0b1120;
  color: #e5e7eb;
  border-radius: var(--radius-md);
  padding: 9px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  max-height: 200px;
  overflow-y: auto;
}
.log-line { padding: 2px 0; border-bottom: 1px dashed rgba(148,163,184,0.3); }
.log-line:last-child { border-bottom: none; }
.log-line .t { color: #6b7280; margin-right: 6px; }
.log-line.err { color: #f87171; }
.log-line.ok  { color: #4ade80; }

/* Toast */
.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-90px);
  background: rgba(15,23,42,0.92);
  color: #fff;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Loading Mask */
.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.94);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 10000;
}
.loading-mask.show { display: flex; }
.loading-spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--neutral-200);
  border-top-color: var(--brand-primary);
  animation: spin 0.75s linear infinite;
}
.loading-text { font-size: var(--fs-sm); color: var(--muted); }
.loading-error {
  font-size: var(--fs-xs);
  color: var(--danger);
  text-align: center;
  max-width: 320px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.form-field { position: relative; }

/* ============================ */
/* Responsive breakpoints       */
/* ============================ */

/* Smaller mobile */
@media (max-width: 480px) {
  /* hide subtotal to fit header */
  .app-brand-sub { display: none; }
  .app-header { padding: 9px 12px; }

  /* make tool row show core buttons first, secondary on next line */
  .tool-row .btn工具次要 { order: 2; }

  /* hide some columns on very narrow screens */
  .result-table .col-md-only { display: none; }

  /* button icons and label shorten handled in HTML via class .label-short */
}

/* Larger mobile / tablet / desktop */
@media (min-width: 768px) {
  .container { padding: 22px; }
  .card { padding: 18px; }
  .heading-actions { margin-left: auto; }
  .filter-row { flex-wrap: nowrap; }
  .tool-row { flex-wrap: nowrap; }
  .tool-row .btn { min-width: 110px; }
  .result-table .col-md-only { display: table-cell; }
}
