:root {
  --gold: #f0bd5c;
  --gold-deep: #e0a13c;
  --gold-soft: rgba(240, 189, 92, .15);
  --blue: #8fd0e8;
  --green: #84d6a0;
  --red: #ec8a7c;
  --text: #f6f1e9;
  --text-dim: #c3b6a4;
  --glass: rgba(34, 27, 22, .38);
  --stroke: rgba(255, 246, 232, .14);
  --hi: rgba(255, 250, 240, .18);
  --radius: 18px;
  --ease: cubic-bezier(.22, .8, .3, 1);
  --bg-img: url('background.jpg');
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font: 14px/1.55 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); overflow: hidden; }
::selection { background: rgba(240, 189, 92, .3); }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea {
  font: inherit; color: var(--text); background: rgba(255, 255, 255, .05);
  border: 1px solid var(--stroke); border-radius: 11px; padding: 10px 13px; width: 100%;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
input::placeholder, textarea::placeholder { color: rgba(195, 182, 164, .55); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); background: rgba(255, 255, 255, .08); box-shadow: 0 0 0 3px var(--gold-soft); }
select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23f0bd5c' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
option { background: #1f1813; color: var(--text); }
.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; }

.bg { position: fixed; inset: -4%; z-index: -2; background: var(--bg-img) center/cover no-repeat; }
.bg-veil {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 800px at 82% -6%, rgba(240, 180, 110, .16), transparent 55%),
    radial-gradient(900px 700px at 10% 110%, rgba(120, 150, 190, .1), transparent 55%),
    linear-gradient(180deg, rgba(20, 15, 11, .42), rgba(13, 10, 8, .62));

}

.glass {
  background: rgba(34, 27, 22, .68);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .4), inset 0 1px 0 var(--hi);
}
.btn {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep)); color: #2c1d08; border: none;
  border-radius: 11px; padding: 10px 18px; font-weight: 600; letter-spacing: .01em;
  box-shadow: 0 6px 18px rgba(224, 161, 60, .3); transition: transform .18s var(--ease), filter .18s, box-shadow .18s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1.5px); box-shadow: 0 9px 24px rgba(224, 161, 60, .42); }
.btn:active { transform: translateY(0) scale(.99); }
.btn.ghost { background: rgba(255, 255, 255, .06); color: var(--text-dim); box-shadow: none; border: 1px solid var(--stroke); }
.btn.ghost:hover { color: var(--text); border-color: var(--gold); background: rgba(255, 255, 255, .11); transform: translateY(-1.5px); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid rgba(236, 138, 124, .35); box-shadow: none; padding: 6px 13px; }
.btn.danger:hover { background: rgba(236, 138, 124, .14); transform: none; }

