:root{
  --bg:#0b1220;
  --bg2:#172033;
  --panel:#121a2bcc;
  --text:#eaf2ff;
  --muted:#9fb0cc;
  --line:rgba(255,255,255,.10);
  --good:#34d399;
  --bad:#f87171;
  --r:#334155;
  --sr:#7c3aed;
  --ssr1:#f59e0b;
  --ssr2:#ef4444;
}

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

body{
  color:var(--text);
  font-family:"PingFang SC","Microsoft YaHei","Noto Sans SC",sans-serif;
  background:
    radial-gradient(1000px 560px at 10% 10%, #1d4ed8 0%, transparent 45%),
    radial-gradient(1000px 560px at 90% 10%, #7c3aed 0%, transparent 35%),
    linear-gradient(135deg, var(--bg), var(--bg2));
  min-height:100vh;
}

a{
  color:#7dd3fc;
  text-decoration:none;
}
a:hover{opacity:.9}

.wrap{
  max-width:1360px;
  margin:0 auto;
  padding:20px 16px 36px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.brand{
  display:flex;
  gap:14px;
  align-items:center;
}

.brand-mark{
  width:56px;
  height:56px;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:30px;
  background:linear-gradient(135deg, rgba(59,130,246,.25), rgba(139,92,246,.25));
  border:1px solid var(--line);
  box-shadow:0 8px 24px rgba(0,0,0,.15);
}

.brand h1{
  margin:0;
  font-size:28px;
  line-height:1.15;
}

.brand p{
  margin:4px 0 0;
  color:var(--muted);
  font-size:13px;
}

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

.top-links a{
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(11,18,32,.45);
}

.card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
  backdrop-filter:blur(10px);
  box-shadow:0 12px 36px rgba(0,0,0,.22);
}

.start-panel{
  max-width:580px;
  margin:48px auto;
  text-align:center;
}

.start-icon{
  font-size:60px;
  margin-bottom:8px;
}

.start-panel h2{
  margin:0 0 8px;
}

.start-form{
  margin-top:16px;
}

.muted{
  color:var(--muted);
  font-size:13px;
  line-height:1.75;
}

.game-layout{
  display:grid;
  grid-template-columns:320px minmax(0,1fr) 360px;
  gap:16px;
  align-items:start;
}

.panel{
  min-width:0;
}

.panel-card,
.action-panel,
.special-panel{
  margin-bottom:16px;
}

.panel-title{
  font-size:16px;
  font-weight:800;
  margin-bottom:14px;
  letter-spacing:.3px;
}

.panel-title.hot{
  color:#fde68a;
}

.avatar-area{
  display:flex;
  gap:14px;
  align-items:center;
  margin-bottom:14px;
}

.avatar-circle{
  width:74px;
  height:74px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:18px;
  background:linear-gradient(135deg, rgba(59,130,246,.25), rgba(139,92,246,.25));
  border:1px solid var(--line);
  box-shadow:inset 0 0 20px rgba(255,255,255,.05);
}

.avatar-meta{
  min-width:0;
}

.name-line{
  font-size:22px;
  font-weight:800;
  margin-bottom:4px;
}

.realm-line{
  color:#c7d2fe;
  font-size:14px;
}

.basic-list{
  display:grid;
  gap:8px;
  margin-bottom:14px;
}

.basic-list > div{
  display:flex;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  background:rgba(2,6,23,.25);
  border:1px solid rgba(255,255,255,.06);
  border-radius:12px;
  font-size:14px;
}

.basic-list span{
  color:var(--muted);
}

.bar-block{
  margin-bottom:12px;
}

.kv{
  display:flex;
  justify-content:space-between;
  color:var(--muted);
  font-size:13px;
  margin-bottom:5px;
}

.progress{
  height:12px;
  background:#0a1020;
  border-radius:999px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.08);
}

.bar{
  height:100%;
  transition:width .3s ease;
}
.exp{background:linear-gradient(90deg,#22d3ee,#3b82f6)}
.hp{background:linear-gradient(90deg,#34d399,#10b981)}
.life{background:linear-gradient(90deg,#f59e0b,#ef4444)}

.attr-grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:10px;
  margin-top:14px;
}

.attr-box{
  text-align:center;
  padding:12px 10px;
  background:rgba(2,6,23,.25);
  border:1px solid rgba(255,255,255,.06);
  border-radius:14px;
}

.attr-box span{
  display:block;
  color:var(--muted);
  font-size:13px;
  margin-bottom:6px;
}

.attr-box b{
  font-size:20px;
}

.status-badges{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
}

.flag{
  display:inline-block;
  font-size:12px;
  padding:4px 10px;
  border-radius:999px;
}

.good-flag{
  background:rgba(16,185,129,.14);
  color:#a7f3d0;
  border:1px solid rgba(16,185,129,.25);
}

.bad-flag{
  background:rgba(239,68,68,.12);
  color:#fecaca;
  border:1px solid rgba(239,68,68,.25);
}

.neutral-flag{
  background:rgba(148,163,184,.12);
  color:#cbd5e1;
  border:1px solid rgba(148,163,184,.18);
}

.unlock-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:14px;
}

.unlock{
  padding:4px 10px;
  border-radius:999px;
  background:#334155;
  color:#cbd5e1;
  font-size:12px;
}

.unlock.on{
  background:#064e3b;
  color:#a7f3d0;
}

.action-panel{
  padding:20px;
}

.action-group-title{
  font-size:13px;
  color:#cbd5e1;
  margin:16px 0 10px;
  font-weight:700;
  letter-spacing:.3px;
}

.main-actions{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}

.main-actions button,
.auto-panel-box button,
.key-actions button,
.event-options button,
.restart-btn{
  min-height:74px;
  align-items:center;
  justify-content:flex-start;
  text-align:left;
}

.key-actions{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}

.break-btn{
  background:linear-gradient(135deg, rgba(245,158,11,.22), rgba(239,68,68,.22));
}

.auto-panel-box{
  display:grid;
  gap:12px;
}

.auto-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) 110px;
  gap:12px;
}

.special-panel{
  border-color:rgba(125,211,252,.24);
  background:linear-gradient(180deg, rgba(59,130,246,.14), rgba(139,92,246,.10));
}

.event-title{
  margin:0 0 10px;
  font-size:20px;
}

.event-desc{
  margin:0 0 14px;
  line-height:1.8;
  color:#dbeafe;
}

.event-options{
  display:grid;
  gap:10px;
}

.traits-toggle{
  margin-top:14px;
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  background:rgba(2,6,23,.18);
  overflow:hidden;
}

.traits-toggle summary{
  list-style:none;
  cursor:pointer;
  padding:14px 16px;
  font-weight:700;
  display:flex;
  align-items:center;
  gap:8px;
  user-select:none;
}

.traits-toggle summary::-webkit-details-marker{
  display:none;
}

.traits-wrap{
  padding:0 16px 16px;
}

.traits{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.trait,.trait-mini{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.16);
}

.trait.R,.trait-mini.R{
  background:#334155;
  color:#e2e8f0;
}

.trait.SR,.trait-mini.SR{
  background:linear-gradient(90deg,#6d28d9,#8b5cf6);
  color:#fff;
}

.trait.SSR,.trait-mini.SSR{
  background:linear-gradient(90deg,var(--ssr1),var(--ssr2));
  color:#fff;
}

.trait-desc-list{
  display:grid;
  gap:10px;
}

.trait-line{
  padding:12px;
  background:rgba(2,6,23,.25);
  border:1px solid rgba(255,255,255,.06);
  border-radius:14px;
}

.trait-head{
  margin-bottom:8px;
}

.effect-text{
  color:#dbeafe;
  font-size:13px;
  line-height:1.7;
  margin-top:4px;
}

.log-panel{
  position:sticky;
  top:16px;
}

.log{
  max-height:760px;
  overflow:auto;
  background:rgba(2,6,23,.35);
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  padding:12px;
  font-size:13px;
  line-height:1.8;
}

input,button{
  width:100%;
  padding:12px 13px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(11,18,32,.66);
  color:#fff;
  outline:none;
}

button{
  font-weight:700;
  cursor:pointer;
  transition:.2s transform,.2s opacity,.2s border-color;
  display:flex;
  gap:10px;
}

button:hover{transform:translateY(-1px)}
button:disabled{
  opacity:.45;
  cursor:not-allowed;
  transform:none;
}

button span strong{
  display:block;
  font-size:14px;
  line-height:1.2;
}

button span small{
  display:block;
  font-size:12px;
  color:#cbd5e1;
  margin-top:4px;
}

.i{
  width:18px;
  height:18px;
  flex:0 0 18px;
  display:inline-flex;
  margin-top:2px;
}

.i svg{
  width:18px;
  height:18px;
  fill:currentColor;
}

.stop-btn{
  justify-content:center !important;
  background:linear-gradient(90deg,#7f1d1d,#dc2626);
}

.restart-box{
  margin-top:14px;
}

.restart-btn{
  justify-content:flex-start;
  background:linear-gradient(90deg,#334155,#475569);
}

.bad{
  color:var(--bad);
  font-weight:700;
  margin-top:12px;
}

.good{
  color:var(--good);
  font-weight:700;
  margin-top:12px;
}

::-webkit-scrollbar{
  width:10px;
  height:10px;
}
::-webkit-scrollbar-thumb{
  background:rgba(148,163,184,.38);
  border-radius:999px;
}
::-webkit-scrollbar-track{
  background:rgba(2,6,23,.2);
}

@media (max-width: 1180px){
  .game-layout{
    grid-template-columns:300px minmax(0,1fr);
  }

  .right-panel{
    grid-column:1 / -1;
  }

  .log-panel{
    position:static;
  }
}

@media (max-width: 860px){
  .game-layout{
    grid-template-columns:1fr;
  }

  .main-actions{
    grid-template-columns:1fr;
  }

  .auto-row{
    grid-template-columns:1fr;
  }

  .brand h1{
    font-size:23px;
  }
}