:root{
  --bg:#fafafa;
  --text:#111;
  --muted:#666;
  --card:#fff;
  --line:#eaeaea;
  --brand1:#ff5e7e;
  --brand2:#ff2e55;
  --btn:#ff2e55;
  --btnText:#fff;
  --shadow:0 10px 30px rgba(0,0,0,.08);
}

body.dark{
  --bg:#141414;
  --text:#f2f2f2;
  --muted:#b8b8b8;
  --card:#1f1f1f;
  --line:#2a2a2a;
  --shadow:0 10px 30px rgba(0,0,0,.35);
}

*{box-sizing:border-box;}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  background:var(--bg);
  color:var(--text);
}

.header{
  position:sticky; top:0;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  background:linear-gradient(90deg,var(--brand1),var(--brand2));
  color:white;
  gap:12px;
}

.header-left{display:flex; align-items:center; gap:12px; min-width:0;}
.brand{font-weight:800; font-size:20px; white-space:nowrap;}
.menu{display:flex; gap:8px; flex-wrap:wrap;}
.tab{
  border:none;
  background:rgba(255,255,255,.18);
  color:white;
  padding:10px 14px;
  border-radius:999px;
  cursor:pointer;
}
.tab:hover{background:rgba(255,255,255,.28);}

.header-right{display:flex; align-items:center; gap:10px; flex-shrink:0;}
.auth-area{display:flex; gap:8px; align-items:center; flex-wrap:wrap;}

.pill{
  border:none;
  border-radius:999px;
  padding:10px 14px;
  cursor:pointer;
}
.pill.ghost{background:rgba(255,255,255,.18); color:white;}
.pill{background:white; color:#ff2e55; font-weight:700;}
.pill.danger{background:#111; color:white;}
.primary{
  border:none;
  background:var(--btn);
  color:var(--btnText);
  padding:12px 16px;
  border-radius:12px;
  cursor:pointer;
  font-weight:800;
}
.primary:disabled{opacity:.5; cursor:not-allowed;}

.wrap{max-width:980px; margin:0 auto; padding:22px 14px;}
.page{display:none;}
.page.active{display:block;}

.title{margin:6px 0 4px; font-size:34px;}
.sub{margin:0 0 18px; color:var(--muted);}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:16px;
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  overflow:hidden;
  box-shadow:var(--shadow);
}
.card.disabled{opacity:.6}
.card-img{width:100%; height:160px; object-fit:cover; display:block;}
.card-body{padding:14px;}
.card-body h3{margin:0 0 10px;}

.panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:18px;
  box-shadow:var(--shadow);
}
.panel-head{display:flex; align-items:flex-end; justify-content:space-between; gap:12px; flex-wrap:wrap;}
.muted{color:var(--muted);}
.small{font-size:12px;}

.progress{
  margin-top:10px;
  font-weight:800;
  color:var(--muted);
}
.question{
  font-size:26px;
  line-height:1.3;
  margin:14px 0;
  font-weight:900;
}
.answers{display:flex; gap:10px; justify-content:center; flex-wrap:wrap;}
.answers button{
  font-size:18px;
  padding:14px 18px;
  min-width:160px;
  border-radius:14px;
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text);
  cursor:pointer;
  font-weight:800;
}
.answers button:hover{border-color:rgba(255,46,85,.55)}

.bar{
  height:32px;
  background:#ddd;
  border-radius:999px;
  overflow:hidden;
  margin:10px auto 0;
}
body.dark .bar{background:#2b2b2b;}
.fill{
  height:100%;
  width:0%;
  background:linear-gradient(90deg,#ffd1dc,#ff2e55);
}
.percent{
  font-size:34px;
  font-weight:1000;
  margin-top:6px;
}
.actions{display:flex; gap:10px; justify-content:center; margin-top:14px; flex-wrap:wrap;}
.rank{margin-top:14px; text-align:left; max-width:520px; margin-left:auto; margin-right:auto;}
.rank .row{
  display:flex; justify-content:space-between;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  margin:8px 0;
  background:rgba(0,0,0,.02);
}
body.dark .rank .row{background:rgba(255,255,255,.04);}

.footer{
  margin-top:14px;
  padding:16px 0 0;
  text-align:center;
}
.contact{
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
  margin:10px 0 0;
}
.contact input{
  width:min(360px, 90vw);
  padding:12px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text);
}
.contact input::placeholder{color:var(--muted);}

/* 다크모드 스위치 */
.switch{
  position:relative;
  display:inline-block;
  width:52px;
  height:28px;
}
.switch input{display:none;}
.slider{
  position:absolute;
  inset:0;
  background:rgba(255,255,255,.25);
  border-radius:999px;
  cursor:pointer;
}
.slider:before{
  content:"";
  position:absolute;
  width:22px; height:22px;
  left:3px; top:3px;
  background:white;
  border-radius:50%;
  transition:.25s;
}
.switch input:checked + .slider:before{transform:translateX(24px);}

/* 모달 */
.modal{position:fixed; inset:0; display:flex; align-items:center; justify-content:center; z-index:999;}
.modal[hidden]{display:none;}
.modal-backdrop{position:absolute; inset:0; background:rgba(0,0,0,.45);}
.modal-card{
  position:relative;
  width:min(420px, 92vw);
  background:var(--card);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:18px;
  padding:16px;
  box-shadow:var(--shadow);
}
.field{display:flex; flex-direction:column; gap:6px; margin:10px 0;}
.field label{font-size:13px; color:var(--muted); font-weight:700;}
.field input{
  padding:12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--bg);
  color:var(--text);
}
.modal-actions{display:flex; gap:10px; justify-content:flex-end; margin-top:12px;}
