:root{
  --bg:#0f1115; --fg:#eaeef6; --muted:#9aa4b2;
  --card:rgba(20,24,31,.55); --border:rgba(255,255,255,.12);
  --accent:#ffd1dc;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box}
html,body{height:100%; overflow-x:hidden; margin:0; padding:0}
body{
  font:16px/1.45 system-ui,-apple-system,Segoe UI,Roboto,"PingFang SC","Noto Sans CJK","Microsoft YaHei",sans-serif;
  color:var(--fg);
  background:var(--bg);
  background-attachment:fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#bg{
  position:fixed; inset:0;
  background-size:cover; background-position:center;
  filter:brightness(.85) blur(0px);
  z-index:-2;
}

#app{position:relative; z-index:1; width:100%; min-height:100vh; padding-bottom:20px}

/* ========== 顶部栏 ========== */
.topbar{
  max-width:1100px; 
  margin:16px auto 10px; 
  padding:12px 16px;
  display:flex; 
  align-items:center; 
  gap:12px; 
  justify-content:space-between; 
  flex-wrap:wrap;
  background:rgba(0,0,0,0.03);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.topbar h1{
  margin:0; 
  font-size:22px; 
  letter-spacing:.5px; 
  white-space:nowrap;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 10px;
  font-size: 14px;
}

.user-name {
  color: var(--accent);
  font-weight: 500;
}

.bg-controls{
  display:flex; 
  gap:8px; 
  align-items:center; 
  flex-wrap:wrap;
}

.select{
  padding:10px 12px; 
  border-radius:10px; 
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(0,0,0,0.02); 
  color:var(--fg); 
  outline:none; 
  cursor:pointer;
  font-size:15px;
}

/* ========== 主布局 ========== */
.layout{
  max-width:1100px; 
  margin:0 auto; 
  padding:0 16px 20px;
  display:grid; 
  gap:16px;
  grid-template-columns:1fr;
}

/* ========== 卡片 ========== */
.card{
  background:rgba(0,0,0,0.03);
  border:1px solid rgba(255,255,255,0.08);
  border-radius:18px;
  box-shadow:0 4px 16px rgba(0,0,0,0.15);
  padding:16px;
  max-width:100%;
}

.wheel-card{
  background:rgba(0,0,0,0.02) !important;
}

/* ========== 转盘 ========== */
.wheel-wrap{
  position:relative;
  width:100%;
  max-width:480px;
  margin:0 auto 16px;
  aspect-ratio:1/1;
}

#wheel{
  width:100%; 
  height:100%; 
  display:block; 
  border-radius:50%;
  box-shadow:0 8px 24px rgba(0,0,0,.4);
  background:rgba(0,0,0,.05);
}

.pointer{
  position:absolute; 
  top:-12px; 
  left:50%; 
  transform:translateX(-50%);
  font-size:20px; 
  color:var(--accent);
  text-shadow:0 2px 6px rgba(0,0,0,.5);
  filter:drop-shadow(0 0 4px var(--accent));
}

.wheel-actions{
  display:flex; 
  gap:10px; 
  justify-content:center; 
  margin-top:12px; 
  flex-wrap:wrap;
}

.hint{
  color:var(--muted); 
  text-align:center; 
  margin:12px 0 0; 
  font-size:14px;
}

/* ========== 编辑器 ========== */
.editor h2{
  margin:4px 0 14px; 
  font-size:18px;
}

#list{
  display:flex; 
  flex-direction:column; 
  gap:10px; 
  margin-bottom:14px;
}

.row{
  display:grid; 
  gap:8px; 
  align-items:center;
  grid-template-columns:auto 1fr 100px 80px;
  padding:12px; 
  border:1px solid rgba(255,255,255,0.08);
  border-radius:12px;
  background:rgba(0,0,0,0.02);
}

.row .drag{
  cursor:grab; 
  color:var(--muted); 
  padding:0 4px; 
  user-select:none; 
  font-size:16px;
}

