asanwari's picture
feat: add layered animated player sprite
ba3d37e
Raw
History Blame Contribute Delete
21.5 kB
:root {
color: #17202a;
background: #0f1720;
font-family: "Courier New", ui-monospace, monospace;
font-synthesis: none;
text-rendering: optimizeLegibility;
--game-max-width: 1120px;
--game-aspect: 1.5;
}
* { box-sizing: border-box; }
html, body, #app { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body { min-height: 100vh; overflow: hidden; display: grid; place-items: center; background: #0b1118; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
input, select {
width: 100%; min-height: 46px; padding: 0 12px;
border: 3px solid #17202a; border-radius: 4px; background: #fffdf4; color: #17202a;
}
input:focus, select:focus, button:focus-visible { outline: 4px solid #f6c945; outline-offset: 2px; }
h1, h2, p { margin: 0; letter-spacing: 0; }
h1 { font-size: clamp(2.5rem, 7vw, 5.5rem); line-height: .9; }
h2 { font-size: clamp(1.35rem, 3vw, 2.25rem); line-height: 1.08; }
p { line-height: 1.5; }
label { display: grid; gap: 7px; font-weight: 800; }
[hidden] { display: none !important; }
.game-app {
position: relative; width: min(100vw, var(--game-max-width), calc(100vh * var(--game-aspect)));
aspect-ratio: 3 / 2; max-height: 100vh; overflow: hidden; background: #101821;
box-shadow: 0 0 0 5px #17202a, 0 20px 60px rgb(0 0 0 / 45%);
}
.game-screen { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.eyebrow { color: #ef8354; font-size: .76rem; font-weight: 900; text-transform: uppercase; }
.button {
min-height: 46px; padding: 0 18px; border: 3px solid #17202a; border-radius: 4px;
font-weight: 900; box-shadow: 4px 4px 0 #17202a;
}
.button:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #17202a; }
.primary { background: #e54b4b; color: #fff; }
.secondary { background: #fffdf4; color: #17202a; }
.danger { background: #f04444; color: white; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.back-button {
position: absolute; z-index: 20; top: 18px; left: 18px; min-height: 42px; padding: 0 14px;
border: 3px solid #17202a; border-radius: 4px; background: #fffdf4; color: #17202a; font-weight: 900;
box-shadow: 4px 4px 0 rgb(23 32 42 / 35%);
}
.back-button.dark { background: #17202a; color: #fff; border-color: #fff; }
.status-line { min-height: 24px; color: #b83232; font-weight: 800; }
.feedback-line {
min-height: 24px; padding: 0; border: 0 solid transparent; border-radius: 5px;
color: inherit; font-weight: 900; transition: background-color .18s, border-color .18s, padding .18s;
}
.feedback-line[data-status="correct"] { padding: 11px 13px; border-width: 3px; border-color: #277a50; background: #dff4e8; color: #145535; }
.feedback-line[data-status="incorrect"], .feedback-line[data-status="error"] { padding: 11px 13px; border-width: 3px; border-color: #aa3f3f; background: #fae3df; color: #792828; }
/* Authentication is a complete screen, not a panel laid over the game. */
.auth-screen { display: grid; place-items: center; padding: 24px; background: #75c9c8; }
.auth-backdrop { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(#5eb6ca 0 62%, #5aa469 62%); }
.auth-backdrop::before {
content: ""; position: absolute; inset: 12% 0 auto; height: 34%;
background: repeating-linear-gradient(90deg, transparent 0 80px, rgb(255 255 255 / 12%) 80px 84px);
}
.school-silhouette {
position: absolute; left: 5%; bottom: 20%; width: 38%; height: 38%;
background: #e8b04b; border: 8px solid #17202a; box-shadow: 18px 18px 0 rgb(23 32 42 / 18%);
}
.school-silhouette::before {
content: ""; position: absolute; left: -8px; right: -8px; top: -70px; height: 70px;
background: #d85b4b; clip-path: polygon(50% 0, 100% 100%, 0 100%); border-bottom: 8px solid #17202a;
}
.school-silhouette::after {
content: ""; position: absolute; left: 40%; bottom: 0; width: 20%; height: 42%;
border: 6px solid #17202a; border-bottom: 0; background: #fff4c7;
}
.agent-beam { position: absolute; right: 6%; top: -20%; width: 30%; height: 120%; background: rgb(246 201 69 / 22%); transform: rotate(16deg); }
.auth-card {
position: relative; z-index: 2; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto;
display: grid; gap: 18px; padding: 24px; border: 5px solid #17202a; border-radius: 6px;
background: #fffdf4; box-shadow: 12px 12px 0 rgb(23 32 42 / 35%);
}
.auth-heading { display: grid; gap: 10px; }
.auth-heading h1 { font-size: clamp(2.4rem, 8vw, 4.4rem); color: #17202a; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tab { min-height: 42px; border: 3px solid #17202a; background: #fff; font-weight: 900; }
.tab.active { background: #17202a; color: #fff; }
.form-stack, .camera-tools { display: grid; gap: 12px; }
#cameraPreview, #cameraCanvas { width: 100%; border: 3px solid #17202a; background: #17202a; }
.appearance-fields { display: grid; grid-template-columns: 96px 1fr; gap: 9px 14px; margin: 0; padding: 12px; border: 3px solid #17202a; }
.appearance-fields legend { padding: 0 7px; font-weight: 900; }
.character-preview {
grid-row: 1 / span 3; align-self: center; width: 80px; height: 120px; margin: auto;
border: 3px solid #17202a; background: #b9ded5; image-rendering: pixelated;
}
.swatch-section { display: grid; gap: 4px; font-size: .75rem; font-weight: 900; }
.color-swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.color-swatches label { display: block; position: relative; }
.color-swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-swatches i { display: block; width: 25px; height: 25px; border: 3px solid #17202a; background: var(--swatch); cursor: pointer; }
.color-swatches input:checked + i { outline: 3px solid #f6c945; outline-offset: 2px; }
.color-swatches label span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* Onboarding */
.onboarding-screen { display: grid; grid-template-columns: minmax(220px, 38%) 1fr; align-items: end; padding: 5vh 8vw; background: #26354a; }
.onboarding-screen::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 5px, rgb(255 255 255 / 3%) 5px 6px); }
.grandma-portrait { position: relative; height: min(72vh, 650px); display: grid; place-items: center; }
.grandma-portrait img {
display: block; width: min(32vw, 360px); aspect-ratio: 1; object-fit: cover; border: 10px solid #f6c945;
border-radius: 50%; background: #e76f51;
box-shadow: 18px 18px 0 #17202a;
}
.dialogue-box { position: relative; z-index: 2; display: grid; gap: 14px; margin-bottom: 7vh; padding: 26px; border: 6px solid #17202a; background: #fffdf4; box-shadow: 10px 10px 0 #f6c945; }
/* World */
.world-screen { background: #6abb7b; }
.world-canvas, .world-canvas canvas { width: 100%; height: 100%; display: block; }
.world-hud {
position: absolute; z-index: 10; top: 16px; left: 16px; right: 16px; display: flex; gap: 12px; align-items: stretch;
pointer-events: none;
}
.world-hud > div { min-width: 170px; display: grid; gap: 3px; padding: 10px 14px; border: 4px solid #17202a; background: #fffdf4; box-shadow: 5px 5px 0 rgb(23 32 42 / 35%); }
.hud-label { color: #d1493f; font-size: .68rem; font-weight: 900; text-transform: uppercase; }
.icon-button { margin-left: auto; width: 48px; border: 4px solid #17202a; background: #e54b4b; color: #fff; font-weight: 900; pointer-events: auto; }
.world-prompt { position: absolute; z-index: 10; left: 50%; bottom: 22px; transform: translateX(-50%); min-width: min(520px, 80%); padding: 13px 18px; border: 4px solid #17202a; background: #fffdf4; text-align: center; font-weight: 900; box-shadow: 5px 5px 0 rgb(23 32 42 / 35%); }
.world-controls { position: absolute; z-index: 11; right: 18px; bottom: 18px; display: none; grid-template-columns: repeat(3, 54px); gap: 5px; }
.world-controls button { min-height: 48px; border: 3px solid #17202a; background: #fffdf4; color: #17202a; font-size: .65rem; font-weight: 900; touch-action: none; user-select: none; -webkit-user-select: none; }
.world-controls [data-move="up"] { grid-column: 2; }
.world-controls [data-move="left"] { grid-column: 1; }
.world-controls .interact { grid-column: 2; background: #f6c945; }
.world-controls [data-move="right"] { grid-column: 3; }
.world-controls [data-move="down"] { grid-column: 2; }
/* Shared scene titles */
.scene-title { position: absolute; z-index: 5; top: 24px; left: 50%; transform: translateX(-50%); text-align: center; }
.scene-title.light h2 { color: #fff; }
.scene-status { position: absolute; z-index: 8; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 10px 16px; border: 3px solid #17202a; background: #fffdf4; font-weight: 900; }
/* School uses a generated pixel-art background. */
.school-screen { background: #2b4a3f url("/game-static/assets/classroom-blank.png") center / cover no-repeat; image-rendering: pixelated; }
.school-screen::after { content: ""; position: absolute; inset: 0; background: rgb(7 18 16 / 10%); pointer-events: none; }
.school-board-ui {
position: absolute; z-index: 4; top: 14.5%; left: 28%; width: 52.5%; height: 42%;
display: block; overflow: hidden; padding: 16px 22px; color: #f9f3d1; text-shadow: 2px 2px 0 #102c25;
}
.school-board-ui input { border-color: #e9dfb5; background: rgb(255 253 244 / 95%); text-shadow: none; }
.topic-form, .lesson-reader { display: grid; gap: 14px; min-height: 100%; }
.topic-form { align-content: center; }
.lesson-reader { height: 100%; min-height: 0; align-content: start; overflow-y: auto; padding: 3px 8px 18px 2px; scrollbar-color: #f6c945 #173f34; overscroll-behavior: contain; }
.topic-form h2 { color: #fff8d7; }
.school-board-ui .eyebrow { color: #f6c945; }
.chalk, .chalk-secondary { border-color: #f3edcf; color: #fff; box-shadow: 4px 4px 0 #102c25; }
.chalk { background: #d6604d; }
.chalk-secondary { background: transparent; }
.lesson-reader > p { font-size: clamp(.92rem, 1.5vw, 1.15rem); color: #fff8d7; }
.chalk-note { padding-left: 14px; border-left: 4px solid #f6c945; font-style: italic; }
.board-heading { display: grid; gap: 6px; }
.board-heading span { color: #f6c945; font-weight: 900; }
.teacher-question { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.teacher-chat {
position: absolute; z-index: 8; right: 3%; bottom: 4%; width: min(27vw, 420px); max-height: 38%;
display: grid; grid-template-rows: auto minmax(80px, 1fr) auto; overflow: hidden;
padding: 14px 16px; border: 4px solid #17202a;
background: #fffdf4; color: #17202a !important;
text-shadow: none; font-weight: 900; box-shadow: 7px 7px 0 rgb(23 32 42 / 35%);
}
.teacher-chat::before {
content: ""; position: absolute; top: -18px; right: 24%; width: 26px; height: 26px;
border-left: 4px solid #17202a; border-top: 4px solid #17202a; background: #fffdf4; transform: rotate(45deg);
}
.teacher-chat-header { display: flex; justify-content: space-between; gap: 12px; align-items: start; padding-bottom: 8px; border-bottom: 2px solid #cbd1d2; }
.teacher-chat-header .dialog-close { position: static; flex: 0 0 38px; }
.teacher-chat-messages { min-height: 90px; overflow-y: auto; display: grid; align-content: start; gap: 9px; padding: 10px 3px; overscroll-behavior: contain; }
.chat-message { max-width: 90%; padding: 8px 10px; border: 2px solid #17202a; background: #f3ead2; font-size: .86rem; line-height: 1.4; }
.chat-message.student { justify-self: end; background: #cceae4; }
.chat-message.teacher { justify-self: start; }
.teacher-followup-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; padding-top: 8px; border-top: 2px solid #cbd1d2; }
.teacher-followup-form input { min-height: 40px; }
.teacher-followup-form .button { min-height: 40px; }
.quiz-button { background: #f6c945; color: #17202a; }
/* Home */
.home-screen { background: #3d291f url("/game-static/assets/bedroom-agent.png") center / cover no-repeat; image-rendering: pixelated; }
.home-screen::before { content: ""; position: absolute; inset: 0; background: rgb(7 12 18 / 8%); pointer-events: none; }
.bedroom-window { position: absolute; top: 16%; left: 12%; width: 25%; height: 30%; border: 10px solid #fff5dc; background: #243b64; box-shadow: 8px 8px 0 rgb(23 32 42 / 28%); }
.bedroom-window::before, .bedroom-window::after { content: ""; position: absolute; background: #fff5dc; }
.bedroom-window::before { left: 48%; top: 0; width: 8px; height: 100%; }
.bedroom-window::after { left: 0; top: 48%; width: 100%; height: 8px; }
.moon { position: absolute; right: 13%; top: 12%; width: 54px; aspect-ratio: 1; border-radius: 50%; background: #f6c945; box-shadow: 0 0 0 8px rgb(246 201 69 / 18%); }
.room-object { position: absolute; border: 6px solid #17202a; color: #17202a; font-weight: 900; box-shadow: 9px 9px 0 rgb(23 32 42 / 25%); }
.room-object span { position: absolute; left: 50%; bottom: -44px; transform: translateX(-50%); white-space: nowrap; padding: 7px 10px; border: 3px solid #17202a; background: #fffdf4; }
.bed-object { left: 8%; bottom: 12%; width: 32%; height: 22%; background: #e86b5b; }
.bed-object::before { content: ""; position: absolute; left: 4%; top: 8%; width: 30%; height: 38%; background: #fffdf4; border: 4px solid #17202a; }
.desk-object { right: 9%; bottom: 14%; width: 30%; height: 18%; background: #d99645; }
.desk-object::after { content: ""; position: absolute; left: 25%; top: -55%; width: 50%; height: 55%; background: #eef0d4; border: 5px solid #17202a; }
.phone-object { left: 50%; bottom: 29%; width: 90px; height: 140px; transform: translateX(-50%); background: #e54b4b; }
.phone-object::before { content: ""; position: absolute; inset: 12px 10px 48px; background: #8fe1d4; border: 4px solid #17202a; }
.room-dialog { position: absolute; z-index: 15; inset: 12% 15%; overflow: auto; padding: 28px; border: 6px solid #17202a; background: #fffdf4; box-shadow: 12px 12px 0 rgb(23 32 42 / 35%); }
.dialog-close { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border: 3px solid #17202a; background: #e54b4b; color: white; font-weight: 900; }
.practice-list { display: grid; gap: 12px; margin-top: 16px; }
.practice-item { padding: 12px; border: 3px solid #17202a; background: #f5edd3; }
.room-hotspot { position: absolute; z-index: 5; border: 4px solid transparent; border-radius: 12px; background: transparent; }
.room-hotspot span { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); white-space: nowrap; padding: 7px 10px; border: 3px solid #17202a; background: #fffdf4; color: #17202a; font-weight: 900; opacity: 0; transition: opacity .15s; }
.room-hotspot:hover, .room-hotspot:focus-visible { border-color: #f6c945; background: rgb(246 201 69 / 12%); outline: none; }
.room-hotspot:hover span, .room-hotspot:focus-visible span { opacity: 1; }
.bed-hotspot { left: 4%; bottom: 7%; width: 34%; height: 55%; }
.phone-hotspot { left: 41%; top: 42%; width: 13%; height: 26%; }
.desk-hotspot { right: 9%; top: 43%; width: 31%; height: 34%; }
.phone-dialog { display: grid; grid-template-columns: minmax(140px, 28%) 1fr; gap: 24px; align-items: center; }
.phone-dialog img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 7px solid #17202a; border-radius: 50%; box-shadow: 7px 7px 0 #f6c945; }
.phone-dialog > div { display: grid; gap: 12px; }
.comic-bubble { position: relative; padding: 20px; border: 4px solid #17202a; border-radius: 18px; background: #eaf8f5; font-family: "Comic Sans MS", "Courier New", monospace; font-weight: 800; }
.comic-bubble::before { content: ""; position: absolute; left: -17px; top: 45%; width: 26px; height: 26px; border-left: 4px solid #17202a; border-bottom: 4px solid #17202a; background: #eaf8f5; transform: rotate(45deg); }
/* Headquarters */
.hq-screen { background: radial-gradient(circle at 50% 60%, #34455c 0 22%, #17202a 22% 100%); }
.hq-screen::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 79px, rgb(246 201 69 / 6%) 79px 82px); }
.hq-console { position: absolute; z-index: 4; left: 50%; top: 52%; transform: translate(-50%, -50%); width: min(620px, 76vw); display: grid; gap: 15px; padding: 32px; border: 8px solid #0a1018; background: #33475e; color: #fff; box-shadow: 0 20px 0 #0a1018; }
.hq-console::before { content: ""; position: absolute; inset: 16px; border: 2px solid #6dc7c1; pointer-events: none; }
.hq-console > * { position: relative; z-index: 2; }
.hq-console p { color: #dce7eb; }
.hq-villain-image { justify-self: center; width: min(180px, 32%); aspect-ratio: 1; object-fit: cover; border: 5px solid #f6c945; border-radius: 8px; box-shadow: 7px 7px 0 #0a1018; }
.console-lights { display: flex; gap: 10px; }
.console-lights i { width: 14px; aspect-ratio: 1; background: #f6c945; border: 2px solid #17202a; }
.console-lights i:nth-child(2) { background: #e54b4b; }
.console-lights i:nth-child(3) { background: #64c79e; }
.grandma-chair { position: absolute; right: 5%; bottom: 0; width: 17%; height: 32%; border: 7px solid #0a1018; background: #8c4d66; }
/* Quiz and boss are separate screens, not overlays on the world. */
.answer-screen { padding: 7vh 7vw; overflow: auto; }
.quiz-screen { display: grid; place-items: center; background: #65b9a6; }
.notebook-page { width: min(900px, 100%); display: grid; gap: 16px; padding: 34px; border: 6px solid #17202a; background: repeating-linear-gradient(#fffdf4 0 38px, #c9d9df 39px 40px); box-shadow: 14px 14px 0 rgb(23 32 42 / 35%); }
.answer-surface { transition: background-color .18s, box-shadow .18s; }
.notebook-page[data-feedback="correct"] { box-shadow: inset 0 0 0 999px rgb(39 122 80 / 7%), 14px 14px 0 rgb(39 122 80 / 38%); }
.notebook-page[data-feedback="incorrect"], .notebook-page[data-feedback="error"] { box-shadow: inset 0 0 0 999px rgb(170 63 63 / 7%), 14px 14px 0 rgb(170 63 63 / 38%); }
.notebook-page header { min-height: 90px; display: grid; gap: 8px; }
.question-count { font-weight: 900; color: #42545b; }
.progress-track { width: 100%; height: 18px; overflow: hidden; border: 3px solid #17202a; background: #fffdf4; }
.progress-track span { display: block; width: 0; height: 100%; background: #f6c945; transition: width .2s ease; }
.notebook-page canvas, .battle-console canvas { width: 100%; border: 4px solid #17202a; background: rgb(255 253 244 / 85%); touch-action: none; }
.boss-screen { display: grid; grid-template-columns: 42% 1fr; gap: 5vw; align-items: center; background: #141a28; color: #fff; }
.boss-stage { min-height: 70vh; display: grid; place-items: center; align-content: center; gap: 24px; }
.boss-portrait { display: block; width: min(26vw, 330px); aspect-ratio: 1; object-fit: cover; border: 9px solid #f6c945; border-radius: 18px; background: #e54b4b; box-shadow: 16px 16px 0 #090d14; }
.boss-progress { width: min(330px, 80%); }
.boss-progress span { background: #e54b4b; }
.battle-header { text-align: center; display: grid; gap: 6px; }
.battle-console { display: grid; gap: 15px; padding: 28px; border: 6px solid #f3f0dd; background: #29364b; box-shadow: 12px 12px 0 #090d14; }
.battle-console[data-feedback="correct"] { background: linear-gradient(rgb(45 150 95 / 12%), rgb(45 150 95 / 12%)), #29364b; }
.battle-console[data-feedback="incorrect"], .battle-console[data-feedback="error"] { background: linear-gradient(rgb(220 65 65 / 12%), rgb(220 65 65 / 12%)), #29364b; }
.battle-console input { border-color: #f3f0dd; }
.answer-input-label, .answer-input-label input { position: relative; z-index: 3; pointer-events: auto; touch-action: manipulation; }
.locked { pointer-events: none; opacity: .65; }
.loading-curtain { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; align-content: center; gap: 18px; background: rgb(15 23 32 / 88%); color: #fff; font-weight: 900; }
.loader { width: 54px; aspect-ratio: 1; border: 8px solid #fff; border-right-color: #e54b4b; animation: spin .8s steps(8) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (pointer: coarse), (max-width: 800px) { .world-controls { display: grid; } .world-prompt { bottom: 190px; } }
@media (max-width: 900px) {
.game-app { width: min(100vw, calc(100vh * var(--game-aspect))); }
.school-board-ui { padding: 9px 12px; }
.lesson-reader { gap: 9px; }
.lesson-reader > p { font-size: .82rem; }
.school-board-ui .button { min-height: 38px; padding: 0 9px; font-size: .76rem; }
.teacher-question input { min-height: 38px; }
.scene-status { bottom: 9px; font-size: .72rem; }
}
@media (max-width: 760px) {
.auth-screen { padding: 10px; }
.auth-card { padding: 18px; }
.onboarding-screen { grid-template-columns: 1fr; align-content: center; }
.grandma-portrait { height: 35vh; }
.grandma-portrait img { width: min(44vw, 230px); }
.dialogue-box { margin: 0; }
.world-hud > div { min-width: 0; flex: 1; }
.world-hud > div:nth-child(2) { display: none; }
.school-board-ui { top: 14%; left: 24%; width: 58%; height: 44%; padding: 8px; background: rgb(19 65 51 / 90%); }
.teacher-chat { top: auto; right: 5%; bottom: 78px; width: 90%; max-height: 38%; }
.teacher-followup-form { grid-template-columns: 1fr; }
.teacher-question { grid-template-columns: 1fr; }
.room-dialog { inset: 10% 5%; }
.boss-screen { grid-template-columns: 1fr; gap: 18px; padding-top: 70px; }
.boss-stage { min-height: auto; }
.boss-portrait { width: 150px; }
.button-row { grid-template-columns: 1fr; }
}