/* 다트 룰렛 — 순수 CSS (stats/mood 디자인 토큰 차용) */

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

:root {
  --bg: #15171c;
  --bg-2: #1c1f26;
  --card: #21252e;
  --card-2: #2a2f3a;
  --border: #343a46;
  --text: #e9ebef;
  --muted: #98a1b0;
  --primary: #8b5cf6;
  --primary-2: #a274f4;
  --green: #2ecc71;
  --red: #e74c3c;
  --amber: #f1c40f;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans KR", sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}
body { display: flex; flex-direction: column; overflow: hidden; }
[hidden] { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
.muted { color: var(--muted); font-weight: 400; }

/* ===== 상단 바 ===== */
.topbar {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.brand { font-size: 18px; font-weight: 900; white-space: nowrap; }
.brand i { color: var(--red); margin-right: 4px; }
.hint {
  font-size: 13px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.streamer-switch { margin-left: auto; text-decoration: none; flex-shrink: 0; }

/* ===== 레이아웃 ===== */
.app {
  flex: 1; min-height: 0;
  display: flex; gap: 16px; padding: 16px;
}
.stage {
  flex: 1; min-width: 0; position: relative;
}
#wheel {
  display: block; width: 100%; height: 100%;
  touch-action: none; user-select: none; -webkit-user-select: none;
}

/* ===== 당첨 배너 ===== */
.banner {
  position: absolute; left: 50%; top: 16px;
  transform: translateX(-50%);
  max-width: 92%;
  background: rgba(28,31,38,.92);
  border: 3px solid var(--amber);
  border-radius: 18px;
  padding: 16px 34px 20px;
  box-shadow: 0 12px 44px rgba(0,0,0,.6);
  text-align: center;
  pointer-events: none; /* 캔버스 클릭 통과 — 단, 버튼만 pointer-events:auto */
  animation: pop .3s cubic-bezier(.2,1.5,.4,1);
}
.banner-label {
  font-size: 15px; font-weight: 700; color: var(--muted);
  letter-spacing: .22em;
}
.banner-label i { color: var(--red); }
.banner-win {
  font-size: clamp(40px, 9vw, 84px);
  font-weight: 900; line-height: 1.05;
  margin: 4px 0 12px;
  word-break: keep-all;
  text-shadow: 0 3px 22px rgba(0,0,0,.65);
  animation: winpulse 1.1s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center; gap: .28em;
}
.banner-heart { height: .92em; width: auto; max-height: 112px; flex-shrink: 0; }
.banner-again {
  pointer-events: auto;
  font-size: 15px; padding: 10px 24px;
}
@keyframes pop {
  from { transform: translateX(-50%) scale(.7); opacity: 0; }
  to   { transform: translateX(-50%) scale(1); opacity: 1; }
}
@keyframes winpulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

/* ===== 사이드바 ===== */
.sidebar {
  width: 312px; flex-shrink: 0;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  overflow: auto;
}
.side-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.side-title i { color: var(--primary); margin-right: 4px; }

.item-list { display: flex; flex-direction: column; gap: 6px; }
.item-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 8px;
}
.item-row .dot { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.item-row .num { width: 16px; text-align: center; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.item-row .lbl {
  flex: 1; min-width: 0;
  background: transparent; border: none; color: var(--text);
  font-size: 14px; padding: 2px 0;
}
.item-row .lbl:focus { outline: none; }
.wt { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.wbtn {
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card-2); color: var(--text);
  font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.wbtn:hover { background: #333a47; }
.wval { width: 20px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.pct {
  width: 46px; text-align: right; flex-shrink: 0;
  font-size: 12px; font-weight: 700; color: var(--primary-2);
  font-variant-numeric: tabular-nums;
}
.del {
  width: 22px; height: 22px; flex-shrink: 0;
  border: none; background: transparent; color: var(--muted);
  font-size: 13px; border-radius: 6px;
}
.del:hover { background: rgba(231,76,60,.15); color: var(--red); }

.add-row { display: flex; gap: 6px; margin-top: 12px; }
.add-row input {
  flex: 1; min-width: 0;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 10px; border-radius: 9px; font-size: 14px;
}
.add-row input:focus { outline: none; border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--card-2); color: var(--text);
  padding: 8px 14px; border-radius: 9px; font-size: 14px;
  transition: background .15s, transform .05s; white-space: nowrap;
}
.btn:hover { background: #333a47; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-2); }

/* 돌림판 우측 하단 마스코트 (위치/크기는 JS가 geo 기준으로 설정) */
.mascot {
  position: absolute;
  pointer-events: none; user-select: none; -webkit-user-select: none;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.45));
}

/* 마스코트 말풍선 (위치는 JS가 마스코트 기준으로 설정) */
.bubble {
  position: absolute;
  /* 현재 크기(15px)를 최소로, 화면(세로)이 커지면 함께 커지되 26px 상한 */
  font-size: clamp(15px, 1.7vh, 26px);
  max-width: 14em;
  background: #fff;
  color: #1c1f26;
  font-weight: 700; line-height: 1.35;
  padding: .65em .85em;
  border-radius: .9em;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  text-align: center;
  word-break: keep-all;
  pointer-events: none;
  transform-origin: bottom right;
  z-index: 5;
}
.bubble.win { background: #fff0f5; color: #c0306a; }
.bubble.show { animation: bubblePop .22s cubic-bezier(.2,1.5,.4,1); }
.bubble::after {
  content: "";
  position: absolute;
  right: 18px; bottom: -9px;
  border-width: 10px 8px 0 8px;
  border-style: solid;
  border-color: #fff transparent transparent transparent;
}
.bubble.win::after { border-top-color: #fff0f5; }
@keyframes bubblePop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.tip { margin-top: 14px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.tip i { font-size: 10px; }

/* ===== 토스트 ===== */
.toast {
  position: fixed; left: 50%; bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); }
.toast.success { border-color: var(--green); }

/* ===== 반응형 ===== */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .stage { flex: none; height: 56vh; }
  .sidebar { width: auto; max-height: 40vh; }
  .hint { display: none; }
}
