:root { --gold: #e3b34c; --red: #c8462b; --teal: #2e8b7a; --cream: #f3e9d2; --ink: #0a0f22; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; overflow: hidden; color: var(--cream);
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif; user-select: none; }
.serif { font-family: 'Gungsuh', '궁서', 'Batang', '바탕', 'Nanum Myeongjo', serif; }
#stage { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; overflow: hidden; cursor: none; }
#stage.cursor { cursor: default; }
#cv { position: absolute; left: 0; top: 0; }
.lbl { font-size: 19px; color: #c9bfa6; letter-spacing: 1px; }

/* 화면 전환 */
.screen, .layer { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .45s; }
.screen.on, .layer.on { opacity: 1; pointer-events: auto; }
.layer.on { pointer-events: none; }
.screen.dim { background: radial-gradient(ellipse at center, rgba(6,9,24,.80), rgba(3,5,14,.93)); }

/* 게임 중 정보: 상자 없이, 붓글씨·도장·단청 들보로 */
.cap { font-size: 19px; font-weight: 700; letter-spacing: 3px; color: #e6dcc0; text-shadow: 0 2px 5px rgba(0,0,0,.9); }
#hud b, #hud i { font-style: normal; }

#hudL { position: absolute; left: 38px; top: 30px; width: 370px; }
#hudL .stage { display: flex; align-items: center; gap: 16px; }
.stamp { width: 66px; height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: #c4382a; color: #fbeeda; border-radius: 7px 4px 8px 5px; transform: rotate(-5deg);
  box-shadow: inset 0 0 0 3px #c4382a, inset 0 0 0 5px rgba(251,238,218,.75), 0 3px 10px rgba(0,0,0,.55); }
.stamp b { font-size: 34px; font-weight: 700; }
.stamp i { font-size: 15px; margin-top: 2px; letter-spacing: 1px; }
.stageName { font-size: 42px; font-weight: 700; color: #fff3d6; letter-spacing: 3px; text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 18px rgba(0,0,0,.8); }
#hudL .presRow { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 16px; }
.presNum { color: #fff3d6; text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 16px rgba(0,0,0,.8); line-height: .9; font-variant-numeric: tabular-nums; }
.presNum b { font-size: 60px; font-weight: 700; }
.presNum i { font-size: 30px; margin-left: 3px; }
/* 단청을 칠한 들보 모양 */
.beam { display: flex; align-items: center; margin-top: 8px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.beam .end { position: relative; width: 20px; height: 26px; background: #27665a; box-shadow: inset 0 0 0 2px #1a463e; }
.beam .end::after { content: ''; position: absolute; left: 6px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: #e3b34c; }
.beam .track { position: relative; flex: 1; height: 18px; background: #23130d; box-shadow: inset 0 2px 0 rgba(0,0,0,.6), inset 0 -1px 0 rgba(255,255,255,.08); }
.beam .track i { display: block; height: 100%; width: 100%; transition: width .15s, background-color .4s; background-color: #3fa58f;
  background-image: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 45%, rgba(0,0,0,.25)); }
.beam .track::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 35px, rgba(0,0,0,.5) 35px 36px); }
#hudL[data-lv="mid"] .track i { background-color: #d7a233; }
#hudL[data-lv="low"] .track i { background-color: #cf4630; }
#hudL[data-lv="low"] .presNum { color: #ff9a80; }

#hudR { position: absolute; right: 40px; top: 26px; width: 150px; display: flex; flex-direction: column; align-items: center; }
.ring { position: relative; width: 128px; height: 128px; filter: drop-shadow(0 3px 8px rgba(0,0,0,.6)); }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .rt { stroke: rgba(255,255,255,.16); fill: rgba(6,10,26,.55); }
.ring .rf { stroke: #e3b34c; stroke-linecap: butt; stroke-dasharray: 314.16; stroke-dashoffset: 0; transition: stroke .3s; }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 60px; font-weight: 700; color: #fff3d6;
  font-variant-numeric: tabular-nums; text-shadow: 0 3px 0 rgba(0,0,0,.5); }
.ring b.sm { font-size: 44px; }
#hudR.low .rf { stroke: #ff5a3c; }
#hudR.low .ring b { color: #ff9a80; animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }
.ringCap { margin-top: 6px; }
.outRow { display: flex; align-items: center; gap: 8px; margin-top: 14px; white-space: nowrap; }
.outRow svg { width: 24px; height: 30px; filter: drop-shadow(0 0 6px rgba(255,120,30,.8)); }
.outRow b { font-size: 36px; font-weight: 700; color: #fff3d6; text-shadow: 0 3px 0 rgba(0,0,0,.5); font-variant-numeric: tabular-nums; }
.outRow .cap { font-size: 16px; letter-spacing: 1px; }

/* 한마디: 한지 쪽지에 먹으로 쓴 느낌 */
#coach { position: absolute; left: 36px; bottom: 34px; max-width: 620px; padding: 13px 30px 13px 50px; font-size: 27px; font-weight: 800; color: #2b1a10;
  opacity: 0; transform: rotate(-1.3deg) translateY(12px); transition: opacity .25s, transform .25s; filter: drop-shadow(0 6px 10px rgba(0,0,0,.55)); }
#coach::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, #f6edd4, #e4d5ae);
  clip-path: polygon(0 8%, 1.5% 0, 98.5% 4%, 100% 14%, 99.2% 92%, 97.5% 100%, 1.2% 96%, 0.3% 86%); }
#coach::before { content: ''; position: absolute; left: 18px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 4px 3px 5px 3px;
  background: #b98a2a; transform: rotate(9deg); }
#coach.on { opacity: 1; transform: rotate(-1.3deg); }
#coach.good::before { background: #2e8b7a; }
#coach.warn::before { background: #c4382a; }

/* 쓸기 세기: 물살이 점점 커지는 모양 */
#sweepBox { position: absolute; right: 42px; bottom: 34px; display: flex; align-items: flex-end; gap: 16px; transition: opacity .3s; }
#sweepBox > span { font-size: 34px; font-weight: 700; color: #fff3d6; letter-spacing: 3px; line-height: 1; text-shadow: 0 3px 0 rgba(0,0,0,.55), 0 0 16px rgba(0,0,0,.8); }
.segs { display: flex; align-items: flex-end; gap: 7px; filter: drop-shadow(0 3px 5px rgba(0,0,0,.6)); }
.segs i { display: block; width: 17px; background: rgba(255,255,255,.16); transform: skewX(-14deg); border-radius: 2px; }
.segs i:nth-child(1) { height: 16px; } .segs i:nth-child(2) { height: 22px; } .segs i:nth-child(3) { height: 28px; } .segs i:nth-child(4) { height: 34px; }
.segs i:nth-child(5) { height: 40px; } .segs i:nth-child(6) { height: 46px; } .segs i:nth-child(7) { height: 52px; }
#sweepBox[data-n="1"] i:nth-child(-n+1), #sweepBox[data-n="2"] i:nth-child(-n+2), #sweepBox[data-n="3"] i:nth-child(-n+3), #sweepBox[data-n="4"] i:nth-child(-n+4),
#sweepBox[data-n="5"] i:nth-child(-n+5), #sweepBox[data-n="6"] i:nth-child(-n+6), #sweepBox[data-n="7"] i:nth-child(-n+7) {
  background: linear-gradient(180deg, #eaf6ff, #5aa9f0); box-shadow: 0 0 10px rgba(110,180,255,.8); }

#banner { position: absolute; left: 0; right: 0; top: 96px; text-align: center; opacity: 0; transform: scale(.94);
  transition: opacity .3s, transform .3s; pointer-events: none; }
#banner.on { opacity: 1; transform: none; }
.bMain { font-size: 76px; font-weight: 700; color: #fff3d6; text-shadow: 0 0 26px rgba(255,140,40,.75), 0 4px 0 rgba(0,0,0,.6); }
.bSub { margin-top: 8px; font-size: 30px; font-weight: 700; color: var(--cream); text-shadow: 0 2px 6px #000; }
#count { position: absolute; left: 0; right: 0; top: 250px; text-align: center; font-size: 300px; line-height: 1; color: #fff3d6;
  text-shadow: 0 0 60px rgba(255,120,30,.9), 0 8px 0 rgba(0,0,0,.5); opacity: 0; pointer-events: none; }
#count.on { opacity: 1; }
#countCap { position: absolute; left: 0; right: 0; top: 150px; text-align: center; font-size: 40px; font-weight: 700; color: var(--cream);
  text-shadow: 0 3px 8px #000; opacity: 0; pointer-events: none; }
#countCap b { font-size: 64px; color: #ffb35c; margin-left: 10px; }
#countCap.on { opacity: 1; }
#count.pop { animation: pop .9s ease-out; }
@keyframes pop { 0% { transform: scale(1.5); opacity: 0; } 20% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9); opacity: .2; } }

/* 시작 화면 */
#title { background: linear-gradient(180deg, rgba(3,5,16,.82) 0, rgba(3,5,16,.35) 26%, rgba(3,5,16,0) 40%, rgba(3,5,16,0) 72%, rgba(3,5,16,.7) 100%); }
.tTop { position: absolute; left: 0; right: 0; top: 22px; text-align: center; }
.tSub { font-size: 24px; letter-spacing: 10px; color: var(--gold); }
#title h1 { margin: 2px 0 0; font-size: 128px; font-weight: 700; line-height: 1.1; letter-spacing: 8px; color: #fff6e0;
  text-shadow: 0 0 34px rgba(255,150,50,.55), 0 5px 0 rgba(0,0,0,.6); }
.tTag { margin-top: 2px; font-size: 25px; line-height: 1.5; color: #e9e0c8; text-shadow: 0 2px 6px #000; }
.tHint { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font-size: 22px; color: #d9cfb6; text-shadow: 0 2px 6px #000; }
.tHint b { color: var(--gold); }
.credit { position: absolute; right: 26px; bottom: 16px; font-size: 18px; color: rgba(243,233,210,.6); }

/* 겨누고 기다리면 눌리는 버튼 */
.dwell { --p: 0; position: absolute; width: 150px; height: 150px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--gold) calc(var(--p) * 1turn), rgba(255,255,255,.16) 0);
  box-shadow: 0 0 34px rgba(227,179,76,.45), 0 8px 26px rgba(0,0,0,.6); cursor: pointer; animation: breathe 1.6s ease-in-out infinite alternate; }
.dwell::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #d9523a, #8f2417); border: 2px solid rgba(255,235,200,.5); }
.dwell span { position: relative; font-size: 44px; font-weight: 700; color: #fff6e0; text-shadow: 0 2px 4px rgba(0,0,0,.5); text-align: center; line-height: 1.15; }
.dwell.small { width: 124px; height: 124px; }
.dwell.small span { font-size: 25px; font-weight: 800; }
@keyframes breathe { to { transform: scale(1.06); } }
#btnStart { left: 725px; top: 712px; }
#btnRetry { left: 738px; top: 756px; }
#btnGo { left: 725px; top: 712px; transition: opacity .4s; }
.dwell.wait { opacity: 0; pointer-events: none; animation: none; }
.dwell span.two { font-size: 36px; }
#hud.end #coach, #hud.end #sweepBox { opacity: 0 !important; }

/* 사용법 */
#brief h2 { position: absolute; left: 0; right: 0; top: 60px; margin: 0; text-align: center; font-size: 58px; color: #fff6e0; }
.cards { position: absolute; left: 92px; top: 176px; display: flex; gap: 24px; }
.card { position: relative; width: 336px; height: 430px; padding: 26px 20px; text-align: center; border-radius: 18px;
  background: linear-gradient(180deg, rgba(20,28,58,.92), rgba(10,15,34,.92)); border: 2px solid rgba(227,179,76,.28);
  opacity: .5; transform: scale(.96); transition: all .35s; }
.card.act { opacity: 1; transform: scale(1.03); border-color: var(--gold); box-shadow: 0 0 40px rgba(227,179,76,.35); }
.card.done { opacity: 1; transform: none; border-color: rgba(227,179,76,.55); }
.card .num { position: absolute; left: 16px; top: 14px; width: 46px; height: 46px; line-height: 46px; border-radius: 50%;
  background: var(--gold); color: #1a1206; font-size: 28px; font-weight: 800; }
.card svg { width: 170px; height: 170px; margin-top: 22px; }
.card h3 { margin: 12px 0 8px; font-size: 34px; color: #fff6e0; }
.card p { margin: 0; font-size: 23px; line-height: 1.5; color: #d9cfb6; }
.card p b, .note b { color: var(--gold); }
.note { position: absolute; left: 0; right: 0; top: 648px; text-align: center; font-size: 30px; font-weight: 700; }

/* 결과 */
.rPanel { position: absolute; left: 250px; top: 72px; width: 1100px; height: 660px; border-radius: 22px; padding: 40px 50px;
  background: linear-gradient(180deg, rgba(20,28,58,.95), rgba(9,13,30,.95)); border: 2px solid rgba(227,179,76,.6); box-shadow: 0 16px 60px rgba(0,0,0,.6); }
.seal { position: absolute; left: 54px; top: 44px; width: 190px; height: 190px; border-radius: 26px; border: 8px solid #d8442c; color: #d8442c;
  display: flex; align-items: center; justify-content: center; text-align: center; font-size: 50px; font-weight: 700; line-height: 1.1; white-space: nowrap;
  transform: rotate(-8deg); box-shadow: inset 0 0 0 4px rgba(216,68,44,.35); }
.seal.fail { border-color: #7d8394; color: #9aa0b0; box-shadow: none; }
#result.on .seal { animation: stamp .5s .25s both cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { from { transform: rotate(-8deg) scale(2.2); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }
.rHead { margin-left: 250px; height: 200px; }
.rKicker { font-size: 24px; letter-spacing: 6px; color: var(--gold); }
.rHead h2 { margin: 6px 0 10px; font-size: 62px; color: #fff6e0; white-space: nowrap; }
.rHead p { margin: 0; font-size: 27px; color: #e3d9c0; line-height: 1.45; }
.stats { display: flex; gap: 20px; margin-top: 18px; }
.stats > div { flex: 1; padding: 16px 20px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); }
.stats b { display: block; margin-top: 6px; font-size: 50px; line-height: 1.05; font-variant-numeric: tabular-nums; color: #fff6e0; }
.rBottom { display: flex; gap: 20px; margin-top: 20px; }
.rank, .tip { flex: 1; padding: 16px 22px; border-radius: 14px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); height: 196px; }
.rank ol { margin: 8px 0 0; padding: 0; list-style: none; font-size: 22px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.rank li { display: flex; justify-content: space-between; padding: 0 8px; border-radius: 6px; }
.rank li.me { background: rgba(227,179,76,.25); color: #fff6e0; font-weight: 800; }
.tip p { margin: 10px 0 0; font-size: 25px; line-height: 1.55; color: #f0e7cf; }

/* 조준점 */
.aim { --s: 0; position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; z-index: 20; }
.aim i { position: absolute; left: -30px; top: -30px; width: 60px; height: 60px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 0 12px rgba(120,190,255,.9), inset 0 0 10px rgba(120,190,255,.5); transform: scale(calc(1 + var(--s) * .9)); }
.aim::before, .aim::after { content: ''; position: absolute; background: #fff; box-shadow: 0 0 6px rgba(120,190,255,.9); }
.aim::before { left: -1.5px; top: -9px; width: 3px; height: 18px; }
.aim::after { left: -9px; top: -1.5px; width: 18px; height: 3px; }
.aim.p2 i { border-color: var(--gold); }
.aim.off { display: none; }

/* 진행자 설정 */
#gear { position: absolute; left: 10px; bottom: 6px; font-size: 20px; opacity: .22; cursor: pointer; z-index: 30; pointer-events: auto; }
#settings { position: absolute; right: 20px; top: 20px; width: 400px; padding: 18px 20px; border-radius: 14px; z-index: 40; display: none;
  background: rgba(8,12,28,.96); border: 1.5px solid rgba(227,179,76,.6); font-size: 18px; }
#settings.on { display: block; }
#settings h3 { margin: 0 0 10px; font-size: 22px; color: var(--gold); }
#settings button { display: block; width: 100%; margin: 6px 0; padding: 9px; font: inherit; color: #fff; background: #263043; border: 1px solid #44506a; border-radius: 8px; cursor: pointer; }
#settings button:hover { background: #32405a; }
#settings label { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
#settings input[type=range] { flex: 1; }
.sStat { margin: 4px 0 8px; font-size: 16px; color: #9fd9b8; min-height: 22px; }
.sKeys { margin: 8px 0 0; font-size: 15px; color: #9aa6bd; }