.row input{
  width:100%; 
  padding:10px 12px; 
  border-radius:10px; 
  outline:none;
  border:1px solid rgba(255,255,255,0.1);
  background:rgba(0,0,0,0.15); 
  color:var(--fg);
  font-size:15px;
}

.row input:focus{
  border-color:var(--accent);
  background:rgba(0,0,0,0.2);
}

.add-row{ 
  margin-top:0; 
  display:grid; 
  gap:8px; 
  grid-template-columns:1fr 100px 90px; 
}

/* ========== 按钮 ========== */
.btn{
  appearance:none; 
  border:none; 
  cursor:pointer;
  padding:11px 18px; 
  border-radius:12px; 
  font-weight:600;
  font-size:15px;
  background:var(--accent); 
  color:#0e1116; 
  box-shadow:0 4px 12px rgba(0,0,0,0.2);
  transition:all 0.2s ease;
  white-space:nowrap;
  text-align:center;
}

.btn:hover{ 
  transform:translateY(-1px); 
  box-shadow:0 6px 16px rgba(0,0,0,0.25);
}

.btn:active{ 
  transform:translateY(0);
}

.btn.secondary,
.btn.ghost{
  background:rgba(0,0,0,0.03); 
  color:var(--fg); 
  border:1px solid rgba(255,255,255,0.1);
}

.btn.primary{ 
  background:var(--accent); 
  color:#0e1116;
}

.btn.danger{ 
  background:#ff6b6b; 
  color:#fff;
}

.btn.mini {
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

/* ========== 通知提示 ========== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: 12px;
  background: rgba(0,0,0,0.9);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.toast.show {
  opacity: 1;
}

.toast.success {
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.toast.error {
  background: linear-gradient(135deg, #f093fb, #f5576c);
}

.toast.info {
  background: linear-gradient(135deg, #4facfe, #00f2fe);
}

/* ========== 加载遮罩 ========== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.loading-overlay.show {
  display: flex;
}

.loading-spinner {
  border: 4px solid rgba(255,255,255,0.2);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ========== 平板及以上 ========== */
@media (min-width:900px){ 
  .layout{
    grid-template-columns:1.05fr 1fr;
    padding:0 14px 20px;
  } 
}

/* ========== 手机端优化 ========== */
@media (max-width:600px){
  body{
    font-size:15px;
  }
  
  /* 顶部栏 */
  .topbar{ 
    margin:12px auto 8px;
    padding:10px 12px; 
    gap:8px;
  }
  
  .topbar h1{ 
    font-size:19px;
    width:100%;
    text-align:center;
  }
  
  .bg-controls{ 
    width:100%; 
    justify-content:center;
    gap:6px;
  }
  
  .bg-controls .select,
  .bg-controls .btn{
    flex:1;
    min-width:0;
    font-size:13px;
    padding:9px 10px;
  }
  
  /* 布局 */
  .layout{
    padding:0 12px 16px;
    gap:12px;
  }
  
  .card{ 
    padding:12px;
    border-radius:14px;
  }
  
  /* 转盘 */
  .wheel-wrap{
    max-width:min(90vw, 360px);
  }
  
  .wheel-actions{
    flex-direction:column;
    gap:8px;
  }
  
  .wheel-actions .btn{
    width:100%;
  }
  
  .hint{
    font-size:13px;
  }
  
  /* 编辑器 */
  .editor h2{
    font-size:17px;
    margin-bottom:12px;
  }
  
  /* 列表行 */
  .row{
    grid-template-columns:1fr 85px 65px;
    padding:10px;
    gap:6px;
  }
  
  .row .drag{
    display:none;
  }
  
  .row input{
    padding:9px 10px;
    font-size:14px;
  }
  
  /* 添加行 */
  .add-row{
    grid-template-columns:1fr;
    gap:8px;
  }
  
  .add-row input{
    padding:10px 12px;
    font-size:15px;
  }
  
  .add-row .btn{
    width:100%;
  }
  
  /* 按钮 */
  .btn{
    padding:10px 14px;
    font-size:14px;
  }
}