.toggle { position: relative; display: inline-flex; width: 46px; height: 26px; flex: none; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle .track { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid var(--stroke); transition: background .26s var(--ease), border-color .26s; }
.toggle .track::after { content: ''; position: absolute; top: 2.5px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #ece4d6; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); transition: left .28s var(--ease), background .26s; }
.toggle input:checked + .track { background: linear-gradient(180deg, var(--gold), var(--gold-deep)); border-color: transparent; box-shadow: 0 0 14px rgba(240, 189, 92, .4); }
.toggle input:checked + .track::after { left: 22px; background: #fff; }

#login { position: fixed; inset: 0; display: grid; place-items: center; transition: opacity .42s var(--ease), transform .42s var(--ease), filter .42s; }
#login.out { opacity: 0; transform: scale(.97); filter: blur(4px); pointer-events: none; }
#login .box { width: 372px; padding: 42px 36px; text-align: center; animation: pop .55s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.95); } to { opacity: 1; transform: none; } }
#login .logo { width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; background: linear-gradient(135deg, var(--gold), var(--gold-deep)); display: grid; place-items: center; font-size: 26px; font-weight: 800; color: #2c1d08; box-shadow: 0 8px 22px rgba(240, 189, 92, .4); }
#login h1 { font-size: 21px; margin: 16px 0 5px; letter-spacing: .02em; }
#login .sub { color: var(--text-dim); font-size: 12.5px; margin-bottom: 26px; }
#login input { margin-bottom: 14px; text-align: center; }
#login .btn { width: 100%; }
.err { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 12px; }

#app { position: fixed; inset: 0; display: grid; grid-template-columns: 236px 1fr; padding: 18px; gap: 18px; opacity: 0; transition: opacity .5s var(--ease); }
#app.in { opacity: 1; }
aside { padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 24px; font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.brand .mk { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--gold), var(--gold-deep)); display: grid; place-items: center; font-size: 15px; font-weight: 800; color: #2c1d08; flex: none; }
nav { display: flex; flex-direction: column; gap: 3px; }
nav button {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: none; color: var(--text-dim);
  padding: 11px 14px; border-radius: 12px; font-size: 14px;
  transition: background .2s var(--ease), color .2s, transform .2s var(--ease), box-shadow .2s;
}
nav button .ic { font-size: 16px; width: 20px; text-align: center; }
nav button:hover { background: rgba(255, 255, 255, .07); color: var(--text); transform: translateX(3px); }
nav button.active { background: var(--gold-soft); color: var(--gold); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(240, 189, 92, .32), 0 4px 16px rgba(240, 189, 92, .14); }
aside .spacer { flex: 1; }

main { position: relative; overflow: hidden; border-radius: var(--radius); }
.main-glass-bg {
  position: absolute; inset: -1px; z-index: 0; pointer-events: none;
  background: rgba(34, 27, 22, .68);
  border: 1px solid var(--stroke); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .4), inset 0 1px 0 var(--hi);
}
.main-content { position: relative; z-index: 1; overflow: auto; padding: 28px 32px; height: 100%; }
.main-content::-webkit-scrollbar { width: 9px; }
.main-content::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 9px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-head h2 { font-size: 24px; font-weight: 700; letter-spacing: .01em; text-shadow: 0 2px 14px rgba(0, 0, 0, .3); }
.page-head .hint { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }
section { transition: opacity .15s var(--ease), transform .15s var(--ease); }
section.leaving { opacity: 0; }
section.entering { opacity: 0; transform: translateY(14px); }

.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card { padding: 20px 22px; transition: transform .22s var(--ease), box-shadow .22s, border-color .22s; }
.card.hoverable:hover { transform: translateY(-4px); box-shadow: 0 22px 54px rgba(0, 0, 0, .46), inset 0 1px 0 var(--hi); border-color: rgba(240, 189, 92, .32); }
.grid.stats .card { animation: rise .55s var(--ease) both; }
.grid.stats .card:nth-child(2){animation-delay:.06s} .grid.stats .card:nth-child(3){animation-delay:.12s} .grid.stats .card:nth-child(4){animation-delay:.18s}
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.stat .label { color: var(--text-dim); font-size: 12px; letter-spacing: .03em; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 8px; line-height: 1.1; }
.stat .value.gold { color: var(--gold); text-shadow: 0 0 26px rgba(240, 189, 92, .4); }
.stat .value.blue { color: var(--blue); } .stat .value.green { color: var(--green); }
.stat .sub { color: var(--text-dim); font-size: 11.5px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--stroke); font-size: 13px; }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .16s; } tbody tr:hover { background: rgba(255, 255, 255, .05); }
td code { background: rgba(0, 0, 0, .3); padding: 2px 9px; border-radius: 8px; font-size: 12px; word-break: break-all; }

