body { margin: 0; min-height: 100vh; overflow: hidden; background: #1b1426; color: #f3e9d2; font-family: Georgia, serif; text-align: center; }

input, button { font-size: 1.2rem; padding: 10px 14px; border-radius: 8px; border: 2px solid #8a4fff; }
input { background: #2a2040; color: #fff; }
button { background: #ffcc66; color: #1b1426; cursor: pointer; margin-left: 8px; }
[hidden] { display: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; }
main { position: fixed; left: 0; right: 0; z-index: 1; pointer-events: none; }
main > * { pointer-events: auto; }
#intro { top: 14%; animation: fade 2s ease-out both; }
#game { top: 12px; text-shadow: 0 0 6px #000; }
#game h2, #game p { margin: 4px; }
@keyframes fade { from { opacity: 0; transform: translateY(-30px); } }
#title { --c: min(1.3vw, 11px); margin: 0 0 12px; font-size: 0; }
.pix-line { display: flex; justify-content: center; gap: calc(var(--c) * 3); margin-bottom: calc(var(--c) * 2); }
.pix-letter { display: grid; grid-template-columns: repeat(5, var(--c)); grid-auto-rows: var(--c); }
.pix-space { width: calc(var(--c) * 3); }
.pix-letter i { display: block; }
.pix-letter { gap: calc(var(--c) * 0.12); }
.pix-letter i.on { background: #4a4a4a; border: calc(var(--c) * 0.16) solid; border-color: #8a8a8a #1c1c1c #151515 #6a6a6a; box-shadow: inset 0 0 0 calc(var(--c) * 0.08) #333, calc(var(--c) * 0.2) calc(var(--c) * 0.3) 0 #000; animation: drop 0.48s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes drop { from { opacity: 0; transform: translateY(-120px) scale(1.5); } }
input, button { border-radius: 0; font-family: monospace; font-weight: bold; }
#intro p { margin: 8px 0; }
#characters { display: flex; justify-content: center; gap: 10px; }
.char { display: flex; flex-direction: column; align-items: center; margin: 0; padding: 6px 8px; background: #2a2040cc; color: #f3e9d2; border: 3px solid #4a3a6a; font-size: 0.8rem; }
.char canvas { width: 44px; height: 75px; image-rendering: pixelated; }
.char.sel { border-color: #ffcc66; background: #4a3a6acc; }
#step2 { display: none; }
#intro.step2 #step1 { display: none; }
#intro.step2 #step2 { display: block; }
#step2 button.play { margin-top: 12px; }

/* Minecraft-style blocky menu */
#intro p { font-family: monospace; font-weight: bold; font-size: 1.1rem; color: #fff; text-shadow: 3px 3px 0 #3a3a3a; letter-spacing: 1px; }
#intro input, #intro button.play, #pseudo-form button {
  font-size: 1rem; padding: 10px 16px; color: #fff; text-shadow: 2px 2px 0 #3a3a3a; cursor: pointer;
  border: 4px solid; border-color: #d0d0d0 #373737 #373737 #d0d0d0; outline: 3px solid #000;
  background: repeating-conic-gradient(#7d7d7d 0 25%, #747474 0 50%) 0 0 / 8px 8px;
}
#intro input { background: repeating-conic-gradient(#1c1c1c 0 25%, #151515 0 50%) 0 0 / 8px 8px; border-color: #373737 #d0d0d0 #d0d0d0 #373737; cursor: text; margin-right: 8px; }
#intro input::placeholder { color: #999; }
#intro button.play:hover, #pseudo-form button:hover { background: repeating-conic-gradient(#6f8f4a 0 25%, #668544 0 50%) 0 0 / 8px 8px; }
.char { border: 4px solid; border-color: #d0d0d0 #373737 #373737 #d0d0d0; outline: 3px solid #000; background: repeating-conic-gradient(#7d7d7d 0 25%, #747474 0 50%) 0 0 / 8px 8px; text-shadow: 2px 2px 0 #3a3a3a; cursor: pointer; }
.char:hover { background: repeating-conic-gradient(#8a8a8a 0 25%, #828282 0 50%) 0 0 / 8px 8px; }
.char.sel { border-color: #ffe9a8 #a8681a #a8681a #ffe9a8; outline-color: #ffcc66; background: repeating-conic-gradient(#6f8f4a 0 25%, #668544 0 50%) 0 0 / 8px 8px; }
#characters { gap: 14px; margin: 10px 0 8px; }

#tuto { position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%); min-width: 320px; max-width: 90vw; padding: 14px 20px; text-align: center; color: #fff; font-family: monospace; font-size: 1.05rem; font-weight: bold; text-shadow: 2px 2px 0 #3a3a3a; border: 4px solid; border-color: #d0d0d0 #373737 #373737 #d0d0d0; outline: 3px solid #000; background: repeating-conic-gradient(#5d5d5d 0 25%, #545454 0 50%) 0 0 / 8px 8px; transition: opacity 1s; }
#tuto[hidden] { display: none; }
#tuto.fade { opacity: 0; }
#tuto-step { display: block; color: #ffcc66; margin-bottom: 6px; }
#tuto kbd { display: inline-block; padding: 1px 8px; margin: 0 2px; background: #c6c6c6; color: #222; border: 3px solid; border-color: #fff #555 #555 #fff; text-shadow: none; }
#tuto-bar { height: 10px; margin-top: 10px; background: #222; border: 2px solid #000; }
#tuto-bar i { display: block; height: 100%; width: 0; background: #6fbf3a; transition: width 0.3s; }

#inventory { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
#inventory[hidden] { display: none; }
#inventory aside { position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 55vw); padding: 22px; display: flex; flex-direction: column; gap: 12px; overflow: auto; pointer-events: auto; color: #fff; font-family: monospace; font-weight: bold; text-shadow: 2px 2px 0 #3a3a3a; border-left: 6px solid #000; box-shadow: inset 4px 4px 0 #8a8a8a, inset -4px -4px 0 #2a2a2a; background: repeating-conic-gradient(#5d5d5df2 0 25%, #545454f2 0 50%) 0 0 / 8px 8px; }
#inventory h3 { margin: 0; color: #ffcc66; font-size: 1.8rem; text-shadow: 3px 3px 0 #000; }
#inventory h4 { margin: 10px 0 0; padding: 4px 8px; align-self: flex-start; color: #ffcc66; background: #2a2a2a; border: 3px solid; border-color: #1a1a1a #6a6a6a #6a6a6a #1a1a1a; text-shadow: 2px 2px 0 #000; }
#inventory em { color: #6fbf3a; font-style: normal; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.opts button { min-height: 56px; padding: 6px; font: inherit; font-size: 0.85rem; color: #fff; text-shadow: 2px 2px 0 #3a3a3a; cursor: pointer; border: 4px solid; border-color: #d0d0d0 #373737 #373737 #d0d0d0; outline: 2px solid #000; background: #7d7d7d; box-shadow: inset 0 -6px 0 rgba(0,0,0,.2); transition: transform 0.1s; }
.opts button:active { transform: translateY(2px); }
.opts button:hover { background: #8a8a8a; }
.opts button.sel { border-color: #ffe9a8 #a8681a #a8681a #ffe9a8; outline-color: #ffcc66; background: #668544; box-shadow: 0 0 14px #ffcc66, inset 0 -6px 0 rgba(0,0,0,.2); }
#inventory kbd { display: inline-block; padding: 1px 8px; background: #c6c6c6; color: #222; border: 3px solid; border-color: #fff #555 #555 #fff; text-shadow: none; }

#wave { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); padding: 6px 18px; color: #fff; font-family: monospace; font-weight: bold; font-size: 1.2rem; white-space: pre; text-shadow: 2px 2px 0 #3a3a3a; border: 4px solid; border-color: #d0d0d0 #373737 #373737 #d0d0d0; outline: 3px solid #000; background: repeating-conic-gradient(#5d5d5d 0 25%, #545454 0 50%) 0 0 / 8px 8px; }
#boss[hidden], #wave[hidden], #banner[hidden], #gameover[hidden], #more[hidden] { display: none; }
#banner { position: fixed; top: 28%; left: 50%; transform: translateX(-50%); color: #ffcc66; font-family: monospace; font-weight: bold; font-size: 3.2rem; text-shadow: 4px 4px 0 #000; opacity: 0; pointer-events: none; }
#banner.show { animation: ban 2.4s ease-out; }
@keyframes ban { 0% { opacity: 0; transform: translateX(-50%) scale(2); } 15% { opacity: 1; transform: translateX(-50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
#hearts { position: fixed; top: 52px; left: 16px; width: 200px; height: 26px; background: #2a0f0f; border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; }
#hearts b { display: block; height: 100%; width: 100%; background: #e03030; box-shadow: inset 0 4px 0 #ff8a8a, inset 0 -4px 0 #8a1010; transition: width 0.2s; }
#hearts span { position: absolute; inset: 0; text-align: center; line-height: 26px; color: #fff; font-family: monospace; font-weight: bold; text-shadow: 2px 2px 0 #000; }
body.ouch::after { content: ""; position: fixed; inset: 0; box-shadow: inset 0 0 120px 30px #e0202099; pointer-events: none; z-index: 4; }
#gameover, #more { position: fixed; inset: 0; margin: auto; width: 320px; height: fit-content; padding: 24px; text-align: center; color: #fff; font-family: monospace; z-index: 6; text-shadow: 2px 2px 0 #3a3a3a; border: 4px solid; border-color: #d0d0d0 #373737 #373737 #d0d0d0; outline: 3px solid #000; background: repeating-conic-gradient(#5d5d5d 0 25%, #545454 0 50%) 0 0 / 8px 8px; }
#gameover h3, #more h3 { margin: 0 0 8px; font-size: 2rem; color: #e03030; }
#retry, #more button { padding: 8px 18px; font: inherit; font-weight: bold; color: #fff; text-shadow: 2px 2px 0 #3a3a3a; cursor: pointer; border: 4px solid; border-color: #ffe9a8 #a8681a #a8681a #ffe9a8; outline: 2px solid #000; background: #668544; }
#ammo { position: fixed; top: 88px; left: 16px; padding: 4px 10px; color: #fff; font-family: monospace; font-weight: bold; text-shadow: 2px 2px 0 #000; border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; background: #3a3a3a; }
#ammo[hidden] { display: none; }
#ammo { display: flex; flex-wrap: wrap; gap: 4px; width: 200px; position: fixed; }
#ammo[hidden] { display: none; }
#ammo i { width: 14px; height: 22px; background: #333; border: 2px solid #000; }
#ammo i.pirate.on { background: #f0b83a; border-color: #ffe9a8 #8a5010 #8a5010 #ffe9a8; }
#ammo i.archer.on { background: #a8743a; border-color: #d9b080 #5a3a14 #5a3a14 #d9b080; }
#ammo i.archer { width: 10px; height: 26px; }
#ammo .reload { position: relative; width: 100%; height: 18px; background: #222; border: 2px solid #000; }
#ammo .reload b { display: block; height: 100%; background: #4aa3e0; }
#ammo .reload span { position: absolute; inset: 0; text-align: center; font-size: 0.75rem; line-height: 18px; }
#coins { position: fixed; top: 52px; right: 16px; padding: 4px 12px; color: #ffcc66; font-family: monospace; font-weight: bold; font-size: 1.1rem; text-shadow: 2px 2px 0 #000; border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; background: #3a3a3a; }
#inv-coins-row { color: #ffcc66; }
#inventory .opts#inv-tabs { grid-template-columns: repeat(2, 1fr); }
#inv-tabs button { min-height: 40px; }
#page-gear, #page-shop { display: flex; flex-direction: column; gap: 10px; }
#page-gear[hidden], #page-shop[hidden] { display: none; }
#page-shop .item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px; background: #3a3a3a; border: 3px solid; border-color: #1a1a1a #6a6a6a #6a6a6a #1a1a1a; }
#page-shop .item small { display: block; font-weight: normal; color: #ccc; font-size: 0.75rem; }
#page-shop .item.owned { background: #3a4a30; }
#page-shop button { padding: 6px 8px; font: inherit; font-size: 0.8rem; color: #fff; cursor: pointer; border: 3px solid; border-color: #ffe9a8 #a8681a #a8681a #ffe9a8; outline: 2px solid #000; background: #668544; white-space: nowrap; }
#page-shop button:disabled { border-color: #aaa #444 #444 #aaa; background: #666; color: #bbb; cursor: default; }
#stamina { position: fixed; top: 92px; right: 16px; width: 160px; height: 20px; background: #222; border: 4px solid; border-color: #111 #555 #555 #111; outline: 3px solid #000; }
#stamina b { display: block; height: 100%; width: 100%; background: #e8c23a; }
#stamina.tired b { background: #b05030; }
#stamina span { position: absolute; inset: 0; text-align: center; font: bold 0.7rem/20px monospace; color: #fff; text-shadow: 1px 1px 0 #000; }
#potions { position: fixed; top: 130px; right: 16px; padding: 4px 12px; color: #ff8a9a; font-family: monospace; font-weight: bold; font-size: 0.9rem; text-shadow: 2px 2px 0 #000; border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; background: #3a3a3a; }
#aim { position: fixed; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; pointer-events: none; z-index: 5; }
#aim::before, #aim::after { content: ""; position: absolute; background: #ff2a2a; box-shadow: 0 0 0 2px #000; }
#aim::before { left: 9px; top: 0; width: 4px; height: 22px; clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%, 0 65%, 100% 65%, 100% 100%, 0 100%); }
#aim::after { top: 9px; left: 0; height: 4px; width: 22px; clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 65% 0, 100% 0, 100% 100%, 65% 100%); }
#reset-all { margin: 10px 0 6px; padding: 6px 12px; font: bold 0.85rem monospace; color: #fff; background: #8a2a2a; border: 4px solid; border-color: #c05050 #4a1010 #4a1010 #c05050; outline: 3px solid #000; cursor: pointer; }
#reset-all:hover { background: #a83434; }
#aim.ice::before, #aim.ice::after { background: #60d0ff; }
#shield { position: fixed; top: 88px; left: 16px; padding: 4px 10px; color: #fff; font-family: monospace; font-weight: bold; font-size: 0.9rem; text-shadow: 2px 2px 0 #000; border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; background: #3a3a3a; }
#shield[hidden] { display: none; }
#shield { position: fixed; width: 200px; height: 18px; padding: 0; background: #222; }
#shield b { display: block; height: 100%; background: #4a7ae0; }
#shield span { position: absolute; inset: 0; text-align: center; font: bold 0.7rem/18px monospace; }
#aim.bow::before, #aim.bow::after { background: #8a5a2a; }
#aim.xbow::before, #aim.xbow::after { background: #f0d020; }
#aim.sword::before, #aim.sword::after { background: #ffffff; }
#aim.gun::before, #aim.gun::after { background: #111111; }
#aim.knight::before, #aim.knight::after { background: #9a9a9a; }
#aim.shield::before, #aim.shield::after { background: #3a7cff; }
#sound-row, .sound-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.sound-row input, #sound-row input { flex: 1; }
#char-info { min-height: 3em; margin: 6px 0; font-size: 0.95rem; color: #ffe9a8; text-shadow: 2px 2px 0 #000; }
#boss { position: fixed; top: 112px; left: 50%; transform: translateX(-50%); width: 360px; text-align: center; color: #fff; font-family: monospace; font-weight: bold; text-shadow: 2px 2px 0 #000; z-index: 5; font-size: 1.1rem; }
#boss div { height: 18px; margin-top: 4px; border: 3px solid #000; background: #2a0010; }
#boss-fill { display: block; height: 100%; width: 100%; background: #e03060; }

#top5 { margin-top: 18px; padding: 10px 16px; background: rgba(0,0,0,.55); border: 3px solid #8a8a8a; color: #fff; font-family: monospace; }
#top5 h3 { margin: 0 0 6px; color: #e8c040; font-size: 1.5rem; }
#top5 ol { margin: 0; padding-left: 22px; text-align: left; font-size: 1.3rem; }
#top5 li { margin: 4px 0; }
#ability { position: fixed; top: 168px; right: 16px; padding: 4px 12px; color: #ffd060; font-family: monospace; font-weight: bold; font-size: 0.9rem; text-shadow: 2px 2px 0 #000; border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; background: #3a3a3a; }
#aim.green::before, #aim.green::after { background: #30e050; }

#intro-music-row { display: block; margin-bottom: 0.8rem; cursor: pointer; }

#minimap { position: fixed; right: 16px; bottom: 16px; width: 150px; height: 150px; border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; background: #101018cc; z-index: 2; }
#bigmap { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #000a; color: #fff; font-family: monospace; text-shadow: 2px 2px 0 #000; }
#bigmap[hidden] { display: none; }
#bigmap canvas { width: min(80vh, 90vw); height: min(80vh, 90vw); border: 4px solid; border-color: #555 #111 #111 #555; outline: 3px solid #000; background: #101018; }

#portal { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: grid; place-items: center; overflow: hidden; background: radial-gradient(circle, #fff 0, #8ae0ff 15%, #3a30c0 45%, #0a0030 80%); animation: portal-in 1.1s ease-in forwards; }
#portal i { position: absolute; border-radius: 50%; border: 8px solid #9af; box-shadow: 0 0 40px #6cf, inset 0 0 40px #6cf; width: 30vmin; height: 60vmin; animation: portal-spin 1.2s linear infinite; }
#portal i:nth-child(2) { width: 50vmin; height: 90vmin; animation-duration: 1.8s; border-color: #c8f; }
#portal i:nth-child(3) { width: 80vmin; height: 130vmin; animation-duration: 2.4s; border-color: #6ff; }
#portal.out { animation: portal-out 1s ease-out forwards; }
@keyframes portal-in { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(80% at 50% 50%); } }
@keyframes portal-out { from { clip-path: circle(80% at 50% 50%); opacity: 1; } to { clip-path: circle(80% at 50% 50%); opacity: 0; } }
@keyframes portal-spin { to { transform: rotate(360deg) scale(1.1); } }
#top5 li canvas { height: 1.6rem; width: auto; image-rendering: pixelated; vertical-align: middle; margin-right: 8px; }
#portal.red { background: radial-gradient(circle, #fff 0, #ffb08a 15%, #c02a20 45%, #300000 80%); }
#portal.red i { border-color: #f66; box-shadow: 0 0 40px #f64, inset 0 0 40px #f64; }
#portal.red i:nth-child(2) { border-color: #f8a; }
#portal.red i:nth-child(3) { border-color: #fa6; }

#stepParty { display: none; }
#intro.stepP #stepParty { display: block; }
#intro.stepP #step1 { display: none; }
#stepParty button { margin: 6px 6px 0 0; }
#party-code { text-transform: uppercase; }
#party-full { color: #ff8080; font-weight: bold; }

#revive { position: absolute; top: 120px; left: 50%; transform: translateX(-50%); padding: 8px 16px; background: #2a2a40; border: 3px solid #40ffd0; color: #fff; font-weight: bold; }
#revive-hint { color: #40ffd0; font-weight: bold; }
