@font-face { font-family: 'Cinzel'; src: url(fonts/cinzel-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Cinzel'; src: url(fonts/cinzel-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
:root { --gold: #d9c08a; --txt: #e8e0d0; --mut: #9a907e; --serif: 'Cinzel', 'Trajan Pro', Georgia, serif; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #060608; color: var(--txt); font-family: var(--serif); }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; }

/* ---- screens */
.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; z-index: 10; padding: 24px; }
.screen.on { display: flex; animation: fade .5s ease; }
@keyframes fade { from { opacity: 0 } }
.screen .bg { position: absolute; inset: 0; background: url(img/keyart.webp) center/cover; z-index: -1; }
.screen .bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.25), rgba(0,0,0,.85) 75%), linear-gradient(transparent 50%, rgba(0,0,0,.8)); }
#title .bg { opacity: .55; }
.panel { background: radial-gradient(ellipse at center, rgba(8,7,6,.78), rgba(0,0,0,.92)); }
.logo { text-align: center; margin-bottom: 4vh; }
.logo h1, .logo .h1 { font-size: clamp(34px, 7vw, 84px); font-weight: 400; letter-spacing: .12em; margin: 0; text-transform: uppercase; color: #f0e6d0; text-shadow: 0 0 30px rgba(0,0,0,.9), 0 2px 4px #000; }
.tag { margin: .4em 0 0; letter-spacing: .5em; text-transform: uppercase; color: var(--gold); font-size: clamp(11px, 1.6vw, 16px); }
.press { position: absolute; bottom: 14vh; letter-spacing: .35em; text-transform: uppercase; font-size: 15px; animation: blink 2.4s ease-in-out infinite; }
#press { cursor: pointer; }
@keyframes blink { 50% { opacity: .25 } }
h2 { font-weight: 400; letter-spacing: .25em; text-transform: uppercase; font-size: clamp(22px, 3.4vw, 34px); margin: 0 0 3vh; color: #f0e6d0; }

.menu { display: flex; flex-direction: column; align-items: stretch; min-width: min(420px, 90vw); gap: 2px; }
.mi { background: none; border: 0; padding: 10px 26px; text-align: center; letter-spacing: .18em; text-transform: uppercase; font-size: clamp(14px, 1.8vw, 18px); color: var(--mut); cursor: pointer; position: relative; transition: color .15s; display: flex; justify-content: center; gap: 14px; align-items: baseline; }
.mi.sel { color: #fff7e0; background: linear-gradient(90deg, transparent, rgba(217,192,138,.16), transparent); }
.mi.sel::before, .mi.sel::after { content: ''; position: absolute; left: 10%; right: 10%; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .6; }
.mi.sel::before { top: 0 } .mi.sel::after { bottom: 0 }
.mi small { font-size: 11px; letter-spacing: .1em; color: var(--gold); text-transform: none; }
.mi.back { margin-top: 14px; font-size: 14px; }
.mi.opt { justify-content: space-between; }
.mi.opt b { display: inline-block; min-width: 3ch; color: var(--txt); font-weight: 400; }
#level-list .mi { justify-content: flex-start; text-align: left; }
#level-list .num { width: 3ch; color: var(--gold); }
#level-list .nm { flex: 1; }
#level-list .bt { font-size: 12px; color: var(--gold); letter-spacing: .08em; }
.desc { max-width: 560px; text-align: center; color: var(--mut); font-family: Georgia, serif; font-size: 14px; line-height: 1.6; margin-top: 4vh; }
.support { position: absolute; bottom: 10px; left: 0; right: 0; text-align: center; font-size: 11px; letter-spacing: .1em; }
.support a { color: #6e665a; text-decoration: none; }
.support a:hover { color: var(--gold); }
body.embed .support, body.embed .desc { display: none; }

.ctl { border-collapse: collapse; font-family: Georgia, serif; font-size: 14px; max-width: 760px; }
.ctl th { font-family: var(--serif); font-weight: 400; color: var(--gold); letter-spacing: .1em; text-align: left; padding: 6px 14px; font-size: 13px; }
.ctl td { padding: 7px 14px; border-top: 1px solid rgba(217,192,138,.15); color: var(--txt); }
.ctl td:first-child { color: var(--mut); font-family: var(--serif); letter-spacing: .08em; }
.note { color: var(--mut); font-family: Georgia, serif; font-size: 13px; margin: 2.5vh 0 1vh; text-align: center; }
.stats { display: flex; gap: 40px; margin-bottom: 4vh; }
.stats div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stats span { color: var(--mut); letter-spacing: .2em; text-transform: uppercase; font-size: 12px; }
.stats b { font-size: 30px; font-weight: 400; }
.stats em { font-style: normal; color: var(--gold); font-size: 11px; letter-spacing: .1em; }

/* ---- online */
.mi.name { cursor: text; }
.mi.name input { font: inherit; letter-spacing: .08em; text-transform: none; width: 12ch; background: rgba(0,0,0,.4); border: 0; border-bottom: 1px solid rgba(217,192,138,.4); color: var(--txt); padding: 2px 6px; text-align: center; outline: none; }
.mi.name input:focus { border-bottom-color: var(--gold); }
.boards { display: flex; gap: 48px; margin-top: 1vh; }
.boards h3 { font-weight: 400; letter-spacing: .2em; text-transform: uppercase; font-size: 13px; color: var(--gold); margin: 0 0 8px; text-align: center; }
.boards ol { margin: 0; padding: 0; list-style: none; counter-reset: r; min-width: 230px; font-family: Georgia, serif; font-size: 14px; }
.boards li { counter-increment: r; display: flex; gap: 10px; padding: 4px 6px; border-top: 1px solid rgba(217,192,138,.12); }
.boards li::before { content: counter(r); width: 2ch; color: var(--mut); text-align: right; }
.boards li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boards li b { font-weight: 400; color: #f0e6d0; }
.boards li.me span { color: var(--gold); }
.boards li.empty::before { content: ''; } .boards li.empty { color: var(--mut); font-style: italic; }
#timer.low { color: #e06a50; font-size: 16px; }

/* ---- HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.bars { position: absolute; top: 26px; left: 30px; display: flex; flex-direction: column; gap: 6px; }
.bar { height: 9px; background: rgba(20,16,14,.75); border: 1px solid rgba(160,140,110,.45); position: relative; box-shadow: 0 0 6px rgba(0,0,0,.8); }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; transition: width .05s linear; }
.bar.hp { width: min(300px, 40vw); } .bar.hp i { background: linear-gradient(#a3221c, #6a1410); }
.bar.st { width: min(230px, 32vw); } .bar.st i { background: linear-gradient(#3f8a3a, #1f5a1d); } .bar.st i.lag { background: #c9b888; opacity: .55; }
.top { position: absolute; top: 22px; left: 0; right: 0; text-align: center; letter-spacing: .2em; text-transform: uppercase; font-size: 13px; text-shadow: 0 1px 3px #000; }
#timer { color: var(--mut); font-size: 12px; margin-top: 4px; }
.souls { position: absolute; right: 34px; bottom: 30px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.souls .box { min-width: 150px; padding: 6px 14px 6px 10px; background: linear-gradient(90deg, transparent, rgba(0,0,0,.75) 30%); display: flex; align-items: center; justify-content: flex-end; gap: 10px; font-size: 22px; text-shadow: 0 1px 3px #000; }
.souls .ico { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle, #fff 0, #c6d6ff 30%, rgba(120,150,255,0) 70%); box-shadow: 0 0 10px #9fb4ff; }
#souls-gain { font-size: 16px; color: #e8e0d0; opacity: 0; transition: opacity .3s; text-shadow: 0 1px 3px #000; }
#souls-gain.show { opacity: 1; }
#combo { position: absolute; left: 0; right: 0; bottom: 22vh; text-align: center; letter-spacing: .3em; text-transform: uppercase; font-size: 15px; color: var(--gold); opacity: 0; text-shadow: 0 0 12px #000; }
#combo b { font-size: 38px; font-weight: 400; color: #fff3d6; margin-right: 6px; }
#combo.pop { animation: pop 1.6s ease-out forwards; }
@keyframes pop { 0% { opacity: 0; transform: scale(1.35) } 10% { opacity: 1; transform: scale(1) } 70% { opacity: 1 } 100% { opacity: 0 } }
#hint { position: absolute; left: 30px; bottom: 30px; font-family: Georgia, serif; font-size: 12px; color: var(--mut); text-shadow: 0 1px 2px #000; }
kbd { font-family: var(--serif); font-size: 11px; color: var(--txt); border: 1px solid rgba(217,192,138,.35); padding: 1px 6px; border-radius: 3px; }

#banner { position: fixed; left: 0; right: 0; top: 34vh; text-align: center; pointer-events: none; opacity: 0; z-index: 6; }
#banner.show { animation: banner 3.8s ease forwards; }
#banner .area { font-size: clamp(26px, 4.6vw, 52px); letter-spacing: .1em; color: #f2ead8; text-shadow: 0 0 24px #000, 0 2px 4px #000; }
#banner .line { width: min(560px, 70vw); height: 1px; margin: 10px auto; background: linear-gradient(90deg, transparent, rgba(240,230,210,.8), transparent); }
#banner .sub { font-family: Georgia, serif; font-style: italic; color: var(--mut); font-size: 15px; }
@keyframes banner { 0% { opacity: 0; letter-spacing: .2em } 25% { opacity: 1 } 75% { opacity: 1 } 100% { opacity: 0; letter-spacing: .14em } }

#victory { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; z-index: 7; }
#victory::before { content: ''; position: absolute; left: 0; right: 0; height: 22vh; background: linear-gradient(transparent, rgba(0,0,0,.75) 30%, rgba(0,0,0,.75) 70%, transparent); }
#victory .txt { position: relative; font-size: clamp(30px, 6.5vw, 82px); letter-spacing: .06em; text-transform: uppercase; color: #e8c86a; text-shadow: 0 0 30px rgba(232,200,106,.45), 0 0 4px #000; }
#victory.show { animation: victory 4.2s ease forwards; }
#victory.show .txt { animation: vtxt 4.2s ease forwards; }
@keyframes victory { 0% { opacity: 0 } 15% { opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0 } }
@keyframes vtxt { 0% { transform: scale(1.0); filter: blur(6px) } 20% { filter: blur(0) } 100% { transform: scale(1.12) } }
.nojs { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; background: #060608; z-index: 50; }

@media (max-width: 640px) {
  .bars { top: 14px; left: 14px; } .souls { right: 14px; bottom: 14px; } #hint { display: none; }
  .stats { gap: 18px; } .boards { flex-direction: column; gap: 16px; } .ctl { font-size: 12px; } .ctl td, .ctl th { padding: 5px 6px; }
}
#online, #result, #versus, #lobby, #vresult { overflow-y: auto; justify-content: safe center; }
#vcode { width: 6ch; text-transform: uppercase; }
.note.small { font-size: 12px; opacity: .7; }
#standings { position: absolute; top: 18px; right: 22px; margin: 0; padding: 0; list-style: none; counter-reset: r; min-width: 170px;
  font-family: Georgia, serif; font-size: 13px; background: rgba(0,0,0,.35); border: 1px solid rgba(217,192,138,.15); }
#standings li { counter-increment: r; display: flex; gap: 8px; padding: 3px 8px; }
#standings li::before { content: counter(r); color: var(--mut); width: 1.5ch; }
#standings li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#standings li.me { background: rgba(217,192,138,.12); }
#standings li b { font-weight: 400; color: #f0e6d0; }
@media (max-width: 700px) { #standings { top: 64px; right: 8px; min-width: 130px; font-size: 12px; } }
#lobby-link { color: var(--mut); word-break: break-all; font-size: 12px; user-select: all; }