.field { margin-bottom: 18px; }
.field label { display: block; color: var(--text-dim); font-size: 12.5px; margin-bottom: 7px; }
.field.bool { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.field.bool label { margin: 0; color: var(--text); font-size: 13.5px; }
.field .desc { color: var(--text-dim); font-size: 11px; margin-top: 6px; opacity: .85; }
.toolbar { display: flex; gap: 11px; margin-bottom: 18px; }
.toolbar input { flex: 1; }
.pill { display: inline-block; padding: 3px 11px; border-radius: 99px; font-size: 11.5px; }
.pill.on { background: rgba(132, 214, 160, .16); color: var(--green); }
.pill.off { background: rgba(255, 255, 255, .07); color: var(--text-dim); }
.preset { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.preset .thumb { width: 120px; height: 74px; border-radius: 12px; background-size: cover; background-position: center; cursor: pointer; border: 2px solid transparent; transition: border-color .2s, transform .2s var(--ease); }
.preset .thumb:hover { transform: translateY(-3px) scale(1.02); border-color: var(--gold); }
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(22px); padding: 13px 24px; font-size: 13px; opacity: 0; transition: all .34s var(--ease); pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.text-right { text-align: right; }
.text-dim { color: var(--text-dim); }
.min-w-0 { min-width: 0; }
.mt-4px { margin-top: 4px; }
.mt-14px { margin-top: 14px; }
.h-6px { height: 6px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-1 { grid-template-columns: 1fr; }
.m-0 { margin: 0; }
.font-mono { font-family: ui-monospace, monospace; }
.file-input { padding: 6px 12px; }
.btn-blue { border-color: var(--blue); color: var(--blue); }
.btn-green { border-color: var(--green); color: var(--green); }
.btn-red { border-color: var(--red); color: var(--red); }
.summary-text { margin-bottom: 12px; font-weight: 600; color: var(--gold); }
.divider { border-top: 1px dashed var(--stroke); margin: 18px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.flex-gap-11 { display: flex; gap: 11px; }
.label-gold { font-weight: 600; color: var(--gold); }
.field-mb-20px { margin-bottom: 20px; }
.field-heading { display: block; color: var(--text-dim); font-size: 12.5px; margin-bottom: 7px; }

.test-progress { display: none; padding: 12px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); border-radius: 11px; margin-bottom: 14px; overflow: hidden; }
.test-progress-text { font-weight: 600; font-size: 13px; color: var(--gold); }
.progress-track { height: 6px; background: rgba(0,0,0,0.3); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); transition: width 0.2s ease; }
.test-progress-detail { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-input-wrap { display: flex; gap: 0; align-items: stretch; }
.key-input-wrap input { border-radius: 11px 0 0 11px; border-right: none; }
.key-gen-btn {
  width: 40px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.05); border: 1px solid var(--stroke);
  border-radius: 0 11px 11px 0; color: var(--text-dim); cursor: pointer;
  transition: all .2s var(--ease); flex-shrink: 0;
}
.key-gen-btn:hover { color: var(--gold); border-color: rgba(240,189,92,.4); background: var(--gold-soft); }
.masked { color: var(--text-dim); letter-spacing: 0.04em; }
.key-cell { white-space: nowrap; }
.key-cell:hover .action-copy-btn { opacity: 1; }
.action-copy-btn {
  background: transparent; border: none; cursor: pointer; padding: 4px;
  margin-left: 8px; color: var(--text-dim); opacity: 0.55;
  display: inline-flex; align-items: center; border-radius: 6px;
  transition: opacity .2s var(--ease);
}
.action-copy-btn:hover { opacity: 1; color: var(--gold); }
.th-center { width: 40px; text-align: center; }

/* ── mobile responsive ── */

@media (max-width: 480px) {
  #login .box { width: auto; max-width: calc(100vw - 32px); padding: 32px 20px; }
  #login h1 { font-size: 18px; }
  .preset .thumb { width: 90px; height: 58px; }
  .toast { left: 16px; right: 16px; transform: translateY(22px); text-align: center; }
  .toast.show { transform: translateY(0); }
  .actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .actions .flex-1 { display: none; }
  .actions .btn { font-size: 11px; padding: 8px 6px; text-align: center; min-width: 0; }
  .card table th,
  .card table td { padding: 10px 10px; font-size: 12px; }
}

.menu-btn {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 99;
  width: 40px; height: 40px; border: 1px solid var(--stroke);
  background: var(--glass); backdrop-filter: blur(10px);
  border-radius: 11px; align-items: center; justify-content: center;
  font-size: 20px; color: var(--text);
}

.menu-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: opacity .3s var(--ease);
}
.menu-overlay.open { opacity: 1; pointer-events: auto; }

@media (max-width: 768px) {
  .menu-btn { display: flex; }
  #app { grid-template-columns: 1fr; padding: 0; gap: 0; }
  aside {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    width: 260px; border-radius: 0;
    transform: translateX(-100%);
    transition: transform .3s var(--ease);
    padding: 20px 14px;
  }
  aside.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .main-content { padding: 16px; padding-top: 68px; }
  main { border-radius: 0; }
  .page-head h2 { font-size: 20px; }
  .card { padding: 16px; }
  .card table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 600px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid.stats { grid-template-columns: 1fr 1fr; }
  .field.bool { flex-direction: column; align-items: flex-start; }
  .actions .btn { flex: 1; min-width: 0; text-align: center; font-size: 12px; padding: 8px 10px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar input { min-width: 120px; }
}
