/* ===== 로또 번호 생성기 (웹) — KOBONG 검정·골드 테마 ===== */
:root {
  --bg: #0a0908;
  --panel: #13110e;
  --panel-2: #1a1713;
  --line: rgba(238, 195, 90, .16);
  --text: #f4efe4;
  --muted: #9d958a;
  --gold: #eec35a;
  --gold-light: #f7dc8c;
  /* 동행복권 공식 공 색상 */
  --ball-y: #fbc400;  /* 1–10 */
  --ball-b: #69c8f2;  /* 11–20 */
  --ball-r: #ff7272;  /* 21–30 */
  --ball-g: #aaaaaa;  /* 31–40 */
  --ball-gr: #b0d840; /* 41–45 */
  color-scheme: dark;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Pretendard", -apple-system, "Malgun Gothic", sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; word-break: keep-all; }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* 헤더 */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 4%; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { display: block; font-size: 1.05rem; }
.brand small { color: var(--gold); font-size: .72rem; letter-spacing: .15em; }
.mark { display: flex; }
.mark .b { width: 22px; height: 22px; margin-left: -6px; border: 2px solid var(--bg); }
.mark .b:first-child { margin-left: 0; }
.notice { color: var(--muted); font-size: .82rem; }

/* 레이아웃 */
.layout { display: grid; grid-template-columns: 330px minmax(0, 1fr) 280px; gap: 18px; padding: 24px 4% 40px; max-width: 1600px; margin: 0 auto; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
h2 { font-size: 1rem; display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
h2 span { color: var(--gold); font-size: .75rem; font-weight: 700; }
.bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
.bar h2 { margin: 0; }
.bar-actions { display: flex; gap: 8px; }

/* 버튼 */
.primary { width: 100%; margin-top: 14px; padding: 15px; border: 0; border-radius: 12px; font-weight: 800; font-size: 1.02rem; color: #120d05; background: linear-gradient(100deg, #f7dc8c, #eec35a 50%, #d49a36); box-shadow: 0 8px 28px rgba(238, 195, 90, .22); transition: transform .2s, box-shadow .2s; }
.primary:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(238, 195, 90, .35); }
.primary:active { transform: translateY(0); }
.ghost { background: transparent; color: var(--text); border: 1px solid rgba(244, 239, 228, .2); border-radius: 10px; padding: 8px 14px; font-size: .85rem; transition: border-color .2s, color .2s; }
.ghost:not(:disabled):hover { border-color: var(--gold); color: var(--gold); }
.ghost.small { padding: 6px 10px; font-size: .78rem; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row .ghost { flex: 1; }

/* 설정 */
.range-label { display: flex; justify-content: space-between; font-size: .9rem; }
output { color: var(--gold); font-weight: 700; }
input[type=range] { width: 100%; accent-color: var(--gold); margin: 10px 0 18px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: .78rem; color: var(--muted); margin-bottom: 12px; }
.legend p { width: 100%; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .arrow { opacity: .5; }
.chip { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(244, 239, 228, .3); display: inline-block; }
.chip.fix { background: var(--gold); border-color: var(--gold); }
.chip.ex { background: #3a3530; border-color: #3a3530; position: relative; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.num { aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(244, 239, 228, .14); background: var(--panel-2); color: var(--text); font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; transition: background .15s, border-color .15s, transform .15s; }
.num:hover { border-color: var(--gold); }
.num.fix { background: var(--gold); border-color: var(--gold); color: #120d05; transform: scale(1.06); }
.num.ex { background: #211e1a; color: #5a544c; text-decoration: line-through; border-color: transparent; }
.pick-info { margin-top: 12px; font-size: .82rem; color: var(--muted); }
.pick-info b { color: var(--gold); }
.help { margin-top: 12px; font-size: .75rem; color: var(--muted); line-height: 1.7; }

/* 공 */
.b { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-weight: 800; font-size: 1rem; color: #fff; font-style: normal; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums; flex: none;
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .7), transparent 38%), var(--c, var(--ball-g));
  box-shadow: inset -4px -6px 10px rgba(0, 0, 0, .22), 0 4px 10px rgba(0, 0, 0, .35); }
.b.y { --c: var(--ball-y); } .b.b2 { --c: var(--ball-b); } .b.r { --c: var(--ball-r); } .b.g { --c: var(--ball-g); } .b.gr { --c: var(--ball-gr); }
.b.fixed { outline: 2px solid var(--gold-light); outline-offset: 2px; }

/* 결과 */
.results { min-height: 520px; display: flex; flex-direction: column; }
.empty { flex: 1; display: grid; place-content: center; text-align: center; padding: 40px 10px; }
.empty-balls { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.empty-balls .b { width: 34px; height: 34px; animation: bob 2.4s ease-in-out infinite; }
.empty-balls .b:nth-child(2) { animation-delay: .2s; } .empty-balls .b:nth-child(3) { animation-delay: .4s; }
.empty-balls .b:nth-child(4) { animation-delay: .6s; } .empty-balls .b:nth-child(5) { animation-delay: .8s; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.empty h3 { font-size: 1.2rem; margin-bottom: 8px; }
.empty p { color: var(--muted); font-size: .9rem; }
.empty b { color: var(--gold); }
.games { list-style: none; display: grid; gap: 10px; flex: 1; align-content: start; }
.game { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid transparent; transition: border-color .2s; }
.game:hover { border-color: var(--line); }
.game-label { width: 26px; font-weight: 800; color: var(--gold); flex: none; }
.game-balls { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.game-balls .b { animation: pop .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { opacity: 0; transform: scale(.3) rotate(-90deg); } }
.game .ghost { flex: none; }
.rng { margin-top: 16px; font-size: .72rem; color: var(--muted); text-align: right; }

/* 보관함 */
.saved-list { list-style: none; display: grid; gap: 10px; max-height: 620px; overflow-y: auto; }
.saved-item { padding: 12px; border-radius: 12px; background: var(--panel-2); font-size: .82rem; }
.saved-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .75rem; margin-bottom: 8px; }
.saved-head button { background: none; border: 0; color: var(--muted); font-size: .75rem; }
.saved-head button:hover { color: #ff9b9b; }
.saved-line { display: flex; gap: 4px; margin-top: 4px; }
.saved-line .b { width: 24px; height: 24px; font-size: .68rem; }
.muted { color: var(--muted); font-size: .82rem; line-height: 1.7; }

/* 알림 */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #221e18; border: 1px solid var(--gold); color: var(--text); padding: 10px 18px; border-radius: 999px; font-size: .88rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 반응형 */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 320px minmax(0, 1fr); }
  .saved { grid-column: 1 / -1; }
  .saved-list { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); max-height: none; }
}
@media (max-width: 760px) {
  .top { flex-direction: column; align-items: flex-start; gap: 6px; }
  .layout { grid-template-columns: 1fr; padding: 16px 4% 32px; }
  .results { min-height: 0; }
  .b { width: 38px; height: 38px; font-size: .9rem; }
  .game { flex-wrap: wrap; gap: 10px; }
  .game-balls { gap: 6px; }
}
@media (max-width: 400px) {
  .b { width: 34px; height: 34px; font-size: .82rem; }
  .game-balls { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .game-balls .b { animation-duration: .01s; }
  .empty-balls .b { animation: none; }
}
