:root {
  --bg: #05060f;
  --ink: #eef3ff;
  --muted: #9aa6c8;
  --accent: #7fd3ff;
  --gold: #ffd866;
  --glass: rgba(14, 18, 40, 0.72);
  --line: rgba(160, 190, 255, 0.18);
  --kr: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --disp: "Black Han Sans", var(--kr);
  --num: "Orbitron", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--kr); overflow: hidden; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; cursor: crosshair; }
button { font: inherit; color: inherit; cursor: pointer; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 10px 16px; transition: transform 0.12s, background 0.2s, border-color 0.2s; }
button:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(200, 220, 255, 0.4); }
button:active { transform: scale(0.96); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { cursor: default; }

.back-btn {
  position: fixed; top: 14px; left: 14px; z-index: 30;
  font-size: 13px; color: var(--muted); text-decoration: none;
  padding: 8px 12px; border-radius: 10px; background: rgba(10, 12, 30, 0.55); border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.back-btn:hover { color: var(--ink); }

/* HUD */
.hud {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 8px 10px 8px 18px; border-radius: 16px;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 20, 0.45);
  max-width: calc(100vw - 240px);
}
.hud-hole { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.hud-hole span { font-family: var(--num); font-weight: 900; font-size: 15px; color: var(--accent); letter-spacing: 1px; }
.hud-hole strong { font-family: var(--disp); font-weight: 400; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-stats { display: flex; gap: 14px; }
.hud-stats div { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.hud-stats small { font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.hud-stats b { font-family: var(--num); font-size: 18px; }
.hud-stats .dust b, .hud-stats .dust small { color: var(--gold); }
.hud-stats .time b { color: #9effd8; min-width: 76px; text-align: center; }
.hud-hole em { font-style: normal; font-size: 11px; color: #ffd866; border: 1px solid rgba(255, 216, 102, 0.4); border-radius: 8px; padding: 2px 7px; white-space: nowrap; }
.hud-btns { display: flex; gap: 6px; }
.hud-btns button { width: 38px; height: 38px; padding: 0; border-radius: 11px; font-size: 15px; }
.hud-btns .pill { width: auto; padding: 0 12px; font-size: 13px; color: #ffc9a8; border-color: rgba(255, 170, 120, 0.35); }

.tip, .toast {
  position: fixed; left: 50%; z-index: 15; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: 14px; font-size: 14px; line-height: 1.5; text-align: center;
  background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px);
  transition: opacity 0.4s, transform 0.4s; max-width: min(560px, calc(100vw - 32px));
}
.tip { bottom: 22px; }
.tip.show { opacity: 1; transform: translate(-50%, 0); }
.toast { top: 74px; color: #ffd2b8; }
.toast.show { animation: toast 2.4s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -8px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }

/* 공통 화면 */
.screen { position: fixed; inset: 0; z-index: 25; overflow-y: auto; animation: fade 0.35s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.ghost { background: transparent; }
.cta {
  background: linear-gradient(135deg, #7fd3ff, #9f7bff); color: #0a0d24; border: none; font-weight: 800;
  box-shadow: 0 8px 24px rgba(127, 160, 255, 0.35);
}
.cta:hover { background: linear-gradient(135deg, #a4e1ff, #b79bff); }

/* 타이틀 */
.title { overflow-x: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; padding: 70px 20px 40px; background: radial-gradient(ellipse at center, rgba(5, 6, 20, 0.15), rgba(5, 6, 20, 0.6)); }
.logo { text-align: center; position: relative; }
.logo::before { content: ""; position: absolute; inset: -60px -120px; z-index: -1; background: radial-gradient(ellipse at center, rgba(4, 5, 16, 0.72), rgba(4, 5, 16, 0) 68%); }
.eyebrow { font-family: var(--num); font-size: 11px; letter-spacing: 4px; color: var(--muted); margin: 0 0 14px; }
.title h1 { margin: 0; line-height: 0.88; font-family: var(--num); font-weight: 900; display: flex; flex-direction: column; letter-spacing: 6px; }
.title h1 .g1 { font-size: clamp(44px, 11vw, 104px); background: linear-gradient(180deg, #ffffff, #a8c6ff 70%, #6d7bff); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 24px rgba(120, 160, 255, 0.55)); }
.title h1 .g2 { font-size: clamp(54px, 14vw, 132px); background: linear-gradient(180deg, #fff6c0, #ffd866 50%, #ff9f43); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 28px rgba(255, 190, 80, 0.5)); }
.kr { font-family: var(--disp); font-size: clamp(20px, 4.5vw, 30px); letter-spacing: 10px; margin: 16px 0 8px; }
.lead { color: var(--muted); margin: 0; font-size: 15px; }
.menu { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.menu .cta { font-size: 20px; padding: 16px 64px; border-radius: 18px; font-family: var(--disp); font-weight: 400; letter-spacing: 2px; }
.menu-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.menu-row button { min-width: 150px; font-family: var(--disp); font-size: 15px; }
.totals { display: flex; gap: 22px; font-family: var(--num); font-size: 15px; color: var(--gold); }
.totals span:last-child { color: #ffe9b0; }
.howto { color: var(--muted); font-size: 13px; text-align: center; margin: 0; max-width: 520px; line-height: 1.6; }

/* 홀 선택 */
.select { padding: 70px 24px 30px; background: rgba(5, 6, 18, 0.62); backdrop-filter: blur(3px); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.sel-head { width: min(980px, 100%); display: flex; align-items: center; gap: 18px; }
.sel-head h2 { margin: 0; font-family: var(--disp); font-weight: 400; font-size: 28px; color: var(--accent); }
.sel-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.wtabs { width: min(980px, 100%); display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.wtab { flex: 1 0 140px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left; padding: 10px 14px; }
.wtab .wn { grid-row: span 2; font-family: var(--num); font-weight: 900; font-size: 26px; color: var(--muted); align-self: center; }
.wtab .wl { font-family: var(--disp); font-size: 16px; }
.wtab .ws { font-family: var(--num); font-size: 11px; color: var(--gold); }
.wtab.on { border-color: var(--accent); background: rgba(127, 211, 255, 0.12); }
.wtab.on .wn { color: var(--accent); }
.wtab.locked { opacity: 0.45; }
.hgrid { width: min(980px, 100%); display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.hcard {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px 16px; text-align: left; border-radius: 16px;
  background: linear-gradient(160deg, rgba(40, 50, 100, 0.55), rgba(15, 18, 40, 0.75));
  position: relative; overflow: hidden; min-height: 132px;
}
.hcard::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, var(--accent), transparent 70%); opacity: 0.22; }
.hcard .mini { position: absolute; right: -6px; bottom: -4px; width: 62%; opacity: 0.5; pointer-events: none; -webkit-mask-image: radial-gradient(ellipse at 60% 55%, #000 45%, transparent 75%); mask-image: radial-gradient(ellipse at 60% 55%, #000 45%, transparent 75%); }
.hcard > span { position: relative; z-index: 1; }
.hcard:hover .mini { opacity: 0.85; }
.hcard .hn { font-family: var(--num); font-weight: 900; font-size: 22px; color: var(--accent); }
.hcard .hname { font-family: var(--disp); font-size: 17px; }
.hcard .hstars i { font-style: normal; color: rgba(255, 255, 255, 0.18); font-size: 18px; margin-right: 2px; }
.hcard .hstars i.got { color: var(--gold); text-shadow: 0 0 10px rgba(255, 200, 80, 0.6); }
.hcard .hmeta { font-size: 12px; color: var(--muted); }
.hcard .hdust i { font-style: normal; color: rgba(255, 255, 255, 0.2); margin-right: 3px; font-size: 13px; }
.hcard .hdust i.got { color: #ffe9a0; }
.hcard.locked { opacity: 0.4; }
.hcard.locked .hn { color: var(--muted); }
.hcard:not(.locked):hover { border-color: var(--accent); transform: translateY(-2px); }

/* 모달 */
.modal { display: grid; place-items: center; background: rgba(3, 4, 14, 0.55); backdrop-filter: blur(4px); padding: 20px; }
.panel {
  width: min(380px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 26px; border-radius: 22px;
  background: linear-gradient(170deg, rgba(30, 38, 84, 0.92), rgba(10, 12, 30, 0.94)); border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); text-align: center; animation: pop 0.35s cubic-bezier(.2, 1.4, .4, 1);
}
@keyframes pop { from { transform: scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
.panel h2 { margin: 0 0 4px; font-family: var(--disp); font-weight: 400; font-size: 30px; }
.panel .sub { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.result { width: min(420px, 100%); }
.rterm { font-size: 44px !important; color: #dfeaff; }
.rterm.gold { color: var(--gold); text-shadow: 0 0 24px rgba(255, 190, 60, 0.55); }
.rstars { display: flex; justify-content: center; gap: 10px; margin: 2px 0 8px; }
.rstars i { font-style: normal; font-size: 44px; color: rgba(255, 255, 255, 0.14); }
.rstars i.got { color: var(--gold); text-shadow: 0 0 18px rgba(255, 200, 80, 0.75); animation: star 0.5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes star { from { transform: scale(0) rotate(-90deg); } to { transform: none; } }
.rgrid { display: flex; justify-content: center; gap: 10px; }
.rgrid div { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 10px 6px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); }
.rgrid small { font-size: 11px; color: var(--muted); }
.rgrid b { font-family: var(--num); font-size: 22px; }
.rbest { color: var(--muted); font-size: 14px; margin: 6px 0; }
.rbest b { color: var(--ink); }
.rbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rbtns .cta { grid-column: span 2; padding: 14px; font-size: 17px; }
.rbtns.one { grid-template-columns: 1fr; }
.rbtns.one .cta { grid-column: auto; order: -1; }
.rcourse { margin: 0; font-size: 13px; color: #ffd866; }
.panel.wide { width: min(460px, 100%); }
.panel .desc { margin: 0 0 6px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.clist { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.clist li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); font-size: 14px; }
.clist li .no { font-family: var(--num); font-weight: 900; font-size: 13px; color: var(--accent); min-width: 34px; }
.clist li .nm { flex: 1; font-family: var(--disp); }
.clist li .pr { color: var(--muted); font-size: 12px; }
.clist li .sc { font-family: var(--num); font-size: 13px; min-width: 52px; text-align: right; }
.clist li .sc.good { color: var(--gold); }
.tlist { display: flex; flex-direction: column; gap: 8px; }
.tlist button { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; }
.tlist button .wn { font-family: var(--num); font-weight: 900; font-size: 22px; color: var(--accent); }
.tlist button .wl { flex: 1; font-family: var(--disp); font-size: 16px; }
.tlist button .wt { font-family: var(--num); font-size: 13px; color: #9effd8; }
.tlist button:disabled { opacity: 0.4; }

@media (max-width: 760px) {
  .hud { top: 60px; left: 10px; right: 10px; transform: none; max-width: none; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; }
  .hud-hole { flex-direction: column; gap: 2px; align-items: flex-start; }
  .hud-hole span { font-size: 12px; }
  .hud-hole strong { font-size: 15px; max-width: 30vw; }
  .hud-stats .time b { min-width: 64px; font-size: 14px; }
  .hud-hole em { font-size: 10px; padding: 1px 5px; }
  .hud-stats { gap: 10px; }
  .hud-stats b { font-size: 16px; }
  .hud-btns button { width: 34px; height: 34px; }
  .toast { top: 118px; }
  .tip { bottom: 14px; font-size: 13px; }
  .select { padding: 64px 14px 24px; }
  .sel-head h2 { font-size: 22px; }
  .hgrid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .hcard { min-height: 118px; padding: 12px; }
  .wtab { flex: 0 0 128px; }
}
.font-warm { position: fixed; left: -9999px; top: 0; font-family: var(--disp); opacity: 0; pointer-events: none; }
