* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #14110d; }
body { font-family: 'Jersey 15', 'Pixelify Sans', 'Courier New', monospace; font-weight: 500; font-size: 21px; line-height: 1.35; color: #2b2118; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

#dialog, #choices, #panel, .hpbox {
  background: #f4ecd8; border: 4px solid #2b2118; border-radius: 8px;
  box-shadow: inset 0 0 0 3px #b5522d, 0 4px 0 rgba(0, 0, 0, .35);
}
#dialog {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(760px, 94vw); min-height: 96px; padding: 14px 22px; cursor: pointer;
}
#dialog.sticky { display: block !important; }
#dialog-arrow { position: absolute; right: 16px; bottom: 8px; color: #b5522d; animation: bob .7s infinite alternate; }
@keyframes bob { to { transform: translateY(4px); } }

#choices {
  position: absolute; bottom: 126px; right: max(3vw, calc(50% - 380px));
  display: grid; gap: 4px 18px; padding: 12px 18px 12px 12px; z-index: 2;
}
body.battle #choices { bottom: 18px; }
.choice { padding: 3px 6px 3px 22px; position: relative; cursor: pointer; white-space: nowrap; }
.choice.sel::before { content: '▶'; position: absolute; left: 2px; color: #b5522d; }

#panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(640px, 94vw); padding: 20px 24px;
}
#panel h2 { font-size: 21px; margin: 0 0 8px; color: #b5522d; }
#panel h2:not(:first-child) { margin-top: 18px; }
#panel .line { display: flex; justify-content: space-between; gap: 12px; }
#panel .dim { opacity: .55; }
#panel .dex { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 14px; font-size: 17px; margin-bottom: 4px; }

#banner {
  position: absolute; top: 18px; left: 18px; padding: 10px 16px;
  background: #2b2118; color: #f4ecd8; border: 3px solid #b5522d; border-radius: 6px;
}

#hint { position: absolute; left: 12px; bottom: 2px; font-size: 13px; color: rgba(255, 255, 255, .55); text-shadow: 0 1px 0 #000; }

.hpbox { position: absolute; width: min(260px, 44vw); padding: 10px 14px; }
#hp-enemy { top: 26px; left: max(3vw, calc(50% - 380px)); }
#hp-player { bottom: 196px; right: max(3vw, calc(50% - 380px)); }
.hpbox .row { display: flex; justify-content: space-between; }
.bar, .xpbar { background: #4a4036; border-radius: 4px; overflow: hidden; }
.bar { height: 10px; margin-top: 4px; }
.bar i { display: block; height: 100%; width: 100%; background: #5cb85c; transition: width .4s; }
.bar i.mid { background: #e0b020; }
.bar i.low { background: #d04a3a; }
.hpnum { text-align: right; font-size: 17px; margin-top: 4px; }
.xpbar { height: 5px; margin-top: 2px; }
.xpbar i { display: block; height: 100%; background: #4a8fd0; transition: width .4s; }

#fade { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .3s linear; }

#title {
  position: fixed; inset: 0; display: grid; place-items: center; text-align: center; color: #f4ecd8;
  background: radial-gradient(ellipse at 50% 120%, #b5522d 0%, #5a2416 45%, #1a120d 100%);
}
#title h1 { font-size: clamp(40px, 10vw, 96px); margin: 18px 0 6px; letter-spacing: 6px; text-shadow: 6px 6px 0 #1a120d; }
.t-year { letter-spacing: 4px; color: #e6c25a; }
.t-sub { font-size: 26px; color: #e6c25a; }
.t-menu { margin-top: 48px; display: grid; gap: 10px; justify-items: center; }
.t-menu div { padding: 4px 18px; cursor: pointer; opacity: .6; }
.t-menu div.sel { opacity: 1; color: #e6c25a; }
.t-menu div.sel::before { content: '▶ '; }

#card {
  position: fixed; inset: 0; display: grid; place-items: center; text-align: center; color: #f4ecd8; cursor: pointer;
  padding: 8vw; animation: cardin .8s ease-out;
}
#card h2 { font-size: clamp(26px, 5vw, 44px); margin: 0 0 18px; color: #e6c25a; letter-spacing: 2px; }
#card p { font-size: clamp(18px, 2.6vw, 24px); max-width: 34em; margin: 0 auto; line-height: 1.6; }
#card span { display: block; margin-top: 30px; color: #b5522d; animation: bob .7s infinite alternate; }
@keyframes cardin { from { opacity: 0; } }
