:root {
  --ink: #241813;
  --kraft: #d29b59;
  --kraft-light: #efc77f;
  --kraft-dark: #70421f;
  --paper: #fff2cf;
  --red: #b94338;
  --blue: #397db0;
  --gold: #f4bd38;
  --shadow: rgba(35, 19, 12, .42);
  font-family: "Trebuchet MS", "Arial Rounded MT Bold", system-ui, sans-serif;
  color: var(--ink);
  background: #241813;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { min-height: 100vh; overflow-x: hidden; background: #241813; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: #2a1a13;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: .1;
  mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(255,255,255,.32) 0.7px, transparent .7px), radial-gradient(rgba(0,0,0,.28) .6px, transparent .6px);
  background-position: 0 0, 12px 8px;
  background-size: 19px 19px, 27px 27px;
}

.login-screen, .teacher-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at 50% 18%, #6f4b31 0, #352219 43%, #1e120e 100%);
}

.login-screen { position: relative; overflow: hidden; isolation: isolate; background: #302015; }
.login-world-background { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; filter: saturate(.92) brightness(.82); }
.login-world-shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(90deg, rgba(28,14,9,.72) 0%, rgba(28,14,9,.34) 42%, rgba(28,14,9,.5) 100%), radial-gradient(circle at 50% 48%, transparent 0 25%, rgba(18,8,5,.32) 100%); }
.login-world-glow { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(circle at 50% 53%, rgba(255,219,112,.16), transparent 34%); mix-blend-mode: screen; animation: breathe 8s ease-in-out infinite; }
.login-screen .grain { z-index: 5; }
.login-screen .login-wrap { position: relative; z-index: 2; }
.login-intro { min-height: 520px; padding: 44px 38px; display: flex; flex-direction: column; justify-content: space-between; color: #fff4d1; filter: drop-shadow(0 8px 10px rgba(0,0,0,.25)); }
.login-intro h1 { margin: 4px 0 12px; font-size: clamp(3.7rem, 8vw, 7rem); line-height: .82; letter-spacing: -.08em; color: #fff3ce; text-shadow: 5px 5px 0 #3b2015, 8px 9px 0 rgba(0,0,0,.28); }
.login-intro p { max-width: 430px; margin: 0; font-size: 1.2rem; line-height: 1.4; font-weight: 800; text-shadow: 2px 2px 0 #3b2015; }
.login-kicker { color: #f6cb54; font-size: 1.25rem; font-weight: 1000; text-transform: uppercase; letter-spacing: .12em; text-shadow: 2px 2px 0 #3b2015; }
.login-intro-note { width: fit-content; padding: 12px 16px; border: 3px solid var(--ink); background: rgba(255,239,196,.92); color: var(--ink); box-shadow: 0 5px 0 rgba(49,23,11,.7); clip-path: polygon(2% 7%, 98% 0, 100% 91%, 0 100%); transform: rotate(-1deg); }
.login-intro-note small { opacity: .72; }
.login-screen .login-card { background: rgba(255,244,211,.96); backdrop-filter: blur(5px); }

.login-wrap { width: min(980px, 100%); display: grid; grid-template-columns: 1.05fr .95fr; gap: 24px; align-items: stretch; }
.brand-card, .login-card, .teacher-card {
  position: relative;
  border: 4px solid var(--ink);
  box-shadow: 0 14px 0 rgba(0,0,0,.22), 0 18px 32px rgba(0,0,0,.24);
  background: var(--paper);
  clip-path: polygon(1% 2%, 98% 0, 100% 97%, 2% 100%);
}
.brand-card { min-height: 520px; padding: 48px 42px; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(135deg, #c88a4a, #f4cd82 44%, #bb753d); }
.brand-card h1 { margin: 0; font-size: clamp(3.2rem, 8vw, 6.7rem); line-height: .84; letter-spacing: -.08em; text-shadow: 4px 4px 0 #f5d38e; }
.brand-card p { max-width: 390px; font-size: 1.25rem; line-height: 1.4; font-weight: 800; }
.paper-star { color: var(--gold); text-shadow: 2px 2px 0 var(--ink); font-size: 3.4rem; transform: rotate(-11deg); align-self: flex-end; }
.login-card { padding: 28px; }
.login-card h2, .teacher-card h2 { margin: 4px 0 8px; font-size: 2rem; }
.login-card p { margin-top: 0; opacity: .76; }
.role-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0; }
.toggle-button, .wood-button, .soft-button, .room-arrow, .close-button {
  border: 3px solid var(--ink);
  color: var(--ink);
  background: var(--kraft-light);
  box-shadow: 0 4px 0 var(--kraft-dark);
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
.toggle-button { padding: 11px 9px; font-weight: 900; background: #e6d5aa; }
.toggle-button.active { background: var(--gold); transform: translateY(-2px); }
.wood-button, .soft-button { padding: 12px 18px; font-weight: 900; }
.wood-button.primary { background: var(--red); color: #fff6dc; }
.wood-button.blue { background: var(--blue); color: #fff6dc; }
.soft-button { background: #f7e5bb; box-shadow: 0 3px 0 #9e7447; }
.toggle-button:hover, .wood-button:hover, .soft-button:hover, .room-arrow:hover, .close-button:hover { transform: translateY(-2px) rotate(-.4deg); filter: brightness(1.05); }
.toggle-button:active, .wood-button:active, .soft-button:active, .room-arrow:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--kraft-dark); }
.form-stack { display: grid; gap: 12px; }
.form-stack label { display: grid; gap: 5px; font-weight: 900; }
.form-stack input, .profile-form input { width: 100%; border: 3px solid var(--ink); background: #fff9e8; padding: 11px 12px; outline: none; }
.form-stack input:focus, .profile-form input:focus { box-shadow: 0 0 0 4px rgba(244,189,56,.45); }
.form-error { min-height: 20px; color: #a12928; font-weight: 900; }
.small-link { border: 0; background: transparent; color: #2d5d7b; text-decoration: underline; padding: 0; font-weight: 900; }

.world-shell { min-height: 100vh; position: relative; background: #4d311e; }
.world-canvas { position: relative; width: 100vw; aspect-ratio: 1672 / 941; min-height: 100vh; max-height: 100vh; overflow: hidden; background: #4d311e; }
.world-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.world-shimmer { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 47%, transparent 0 27%, rgba(255,237,165,.1) 36%, transparent 62%), linear-gradient(115deg, transparent 0 33%, rgba(255,244,194,.13) 39%, transparent 45%); mix-blend-mode: screen; animation: breathe 7s ease-in-out infinite; }
.ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ambient::before, .ambient::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #f6d76e; box-shadow: 0 0 14px #f6d76e, 42vw 9vh 0 1px #f5c76a, 81vw 48vh 0 0 #f5c76a, 18vw 67vh 0 1px #f5c76a; animation: dust 9s linear infinite; opacity: .7; }
.ambient::after { animation-delay: -4.2s; transform: scale(.7); opacity: .4; }

.hud { position: absolute; z-index: 12; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.hud-chip { min-height: 48px; display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border: 3px solid var(--ink); background: rgba(255,239,196,.95); box-shadow: 0 5px 0 rgba(82,41,20,.72); font-weight: 900; clip-path: polygon(2% 6%, 96% 0, 100% 92%, 0 100%); }
.hud-chip strong { font-size: 1.15rem; }
.hud-avatar { width: 42px; height: 42px; position: relative; flex: 0 0 auto; }
.mini-avatar { display: block; position: relative; width: 42px; height: 42px; }
.mini-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.mini-avatar .layer-gezicht { z-index: 1; }
.mini-avatar .layer-ogen { z-index: 2; }
.mini-avatar .layer-haar { z-index: 3; transform: translate3d(0, -5px, 0) !important; }
.mini-avatar .layer-brillen { z-index: 4; }
.mini-avatar .layer-hoofddeksel { z-index: 5; transform: translate3d(0, -9px, 0) !important; }
.hud-button { border: 3px solid var(--ink); padding: 11px 13px; background: #f7d57b; font-weight: 900; box-shadow: 0 4px 0 var(--kraft-dark); }
.hud-button:hover { transform: translateY(-2px); }

.hotspot { position: absolute; z-index: 8; border: 0; background: transparent; transform: translate(-50%, -50%); padding: 0; width: clamp(112px, 13vw, 210px); display: flex; flex-direction: column; align-items: center; gap: 5px; filter: drop-shadow(0 9px 4px rgba(42, 20, 10, .28)); }
.hotspot .marker { display: grid; place-items: center; min-width: 82px; min-height: 48px; padding: 8px 12px; border: 3px solid var(--ink); background: rgba(255,238,190,.94); box-shadow: 0 5px 0 rgba(67,35,20,.6); clip-path: polygon(4% 6%, 97% 0, 100% 92%, 0 100%); font-weight: 900; color: var(--ink); transition: transform .2s ease; }
.hotspot .marker small { display: block; font-size: .72rem; opacity: .7; }
.hotspot:hover .marker { transform: translateY(-7px) rotate(-2deg) scale(1.05); }
.hotspot .pulse { position: absolute; inset: -10px; border: 2px dashed rgba(255,245,183,.9); opacity: 0; animation: pulse 3s ease-out infinite; }
.hotspot-art { width: clamp(62px, 7vw, 118px); height: clamp(62px, 8vw, 126px); display: grid; place-items: end center; transition: transform .22s ease; }
.hotspot-art img { width: 100%; height: 100%; object-fit: contain; }
.hotspot-title { display: block; width: min(100%, 210px); transition: transform .22s ease; }
.hotspot-title img { display: block; width: 100%; height: auto; object-fit: contain; }
.shop-title { width: min(100%, 190px); }
.hotspot-wordmark { display: block; padding: 5px 10px 6px; border: 3px solid var(--ink); background: #f3bf4a; color: var(--ink); box-shadow: 0 4px 0 rgba(75, 39, 18, .68); font-size: clamp(.6rem, 1vw, .85rem); font-weight: 1000; white-space: nowrap; clip-path: polygon(3% 8%, 97% 0, 100% 91%, 0 100%); }
.hotspot:hover .hotspot-art { transform: translateY(-8px) rotate(-2deg) scale(1.06); }
.hotspot:hover .hotspot-title, .hotspot:hover .hotspot-wordmark { transform: rotate(1deg) scale(1.04); }
.hotspot-shop { left: 50%; top: 57%; z-index: 9; }
.hotspot-shop .hotspot-art { width: clamp(76px, 9vw, 136px); height: clamp(76px, 10vw, 148px); }
.hotspot-space { left: 44%; top: 12%; }
.hotspot-castle { left: 74%; top: 15%; }
.hotspot-zombie { left: 13%; top: 15%; }
.hotspot-spooky { left: 14%; top: 48%; }
.hotspot-fair { left: 88%; top: 39%; }
.hotspot-lava { left: 19%; top: 83%; }
.hotspot-caterpillar { left: 83%; top: 64%; }
.hotspot-moles { left: 71%; top: 82%; }

.room-shell { min-height: 100vh; position: relative; overflow: hidden; background: #4d311e; }
.room-scene { position: relative; width: 100vw; min-height: 100vh; aspect-ratio: 1672 / 941; overflow: hidden; background: #5e3b23; }
.room-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.room-overlay { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: radial-gradient(circle at 50% 42%, transparent 0 22%, rgba(255,225,135,.08) 43%, rgba(31,15,8,.14) 100%); }
.room-overlay::after { content: ""; position: absolute; inset: -20%; background: linear-gradient(112deg, transparent 25%, rgba(255,245,198,.13) 37%, transparent 46%); animation: lightSweep 11s ease-in-out infinite; }
.room-content { position: absolute; inset: 0; z-index: 8; }
.shopkeeper-room { position: absolute; z-index: 9; left: 18%; bottom: 8%; width: min(22vw, 300px); max-height: 58vh; object-fit: contain; filter: drop-shadow(10px 12px 0 rgba(54,25,14,.26)); animation: avatarFloat 4.8s ease-in-out infinite; pointer-events: none; }
.room-nav { position: absolute; z-index: 14; top: 50%; left: 14px; right: 14px; transform: translateY(-50%); display: flex; justify-content: space-between; pointer-events: none; }
.room-arrow { pointer-events: auto; width: 58px; height: 62px; font-size: 2rem; background: rgba(247,213,123,.92); clip-path: polygon(10% 4%, 92% 0, 100% 90%, 3% 100%); }
.room-arrow[disabled] { opacity: .25; pointer-events: none; }
.room-label { position: absolute; top: 92px; left: 50%; transform: translateX(-50%); padding: 9px 22px; z-index: 11; border: 3px solid var(--ink); background: rgba(255,240,197,.9); font-weight: 1000; box-shadow: 0 4px 0 rgba(57,28,14,.5); clip-path: polygon(2% 5%, 98% 0, 100% 91%, 0 100%); }
.avatar-stage { position: absolute; left: 50%; top: 54%; width: min(29vw, 360px); aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; pointer-events: none; }
.avatar-stage::before { content: ""; position: absolute; width: 75%; height: 16%; bottom: 5%; border-radius: 50%; background: rgba(52,25,13,.3); filter: blur(8px); }
.avatar-stage .avatar-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(10px 10px 0 rgba(54,25,14,.24)); }
.avatar-stage .avatar-layer.layer-gezicht { z-index: 1; }
.avatar-stage .avatar-layer.layer-ogen { z-index: 2; }
.avatar-stage .avatar-layer.layer-haar { z-index: 3; transform-origin: 50% 0; transform: translate3d(var(--hair-x, 0%), var(--hair-shift, -10%), 0) scale(var(--hair-scale-x, 1), var(--hair-scale-y, 1)) !important; }
.avatar-stage .avatar-layer.layer-brillen { z-index: 4; }
.avatar-stage .avatar-layer.layer-hoofddeksel { z-index: 5; transform-origin: 50% 0; transform: translate3d(var(--headwear-x, 0%), var(--headwear-shift, -35%), 0) scale(var(--headwear-scale-x, 1), var(--headwear-scale-y, 1)) !important; }
.avatar-stage .avatar-layer.base { animation: avatarFloat 4.5s ease-in-out infinite; }
.avatar-stage.shop-avatar { top: 52%; width: min(24vw, 310px); }
.avatar-stage.dressing-avatar { top: 53%; width: min(31vw, 390px); }
.avatar-stage.treasure-avatar { top: 48%; left: 23%; width: min(20vw, 250px); }
.room-panel { position: absolute; z-index: 10; border: 3px solid var(--ink); background: rgba(255,242,207,.94); box-shadow: 0 8px 0 rgba(51,23,11,.38); clip-path: polygon(1% 2%, 98% 0, 100% 97%, 2% 100%); pointer-events: auto; }
.shop-panel { right: 5.8%; bottom: 7%; width: min(31vw, 450px); padding: 14px; }
.dressing-panel { right: 4%; bottom: 7%; width: min(33vw, 500px); padding: 14px; }
.treasure-panel { right: 7%; top: 27%; width: min(37vw, 560px); padding: 15px; }
.panel-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 9px; font-weight: 1000; }
.panel-title span { opacity: .68; font-size: .82rem; }
.category-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 7px; scrollbar-width: thin; }
.category-button { border: 2px solid var(--ink); background: #edd19a; padding: 7px 9px; font-size: .78rem; font-weight: 900; white-space: nowrap; }
.category-button.active { background: var(--gold); }
.item-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 240px; overflow-y: auto; padding: 4px; }
.item-card { position: relative; min-height: 89px; border: 3px solid var(--ink); background: #fff7de; box-shadow: 0 3px 0 #a47342; display: grid; place-items: center; padding: 5px; cursor: pointer; }
.item-card:hover, .item-card.selected { transform: translateY(-3px) rotate(-1deg); background: #ffeab0; }
.item-card.selected { outline: 3px solid var(--gold); outline-offset: 2px; }
.item-card.previewed { outline: 4px solid var(--blue); outline-offset: 2px; background: #e4f3ff; }
.item-card img { width: 100%; height: 68px; object-fit: contain; }
.item-card .price { position: absolute; right: 3px; bottom: 2px; font-size: .68rem; line-height: 1; font-weight: 1000; background: #f3c54b; padding: 3px 5px; border: 2px solid var(--ink); box-shadow: 1px 1px 0 rgba(54,25,14,.32); }
.item-card.owned .price { background: #75bd72; }
.item-card.locked { filter: none; opacity: .98; }
.item-card.locked::after { content: "🔒"; position: absolute; top: 4px; left: 5px; font-size: .84rem; }
.shop-actions { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; margin-top: 12px; min-height: 48px; flex-wrap: wrap; }
.preview-selection { display: grid; gap: 3px; min-width: 0; }
.preview-selection small { opacity: .72; font-size: .72rem; line-height: 1.15; }
.preview-buttons { display: flex; align-items: flex-start; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.owned-note { border: 2px solid var(--ink); background: #75bd72; padding: 8px 10px; font-weight: 1000; font-size: .78rem; }
.preview-caption { font-size: .78rem; opacity: .72; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-tile { border: 3px solid var(--ink); background: #ffe8aa; padding: 12px; box-shadow: 0 4px 0 #9a6935; }
.stat-tile strong { display: block; font-size: 1.6rem; margin-top: 3px; }
.progress-line { height: 12px; border: 2px solid var(--ink); background: #f5e2b2; margin-top: 7px; overflow: hidden; }
.progress-line i { display: block; height: 100%; width: 62%; background: var(--blue); }
.treasure-note { margin: 12px 0 0; font-size: .8rem; opacity: .7; }
.achievement-strip { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.achievement { border: 2px solid var(--ink); background: #fff3c8; padding: 7px 9px; font-size: .78rem; font-weight: 900; }
.room-help { position: absolute; left: 50%; bottom: 25px; transform: translateX(-50%); z-index: 9; padding: 8px 13px; background: rgba(255,242,207,.86); border: 2px solid var(--ink); font-size: .78rem; font-weight: 900; }

.teacher-screen { display: block; padding: 0; position: relative; background: linear-gradient(90deg, rgba(31,15,9,.78), rgba(31,15,9,.48) 50%, rgba(31,15,9,.7)), radial-gradient(circle at 50% 40%, rgba(255,220,122,.1), transparent 55%), url('assets/front.webp') center / cover fixed no-repeat; }
.teacher-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px; }
.teacher-top h1 { margin: 0; color: #fff2cf; text-shadow: 3px 3px 0 #3f2116; }
.teacher-layout { width: min(1180px, calc(100% - 48px)); margin: 0 auto 40px; display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; }
.teacher-card { padding: 23px; }
.teacher-card h3 { margin: 0 0 13px; }
.teacher-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 22px; }
.kpi { border: 3px solid var(--ink); background: #fbe3a9; padding: 12px; box-shadow: 0 4px 0 #9e7040; }
.kpi strong { display: block; font-size: 1.75rem; }
.profile-list { display: grid; gap: 10px; }
.profile-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 3px solid var(--ink); padding: 11px; background: #fff3cc; }
.profile-row strong { display: block; }
.profile-row small { opacity: .68; }
.profile-form { display: grid; grid-template-columns: 1.2fr 1.1fr 110px auto auto; gap: 8px; align-items: end; }
.profile-form label { font-weight: 900; font-size: .8rem; }
.profile-form button { height: 47px; }
.teacher-note { border-left: 6px solid var(--gold); padding-left: 12px; line-height: 1.45; }
.form-hint { margin: 10px 0 0; font-size: .8rem; opacity: .7; }

.modal-layer { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 22px; background: rgba(24,12,7,.64); backdrop-filter: blur(4px); }
.modal-card { width: min(520px, 100%); padding: 24px; border: 4px solid var(--ink); background: var(--paper); box-shadow: 0 12px 0 #3b2013; clip-path: polygon(1% 2%, 98% 0, 100% 97%, 2% 100%); }
.modal-card h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 17px; }
.close-button { float: right; width: 34px; height: 34px; background: #f3cf8a; }
.choice-grid { display: grid; gap: 10px; }
.choice-button { display: flex; align-items: center; gap: 12px; text-align: left; border: 3px solid var(--ink); background: #fff6da; padding: 13px; box-shadow: 0 4px 0 #9b6e42; font-weight: 900; }
.choice-button:hover { transform: translateY(-2px); background: #ffe7a3; }
.toast { position: fixed; z-index: 100; right: 20px; bottom: 20px; border: 3px solid var(--ink); padding: 13px 17px; background: #ffe18b; box-shadow: 0 5px 0 #8b5d33; font-weight: 1000; animation: toastIn .28s ease-out; }
.screen-transition { animation: roomIn .45s ease both; }
.shop-particles { position: absolute; inset: 0; pointer-events: none; z-index: 13; overflow: hidden; }
.coin-particle { position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #8f5e16; background: #f5c534; animation: coinFly 1s ease-in forwards; }

.diploma-screen { min-height: 100vh; }
.profile-form { grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto; }
.auto-account-note { min-height: 47px; display: flex; align-items: center; padding: 9px 12px; border: 3px dashed #9e7040; background: #fff3cc; font-size: .82rem; font-weight: 900; line-height: 1.2; }
.diploma-screen .teacher-top { align-items: flex-start; }
.diploma-screen .teacher-top h1 { margin: 10px 0 0; }
.diploma-workspace { width: min(1420px, calc(100% - 48px)); margin: 0 auto 40px; display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: 22px; align-items: start; }
.diploma-sidebar { display: grid; gap: 22px; }
.diploma-sidebar .teacher-card, .diploma-main { padding: 18px; }
.diploma-sidebar h2, .diploma-main h2 { margin-top: 0; }
.diploma-profile-list { display: grid; gap: 8px; max-height: 330px; overflow-y: auto; padding: 3px; }
.diploma-profile { border: 3px solid var(--ink); background: #fff3cc; box-shadow: 0 3px 0 #9e7040; padding: 10px 12px; text-align: left; display: grid; gap: 3px; }
.diploma-profile:hover, .diploma-profile.active { background: #f7cf6b; transform: translateX(3px); }
.diploma-profile small { opacity: .7; }
.diploma-background-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 620px; overflow-y: auto; padding: 3px; }
.diploma-background-card { border: 3px solid var(--ink); background: #fff3cc; box-shadow: 0 3px 0 #9e7040; padding: 4px; display: grid; gap: 4px; text-align: center; font-weight: 900; font-size: .73rem; }
.diploma-background-card img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: center; display: block; }
.diploma-background-card:hover, .diploma-background-card.active { background: #f7cf6b; outline: 3px solid var(--gold); outline-offset: 2px; }
.diploma-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.diploma-toolbar h2 { margin-bottom: 5px; }
.diploma-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.diploma-actions button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.diploma-preview { position: relative; width: min(100%, 560px); aspect-ratio: 2 / 3; margin: 0 auto; overflow: hidden; background: #d8b17a; box-shadow: 0 10px 0 rgba(57,28,14,.45), 0 18px 30px rgba(0,0,0,.26); }
.diploma-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.diploma-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; padding: 27% 12% 9%; text-align: center; color: #302017; }
.diploma-recipient { width: 92%; padding: 7px 12px 8px; border-bottom: 4px solid #50331f; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.1rem, 3.3vw, 2rem); font-weight: 900; line-height: 1.05; overflow-wrap: anywhere; }
.diploma-line { max-width: 88%; margin-top: 9px; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(.58rem, 1.45vw, .88rem); line-height: 1.22; font-weight: 700; }
.diploma-tables { width: 90%; display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 18px; }
.diploma-table-badge, .diploma-empty-badge { min-height: 40px; display: grid; place-items: center; padding: 6px 3px; border: 2px solid #5b391e; border-radius: 8px; background: #f2c648; box-shadow: 2px 3px 0 rgba(70,35,14,.4); font-family: 'Trebuchet MS', sans-serif; font-size: clamp(.5rem, 1.35vw, .76rem); font-weight: 1000; }
.diploma-table-badge:nth-child(2n) { transform: rotate(1.5deg); background: #78bd72; }
.diploma-table-badge:nth-child(3n) { transform: rotate(-1.5deg); background: #70b6d3; }
.diploma-empty-badge { grid-column: 1 / -1; background: rgba(255,247,218,.76); font-size: clamp(.55rem, 1.25vw, .72rem); }
.diploma-achievement { width: min(88%, 330px); min-height: 118px; display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: clamp(34px, 7vw, 72px); padding: 12px 18px; border: 4px solid #6b411d; background: linear-gradient(135deg, #f7d15a, #e9a928); box-shadow: 4px 6px 0 rgba(70,35,14,.44); clip-path: polygon(3% 7%, 97% 0, 100% 91%, 0 100%); transform: rotate(-1deg); }
.diploma-trophy { font-size: clamp(3rem, 7vw, 4.5rem); line-height: 1; filter: drop-shadow(2px 3px 0 rgba(77,39,14,.5)); }
.diploma-achievement strong { display: block; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.05rem, 2.8vw, 1.65rem); letter-spacing: .04em; }
.diploma-achievement small { display: block; max-width: 190px; margin-top: 5px; font-family: 'Trebuchet MS', sans-serif; font-size: clamp(.52rem, 1.2vw, .72rem); font-weight: 900; line-height: 1.15; }
.diploma-brand-plate { width: min(42%, 170px); margin-top: auto; padding: 6px 12px; border: 3px solid #4e301b; background: rgba(255,239,184,.96); box-shadow: 2px 3px 0 rgba(70,35,14,.38); transform: rotate(1deg); }
.diploma-brand-plate img { display: block; width: 100%; height: auto; opacity: 1; }
.diploma-approval { margin-top: 18px; border-top: 3px dashed rgba(75,39,18,.35); padding-top: 14px; }
.diploma-approval h3 { margin: 0 0 4px; }
.table-status-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 10px; }
.table-status { min-height: 58px; border: 3px solid var(--ink); background: #f7e8bc; box-shadow: 0 3px 0 #9e7040; display: grid; place-items: center; gap: 1px; padding: 5px; }
.table-status span { font-size: 1.05rem; font-weight: 1000; }
.table-status small { font-size: .62rem; opacity: .68; }
.table-status.approved { background: #75bd72; }
.table-status.suggested { background: #f6cc62; outline: 3px dashed #e7a429; outline-offset: 2px; }
.table-status:hover { transform: translateY(-2px) rotate(-.5deg); }
.empty-diploma { min-height: 500px; display: grid; place-items: center; background: #fff2c8; border: 3px dashed var(--ink); }

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { width: 100%; min-height: 100%; background: #fff; }
  body * { visibility: hidden !important; }
  .diploma-print-target, .diploma-print-target * { visibility: visible !important; }
  .diploma-print-target { position: absolute !important; left: 0 !important; top: 0 !important; width: 100vw !important; height: 150vw !important; max-height: 100vh; margin: 0 !important; box-shadow: none !important; }
  .diploma-background { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .diploma-table-badge, .diploma-empty-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@keyframes avatarFloat { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-8px) rotate(1deg); } }
@keyframes breathe { 0%,100% { opacity: .65; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes lightSweep { 0%,100% { transform: translateX(-8%); opacity: .2; } 50% { transform: translateX(8%); opacity: .55; } }
@keyframes dust { 0% { transform: translate(0, 100vh); opacity: 0; } 25% { opacity: .7; } 100% { transform: translate(18vw, -10vh); opacity: 0; } }
@keyframes pulse { 0% { transform: scale(.7); opacity: 0; } 20% { opacity: .8; } 100% { transform: scale(1.28); opacity: 0; } }
@keyframes roomIn { from { opacity: 0; transform: translateX(25px) scale(1.015); } to { opacity: 1; transform: translateX(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) rotate(2deg); } to { opacity: 1; transform: translateY(0) rotate(0); } }
@keyframes coinFly { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.45) rotate(480deg); opacity: 0; } }

@media (max-width: 900px) {
  .login-wrap, .teacher-layout { grid-template-columns: 1fr; }
  .brand-card { min-height: 300px; }
  .login-intro { min-height: 250px; padding: 22px 24px; }
  .login-intro h1 { font-size: clamp(3rem, 14vw, 5rem); }
  .login-intro-note { align-self: flex-start; }
  .room-panel { width: min(90vw, 500px); right: 50%; transform: translateX(50%); bottom: 4%; }
  .treasure-panel { top: auto; bottom: 4%; }
  .avatar-stage, .avatar-stage.dressing-avatar { width: min(42vw, 290px); top: 42%; }
  .avatar-stage.treasure-avatar { left: 27%; top: 37%; width: min(25vw, 190px); }
  .shopkeeper-room { left: 7%; bottom: 36%; width: min(24vw, 190px); }
  .room-label { top: 84px; }
  .room-help { display: none; }
}
@media (max-width: 600px) {
  .hud { top: 8px; left: 8px; right: 8px; }
  .hud-chip { min-height: 39px; padding: 5px 8px; font-size: .75rem; }
  .hud-chip strong { font-size: .95rem; }
  .hud-button { padding: 8px; }
  .hotspot { width: 82px; gap: 2px; }
  .hotspot-art { width: 48px; height: 58px; }
  .hotspot-shop .hotspot-art { width: 60px; height: 68px; }
  .hotspot-title { width: 82px; }
  .hotspot-wordmark { font-size: .46rem; padding: 3px 5px; border-width: 2px; box-shadow: 0 2px 0 rgba(75, 39, 18, .68); }
  .hotspot-shop { left: 50%; top: 53%; }
  .hotspot-space { left: 44%; top: 12%; }
  .hotspot-castle { left: 74%; top: 15%; }
  .hotspot-zombie { left: 13%; top: 15%; }
  .hotspot-spooky { left: 14%; top: 48%; }
  .hotspot-fair { left: 88%; top: 39%; }
  .hotspot-lava { left: 19%; top: 83%; }
  .hotspot-caterpillar { left: 83%; top: 64%; }
  .hotspot-moles { left: 71%; top: 82%; }
  .room-panel { max-height: 37vh; overflow: auto; }
  .shopkeeper-room { left: 5%; bottom: 39%; width: 22vw; }
  .item-grid { max-height: 120px; grid-template-columns: repeat(4, 1fr); }
  .item-card { min-height: 63px; }
  .item-card img { height: 45px; }
  .room-arrow { width: 43px; height: 48px; font-size: 1.4rem; }
  .room-nav { left: 7px; right: 7px; }
  .diploma-workspace { width: calc(100% - 24px); grid-template-columns: 1fr; }
  .diploma-toolbar { display: grid; }
  .diploma-actions { justify-content: flex-start; }
  .diploma-background-grid { grid-template-columns: repeat(4, 1fr); max-height: none; }
  .diploma-profile-list { max-height: 180px; }
  .table-status-grid { grid-template-columns: repeat(5, 1fr); gap: 5px; }
  .table-status { min-height: 48px; }
  .table-status span { font-size: .84rem; }
  .table-status small { font-size: .48rem; }
  .teacher-top { padding: 14px; }
  .teacher-layout { width: calc(100% - 24px); }
  .teacher-kpis { grid-template-columns: 1fr; }
  .profile-form { grid-template-columns: 1fr 1fr; }
  .profile-form button { grid-column: auto; }
  .profile-form button:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
