Files
Zauberwald/src/styles/main.css
T
gurix f3cb948878 feat(04-02): global error handler + child-friendly error overlay
- Add error overlay HTML element in index.html before script tag
- Add window error + unhandledrejection listeners in main.ts
- Add error overlay CSS styles (fixed, z-index 9999, tree icon, reload button)
- Error message: "Oh, der Wald braucht kurz eine Pause..."
2026-03-29 18:16:34 +02:00

1050 lines
18 KiB
CSS

/* Zauberwald Design System */
:root {
/* Grundpalette — warm, einladend, Waldstimmung */
--bg-cream: #fff8f0;
--bg-forest: #e8f5e4;
--text-dark: #3d3225;
--text-warm: #5c4a3a;
--text-light: #8b7d6b;
--accent-green: #6db87d;
--accent-gold: #e8b84b;
--accent-pink: #e88bae;
--accent-purple: #9b7dc4;
--accent-blue: #7db8d4;
/* Fingerfarben — weiche Pastelltoene */
--finger-l-pinky: #e8b4c8;
--finger-l-ring: #c4a8d4;
--finger-l-mid: #a8c4e0;
--finger-l-index: #a8d8b8;
--finger-r-index: #d4d8a8;
--finger-r-mid: #e0c4a8;
--finger-r-ring: #d4a8a8;
--finger-r-pinky: #c8b4e8;
--finger-thumb: #d4cfc8;
}
/* Base styles */
body {
font-family: "Nunito", sans-serif;
background: var(--bg-cream);
color: var(--text-dark);
font-size: 16px;
margin: 0;
padding: 0;
}
h1,
h2,
h3 {
font-family: "Quicksand", sans-serif;
}
/* Screen management */
.screen {
display: none;
opacity: 0;
transition: opacity 0.3s ease;
}
.screen--active {
display: flex;
flex-direction: column;
align-items: center;
opacity: 1;
min-height: 100vh;
}
/* Welcome screen */
.welcome {
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem;
max-width: 600px;
margin: 0 auto;
}
.welcome h1 {
font-family: "Quicksand", sans-serif;
font-size: 2rem;
color: var(--text-dark);
}
.welcome__subtitle,
.welcome__layout-label {
font-size: 1.1rem;
color: var(--text-warm);
margin-bottom: 0.5rem;
}
.welcome__companions {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1rem;
width: 100%;
}
.companion-card {
background: white;
border: 3px solid transparent;
border-radius: 16px;
padding: 1.5rem;
cursor: pointer;
transition: border-color 0.2s;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
}
.companion-card:hover {
border-color: var(--accent-gold);
}
.companion-card--selected {
border-color: var(--accent-green);
background: var(--bg-forest);
}
.companion-card__avatar {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
margin-bottom: 0.5rem;
}
.companion-card__emoji {
font-size: 3rem;
}
.companion-card__name {
font-family: "Quicksand", sans-serif;
font-weight: 600;
font-size: 1.2rem;
color: var(--text-dark);
}
.welcome__layout-toggle {
display: flex;
gap: 0.5rem;
margin-top: 0.5rem;
}
.layout-btn {
padding: 0.5rem 1.5rem;
border-radius: 8px;
border: 2px solid var(--text-light);
background: white;
cursor: pointer;
font-family: "Nunito", sans-serif;
font-size: 1rem;
}
.layout-btn--active {
background: var(--accent-green);
color: white;
border-color: var(--accent-green);
}
.welcome__start-btn {
margin-top: 1.5rem;
padding: 1rem 3rem;
border-radius: 12px;
background: var(--accent-green);
color: white;
border: none;
font-family: "Quicksand", sans-serif;
font-weight: 700;
font-size: 1.3rem;
cursor: pointer;
opacity: 1;
transition: opacity 0.2s;
}
.welcome__start-btn:disabled {
opacity: 0.4;
cursor: not-allowed;
}
/* Forest screen */
.forest {
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem;
min-height: 100vh;
background: var(--bg-forest);
}
.forest__title {
font-family: "Quicksand", sans-serif;
font-size: 2rem;
color: var(--text-dark);
margin-bottom: 1.5rem;
}
.forest__level-map {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
max-width: 500px;
width: 100%;
margin-bottom: 2rem;
}
.level-card {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.3rem;
padding: 1rem;
border-radius: 12px;
border: 2px solid transparent;
font-family: "Nunito", sans-serif;
cursor: pointer;
transition:
transform 0.2s ease,
border-color 0.2s ease;
background: white;
}
.level-card:hover:not(:disabled) {
transform: scale(1.05);
}
.level-card--current {
border-color: var(--accent-gold);
background: #fff8e0;
box-shadow: 0 2px 8px rgba(232, 184, 75, 0.3);
}
.level-card--completed {
border-color: var(--accent-green);
background: #e8f5e4;
}
.level-card--locked {
opacity: 0.5;
cursor: not-allowed;
background: #f0f0f0;
}
.level-card__number {
font-weight: 700;
font-size: 0.9rem;
color: var(--text-dark);
}
.level-card__keys {
font-family: "Quicksand", sans-serif;
font-weight: 600;
font-size: 1.1rem;
color: var(--accent-purple);
}
.level-card__status {
font-size: 1.2rem;
}
.forest__continue-btn {
padding: 1rem 3rem;
border-radius: 12px;
background: var(--accent-green);
color: white;
border: none;
font-family: "Quicksand", sans-serif;
font-weight: 700;
font-size: 1.3rem;
cursor: pointer;
transition: transform 0.2s ease;
}
.forest__continue-btn:hover {
transform: scale(1.05);
}
.forest__continue-btn--done {
background: var(--accent-gold);
cursor: default;
}
.forest__continue-btn--done:hover {
transform: none;
}
/* Lesson screen */
.lesson {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 2rem;
padding: 2rem;
min-height: 100vh;
background: var(--bg-cream);
position: relative;
}
.lesson__back-btn {
position: absolute;
top: 1rem;
left: 1rem;
font-family: "Quicksand", sans-serif;
font-size: 1rem;
font-weight: 600;
color: var(--text-warm);
background: var(--bg-forest);
border: 2px solid var(--accent-green);
border-radius: 12px;
padding: 0.5rem 1rem;
cursor: pointer;
transition: background 0.2s ease, transform 0.1s ease;
}
.lesson__back-btn:hover {
background: var(--accent-green);
color: white;
transform: scale(1.05);
}
.lesson__letter-area {
display: flex;
align-items: center;
justify-content: center;
width: 200px;
height: 200px;
}
.falling-letter {
font-family: "Quicksand", sans-serif;
font-size: 5rem;
font-weight: 700;
color: var(--accent-green);
position: relative;
animation: leaf-fall 2.5s ease-in-out infinite;
}
@keyframes leaf-fall {
0% {
transform: translateY(-20px) translateX(0) rotate(0deg);
opacity: 0;
}
10% {
opacity: 1;
}
25% {
transform: translateY(25%) translateX(15px) rotate(5deg);
}
50% {
transform: translateY(50%) translateX(-10px) rotate(-3deg);
}
75% {
transform: translateY(75%) translateX(12px) rotate(4deg);
}
100% {
transform: translateY(100%) translateX(-5px) rotate(-2deg);
opacity: 0.8;
}
}
.falling-letter--dissolve {
animation: letter-dissolve 0.3s ease-out forwards;
}
.falling-letter--dissolve::before,
.falling-letter--dissolve::after {
content: '';
position: absolute;
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent-gold);
animation: stardust 0.6s ease-out forwards;
}
.falling-letter--dissolve::before {
top: 30%;
left: 20%;
animation-delay: 0s;
box-shadow:
12px -18px 0 var(--accent-gold),
-8px -24px 0 var(--accent-pink);
}
.falling-letter--dissolve::after {
top: 40%;
right: 20%;
background: var(--accent-pink);
animation-delay: 0.1s;
box-shadow:
-14px -20px 0 var(--accent-pink),
10px -16px 0 var(--accent-gold);
}
@keyframes stardust {
0% {
transform: scale(1) translate(0, 0);
opacity: 1;
}
100% {
transform: scale(0) translate(var(--dx, 20px), var(--dy, -30px));
opacity: 0;
}
}
@keyframes letter-dissolve {
0% {
transform: scale(1);
opacity: 1;
}
100% {
transform: scale(1.5);
opacity: 0;
}
}
/* Companion area (forest greeting + lesson avatar) */
.companion-area {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 1rem;
background: var(--bg-cream);
border-radius: 1rem;
margin-bottom: 1rem;
}
.companion-area__avatar {
width: 48px;
height: 48px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
animation: companion-float 3s ease-in-out infinite;
}
@keyframes companion-float {
0%, 100% {
transform: translateY(0);
}
50% {
transform: translateY(-8px);
}
}
.companion-area__text {
font-family: "Nunito", sans-serif;
font-size: 1rem;
color: var(--text-warm);
line-height: 1.4;
}
/* Forest Scene */
.forest__scene {
position: relative;
width: 100%;
max-width: 800px;
margin: 0 auto 1.5rem;
border-radius: 16px;
overflow: hidden;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.forest__bg {
display: block;
width: 100%;
height: auto;
}
.forest__grid {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(3, 1fr);
padding: 1rem;
gap: 0.5rem;
}
.forest__element {
display: flex;
align-items: center;
justify-content: center;
}
.forest__element img {
max-width: 100%;
max-height: 100%;
object-fit: cover;
border-radius: 50%;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
mask-image: radial-gradient(ellipse 70% 70% at center, black 50%, transparent 100%);
-webkit-mask-image: radial-gradient(ellipse 70% 70% at center, black 50%, transparent 100%);
}
.forest__element--new {
animation: forest-element-appear 1.2s ease-out forwards;
}
@keyframes forest-element-appear {
0% {
opacity: 0;
transform: scale(0.3);
}
60% {
opacity: 1;
transform: scale(1.05);
}
100% {
opacity: 1;
transform: scale(1);
}
}
/* Reward Screen */
.reward {
display: flex;
flex-direction: column;
align-items: center;
padding: 2rem;
max-width: 600px;
margin: 0 auto;
text-align: center;
}
.reward__title {
font-family: var(--font-heading);
color: var(--accent-gold);
font-size: 1.8rem;
margin-bottom: 1.5rem;
}
.reward__image-area {
width: 280px;
height: 280px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 1.5rem;
border-radius: 16px;
background: var(--bg-forest);
overflow: hidden;
}
.reward__image-area img {
max-width: 100%;
max-height: 100%;
object-fit: contain;
animation: reward-image-appear 0.8s ease-out;
}
@keyframes reward-image-appear {
from {
opacity: 0;
transform: scale(0.5);
}
to {
opacity: 1;
transform: scale(1);
}
}
.reward__placeholder {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
color: var(--text-warm);
font-family: var(--font-heading);
}
.reward__leaf {
font-size: 1.5rem;
animation: leaf-float 2s ease-in-out infinite;
}
.reward__leaf--1 {
animation-delay: 0s;
}
.reward__leaf--2 {
animation-delay: 0.5s;
}
.reward__leaf--3 {
animation-delay: 1s;
}
@keyframes leaf-float {
0%,
100% {
transform: translateY(0) rotate(0deg);
}
50% {
transform: translateY(-10px) rotate(15deg);
}
}
.reward__companion {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.5rem;
padding: 1rem;
background: rgba(255, 255, 255, 0.7);
border-radius: 12px;
}
.reward__actions {
display: flex;
gap: 1rem;
}
.reward__btn {
font-family: var(--font-heading);
font-size: 1.1rem;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 12px;
cursor: pointer;
transition: transform 0.2s;
}
.reward__btn:hover {
transform: scale(1.05);
}
.reward__btn--continue {
background: var(--accent-green);
color: white;
}
.reward__btn--back {
background: var(--bg-cream);
color: var(--text-warm);
border: 2px solid var(--accent-green);
}
/* Parent Area */
.parent {
max-width: 600px;
margin: 0 auto;
padding: 1.5rem;
}
.parent__back-btn {
background: none;
border: none;
font-family: var(--font-heading);
font-size: 1rem;
color: var(--text-warm);
cursor: pointer;
margin-bottom: 1rem;
}
.parent__title {
font-family: var(--font-heading);
color: var(--text-dark);
margin-bottom: 1.5rem;
}
.parent__gate {
text-align: center;
padding: 2rem;
font-family: var(--font-body);
}
.parent__code-input {
font-size: 2rem;
text-align: center;
width: 120px;
padding: 0.5rem;
border: 2px solid var(--accent-purple);
border-radius: 8px;
font-family: var(--font-heading);
letter-spacing: 0.5rem;
margin-top: 0.5rem;
}
.parent__gate-error {
color: var(--accent-pink);
margin-top: 0.5rem;
font-size: 0.9rem;
}
.parent__section {
margin-bottom: 2rem;
}
.parent__section h2 {
font-family: var(--font-heading);
color: var(--text-dark);
border-bottom: 2px solid var(--bg-forest);
padding-bottom: 0.5rem;
margin-bottom: 1rem;
}
.parent__stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 1rem;
margin-bottom: 1.5rem;
}
.parent__stat {
background: var(--bg-forest);
border-radius: 12px;
padding: 1rem;
text-align: center;
}
.parent__stat-label {
display: block;
font-family: var(--font-body);
font-size: 0.85rem;
color: var(--text-warm);
margin-bottom: 0.25rem;
}
.parent__stat-value {
display: block;
font-family: var(--font-heading);
font-size: 1.5rem;
font-weight: 700;
color: var(--text-dark);
}
.parent__calendar-dots {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: 0.5rem;
}
.parent__calendar-dot {
width: 12px;
height: 12px;
border-radius: 50%;
background: var(--accent-green);
}
.parent__calendar-dot--empty {
background: var(--bg-cream);
border: 1px solid var(--text-light);
}
.parent__errors h3,
.parent__calendar h3 {
font-family: var(--font-heading);
font-size: 1rem;
color: var(--text-warm);
margin-bottom: 0.5rem;
}
.parent__error-key {
display: inline-block;
background: var(--accent-pink);
color: white;
padding: 0.25rem 0.75rem;
border-radius: 8px;
margin: 0.25rem;
font-family: var(--font-heading);
font-size: 0.9rem;
}
.parent__settings {
display: flex;
flex-direction: column;
gap: 1rem;
}
.parent__setting {
display: flex;
align-items: center;
gap: 1rem;
}
.parent__setting label:first-child {
min-width: 120px;
font-family: var(--font-body);
color: var(--text-warm);
}
.parent__setting select,
.parent__input {
font-family: var(--font-body);
padding: 0.5rem;
border: 1px solid var(--text-light);
border-radius: 8px;
font-size: 0.95rem;
}
.parent__save-btn {
font-family: var(--font-heading);
padding: 0.5rem 1rem;
background: var(--accent-green);
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
}
.parent__saved-feedback {
color: var(--accent-green);
font-family: var(--font-body);
font-size: 0.85rem;
margin-left: 0.5rem;
opacity: 1;
transition: opacity 0.3s ease;
}
.parent__data-actions {
display: flex;
flex-direction: column;
gap: 0.75rem;
max-width: 300px;
}
.parent__action-btn {
font-family: "Quicksand", sans-serif;
font-size: 1rem;
padding: 0.6rem 1.2rem;
border: 2px solid var(--accent-green);
background: var(--bg-cream);
color: var(--text-dark);
border-radius: 8px;
cursor: pointer;
transition: background 0.2s;
}
.parent__action-btn:hover {
background: var(--bg-forest);
}
.parent__action-btn--danger {
border-color: #d46a6a;
color: #d46a6a;
}
.parent__action-btn--danger:hover {
background: #fde8e8;
}
.parent__data-info {
font-size: 0.9rem;
color: var(--accent-green);
margin-top: 0.5rem;
}
/* Keyboard */
.keyboard {
display: flex;
flex-direction: column;
align-items: center;
gap: 4px;
padding: 1rem;
background: rgba(255, 255, 255, 0.6);
border-radius: 12px;
user-select: none;
}
.keyboard__row {
display: flex;
gap: 4px;
}
.keyboard__key {
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
border-radius: 8px;
font-family: "Quicksand", sans-serif;
font-weight: 700;
font-size: 1rem;
color: var(--text-dark);
background: #e0e0e0;
transition:
transform 0.1s ease,
background-color 0.2s ease,
box-shadow 0.2s ease;
cursor: default;
}
.keyboard__key--space {
width: 280px;
}
.keyboard__key--inactive {
background: #e0e0e0;
color: var(--text-light);
opacity: 0.5;
}
.keyboard__key--active {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
/* Pulse animation for the target key (KYBD-03) */
.keyboard__key--highlight {
animation: key-pulse 1.2s ease-in-out infinite;
box-shadow: 0 0 12px rgba(232, 184, 75, 0.6);
}
@keyframes key-pulse {
0%,
100% {
transform: scale(1);
}
50% {
transform: scale(1.08);
}
}
/* Press animation (KYBD-03) */
.keyboard__key--pressed {
transform: scale(0.9) !important;
animation: none;
}
/* Lesson phase indicator */
.lesson__phase-indicator {
text-align: center;
font-family: var(--font-heading);
font-size: 1rem;
color: var(--text-warm);
margin-bottom: 0.5rem;
opacity: 0.7;
}
/* Word display for Woerter phase */
.word-display {
display: flex;
justify-content: center;
gap: 0.25rem;
font-family: var(--font-heading);
font-size: 2.5rem;
margin: 2rem 0;
}
.word-display__letter {
color: var(--text-light);
transition: color 0.3s;
}
.word-display__letter--active {
color: var(--accent-gold);
font-weight: 700;
}
.word-display__letter--done {
color: var(--accent-green);
}
/* Discover phase key pulse */
.keyboard__key--discover-pulse {
animation: discover-pulse 1.5s ease-in-out infinite;
}
@keyframes discover-pulse {
0%,
100% {
transform: scale(1);
box-shadow: 0 0 0 0 var(--accent-gold);
}
50% {
transform: scale(1.1);
box-shadow: 0 0 12px 4px var(--accent-gold);
}
}
/* Error overlay — kindgerechte Fehlermeldung */
.error-overlay {
position: fixed;
inset: 0;
background: rgba(255, 248, 240, 0.95);
z-index: 9999;
display: flex;
align-items: center;
justify-content: center;
}
.error-overlay__content {
text-align: center;
padding: 2rem;
}
.error-overlay__icon {
font-size: 4rem;
margin-bottom: 1rem;
}
.error-overlay__message {
font-family: "Quicksand", sans-serif;
font-size: 1.25rem;
color: var(--text-dark);
margin-bottom: 1.5rem;
}
.error-overlay__btn {
font-family: "Quicksand", sans-serif;
font-size: 1rem;
padding: 0.75rem 2rem;
background: var(--accent-green);
color: white;
border: none;
border-radius: 12px;
cursor: pointer;
}
/* Accessibility: respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
.falling-letter,
.companion-area__avatar,
.forest__element-img {
animation: none !important;
}
.falling-letter--dissolve::before,
.falling-letter--dissolve::after {
animation: none !important;
}
}
/* Responsive: small screens down to 700px */
@media (max-width: 700px) {
.keyboard__key {
min-width: 32px;
height: 32px;
font-size: clamp(10px, 2.5vw, 14px);
}
.keyboard__key--space {
min-width: 120px;
}
h1 {
font-size: clamp(20px, 5vw, 32px);
}
h2 {
font-size: clamp(18px, 4vw, 24px);
}
body {
font-size: clamp(14px, 3.5vw, 16px);
}
.welcome__companions {
grid-template-columns: repeat(2, 1fr);
}
.forest__grid {
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(4, 1fr);
}
.lesson__keyboard {
transform: scale(0.85);
transform-origin: top center;
}
}