:root{
  --bg: #090b14;
  --bg-2: #0d1120;
  --surface: #131728;
  --surface-2: #191f38;
  --line: #262c47;
  --text: #eef0f7;
  --muted: #838ba8;

  --hero-a: #e0344f;   /* 샘스파 */
  --hero-b: #2f66e0;   /* 어스파 */
  --hero-c: #d92d6b;   /* 톰스파 */
  --vil-a:  #3f9e46;   /* 그린 고블린 */
  --vil-b:  #29b6f0;   /* 일렉트로 */
  --vil-c:  #8a5cc4;   /* 닥터 옥터퍼스 */
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0; min-height:100%;
  background:
    radial-gradient(1200px 700px at 15% -10%, #14183a 0%, transparent 60%),
    radial-gradient(1000px 800px at 110% 10%, #1a1030 0%, transparent 55%),
    var(--bg);
  color:var(--text);
  font-family:'Space Grotesk', system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}

/* 배경 웹 라인 */
.web-bg{
  position:fixed; inset:0; z-index:0; pointer-events:none; opacity:.35;
}

.wrap{
  position:relative; z-index:1;
  max-width: 980px;
  margin: 0 auto;
  padding: 56px 24px 80px;
  min-height:100vh;
  display:flex; flex-direction:column; align-items:center;
}

.eyebrow{
  font-family:'JetBrains Mono', monospace;
  font-size:13px; letter-spacing:.18em; text-transform:uppercase;
  color:var(--muted);
  display:flex; align-items:center; gap:10px;
  margin-bottom:14px;
}
.eyebrow .dot{ width:6px;height:6px;border-radius:50%; background:var(--hero-a); box-shadow:0 0 12px var(--hero-a); }

h1{
  font-family:'Black Han Sans', sans-serif;
  font-weight:400;
  font-size: clamp(32px, 6vw, 56px);
  line-height:1.05;
  margin:0 0 8px;
  letter-spacing:.01em;
  background: linear-gradient(90deg, #fff 0%, #cfd6ff 55%, #9fb1ff 100%);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
h1 .accent{ color:var(--hero-a); -webkit-text-fill-color: var(--hero-a); }

.sub{
  color:var(--muted); font-size:15px; margin-bottom:44px; text-align:center;
  max-width:520px;
}

/* 팀 칩 */
.teams{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:12px;
  width:100%;
  margin-bottom:40px;
}
.faction-label{
  grid-column: 1 / -1;
  font-family:'JetBrains Mono', monospace;
  font-size:11px; letter-spacing:.14em; text-transform:uppercase;
  color:var(--muted);
  margin: 6px 0 -2px;
}
.faction-label.villain{ margin-top:10px; }

.chip{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px 14px 10px 20px;
  display:flex; align-items:center; gap:10px;
  min-width:0;
  text-align:left;
  font-weight:600;
  font-size:15px;
  position:relative;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.chip::before{
  content:'';
  position:absolute; left:0; top:0; bottom:0; width:4px;
  border-radius:14px 0 0 14px;
  background: var(--c);
}
.chip.picked{
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--c) 55%, var(--line));
  box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--c) 70%, transparent);
}
.chip-info{
  display:flex; flex-direction:column; min-width:0;
}
.chip-name{
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.chip .n{
  font-family:'JetBrains Mono', monospace;
  font-size:11px; color:var(--muted); display:block; margin-top:4px;
}

/* 게임 말(캐릭터 사진) 자리 — 1:1 정사각 */
.token{
  width:36px; height:36px; flex-shrink:0;
  border-radius:9px;
  background: color-mix(in srgb, var(--c) 16%, var(--surface-2));
  overflow:hidden;
}
.token img{
  width:100%; height:100%;
  object-fit:cover; object-position:center;
  display:block;
}
.row .token{ width:40px; height:40px; border-radius:10px; }

/* 버튼 */
.roll-btn{
  appearance:none; border:none; cursor:pointer;
  font-family:'Black Han Sans', sans-serif;
  font-size:20px; letter-spacing:.02em;
  color:#0a0c16;
  background: linear-gradient(135deg, #ffffff 0%, #cfd8ff 100%);
  padding:18px 44px;
  border-radius:100px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 14px 40px -12px rgba(90,120,255,.55);
  transition: transform .15s ease, box-shadow .15s ease;
}
.roll-btn:hover{ transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 18px 46px -10px rgba(90,120,255,.7); }
.roll-btn:active{ transform: translateY(0px) scale(.98); }
.roll-btn:disabled{ opacity:.5; cursor:default; transform:none; }

.roll-zone{
  display:flex; flex-direction:column; align-items:center; gap:16px;
  margin-bottom:48px;
}
.hint{ font-size:12px; color:var(--muted); font-family:'JetBrains Mono', monospace; }

/* 결과 */
.results{
  width:100%;
  display:flex; flex-direction:column; gap:10px;
  min-height: 40px;
}
.round-title{
  font-family:'Black Han Sans', sans-serif;
  font-weight:400;
  font-size: clamp(20px, 3.4vw, 28px);
  color: var(--text);
  margin: 0 0 16px;
  text-align:left;
  width:100%;
  display:flex; align-items:center; gap:10px;
}
.round-title::before{
  content:'';
  width:8px; height:8px; border-radius:50%;
  background: var(--hero-a);
  box-shadow:0 0 12px var(--hero-a);
  flex-shrink:0;
}
.placeholder{
  text-align:center; color:var(--muted); font-size:14px;
  border:1px dashed var(--line); border-radius:16px;
  padding:40px 20px;
}

.row{
  display:flex; align-items:center; gap:18px;
  background: var(--surface);
  border:1px solid var(--line);
  border-radius:16px;
  padding:16px 20px;
  opacity:0; transform: translateY(14px) scale(.98);
  animation: pop .5s cubic-bezier(.2,.8,.2,1) forwards;
}
.row .order{
  font-family:'JetBrains Mono', monospace;
  font-weight:700;
  font-size:22px;
  color: var(--muted);
  width:34px; flex-shrink:0;
}
.row .swatch{
  width:10px; height:36px; border-radius:6px; flex-shrink:0;
  background: var(--c);
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 65%, transparent);
}
.row .name{
  font-weight:700; font-size:19px; flex:1;
}
.row .faction{
  font-family:'JetBrains Mono', monospace;
  font-size:11px; letter-spacing:.1em; text-transform:uppercase;
  color: var(--c);
  border:1px solid color-mix(in srgb, var(--c) 45%, transparent);
  padding:4px 10px; border-radius:100px;
}

@keyframes pop{
  to{ opacity:1; transform:translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce){
  .row{ animation:none; opacity:1; transform:none; }
  .chip{ transition:none; }
}

@media (max-width: 640px){
  .teams{ grid-template-columns: repeat(3, 1fr); gap:8px; }
  .chip{ font-size:13px; padding:8px 8px 8px 16px; gap:8px; }
  .token{ width:30px; height:30px; }
  .row .token{ width:34px; height:34px; }
  .row .name{ font-size:16px; }
  .row .order{ font-size:18px; }
}

footer{
  color: var(--line);
  font-family:'JetBrains Mono', monospace;
  font-size:11px;
  margin-top: 40px;
}
