/* ============ FIFTYTWO VILLAGE — HUD & PANELS ============ */
:root {
    --amber: #fbbf24;
    --amber-glow: rgba(251, 191, 36, 0.18);
    --purple: #8b5cf6;
    --ink: #eef2ff;
    --muted: #9aa3c7;
    --card: rgba(13, 18, 38, 0.88);
    --border: rgba(255, 255, 255, 0.12);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: #070a18; color: var(--ink);
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
    overscroll-behavior: none;
}
h1, h2, h3, .loader-logo { font-family: 'Space Grotesk', sans-serif; }
#village { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
.touch-only { display: none; }
@media (pointer: coarse) { .touch-only { display: inline; } }

/* ============ OVERLAYS ============ */
.overlay {
    position: fixed; inset: 0; z-index: 50;
    display: flex; align-items: center; justify-content: center;
    background: rgba(5, 8, 20, 0.55);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    padding: 1rem;
}
.loader-card {
    /* Suna's playful neo-brutalist look: Fredoka + Nunito, ink borders, hard shadows */
    font-family: 'Nunito', sans-serif;
    background: #fffdf5;
    border: 3px solid #20242e;
    border-radius: 24px;
    padding: clamp(1.6rem, 4vw, 2.6rem);
    max-width: 520px; width: 100%;
    text-align: center;
    color: #20242e;
    box-shadow: 0 6px 0 #20242e, 0 30px 80px rgba(0, 0, 0, 0.6);
    max-height: 88vh; overflow-y: auto;
    animation: card-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes card-pop { from { opacity: 0; transform: scale(0.92) translateY(14px); } }
.panel-card {
    font-family: 'Nunito', sans-serif;
    background: #fffdf5;
    border: 3px solid #20242e;
    border-radius: 24px;
    padding: clamp(1.8rem, 4vw, 3rem);
    max-width: 520px; width: 100%;
    text-align: center;
    color: #20242e;
    box-shadow: 0 6px 0 #20242e, 0 30px 80px rgba(0, 0, 0, 0.6);
    max-height: 88vh; overflow-y: auto;
}
.panel-card h1, .panel-card h2, .panel-card h3, .panel-card h4 { font-family: 'Fredoka', sans-serif; font-weight: 600; }
.panel-card.wide { max-width: 720px; text-align: left; position: relative; }
.guide-mascot {
    width: 88px; height: 88px; object-fit: cover; border-radius: 50%;
    border: 3px solid #20242e; display: block; margin: 0 auto 0.6rem;
    box-shadow: 0 4px 0 #20242e;
    animation: bob 3.2s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(-7px); } }
.loader-logo { font-family: 'Fredoka', sans-serif; font-size: 1.05rem; font-weight: 600; color: #2ec4a6; letter-spacing: 0; }
.loader-card h1 { font-family: 'Fredoka', sans-serif; font-size: clamp(1.9rem, 5.5vw, 2.6rem); margin: 0.3rem 0 0.5rem; letter-spacing: 0; font-weight: 600; }
.guide-sub { color: #5b6478; margin-bottom: 1.1rem; font-weight: 600; }
.guide-steps { list-style: none; text-align: left; display: flex; flex-direction: column; gap: 0.7rem; margin: 0 0 1.1rem; }
.guide-steps li { display: flex; align-items: center; gap: 0.8rem; font-size: 0.95rem; font-weight: 600; color: #333a4d; }
.guide-steps b { font-weight: 800; }
.step-n {
    flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid #20242e; display: inline-grid; place-items: center;
    font-family: 'Fredoka', sans-serif; font-weight: 700; color: #fff; font-size: 1rem;
}
.step-n.s1 { background: #2ec4a6; }
.step-n.s2 { background: #4cc9f0; }
.step-n.s3 { background: #ff5c7a; }
.guide-tip {
    font-size: 0.88rem; font-weight: 700; color: #0e6e5c;
    background: rgba(46, 196, 166, 0.14); border: 2px dashed #2ec4a6;
    border-radius: 14px; padding: 0.7rem 1rem; margin-bottom: 1.4rem;
}
.do-desktop { display: inline; }
@media (pointer: coarse) { .do-desktop { display: none; } }
.btn-enter {
    font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.15rem;
    background: #ffc93c; color: #20242e;
    border: 3px solid #20242e; border-radius: 16px; padding: 0.95rem 2.4rem; cursor: pointer;
    box-shadow: 0 5px 0 #20242e;
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.2s;
}
.btn-enter:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 #20242e; }
.btn-enter:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 2px 0 #20242e; }
.btn-enter:disabled { opacity: 0.6; cursor: wait; }

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
.crosshair {
    position: absolute; top: 50%; left: 50%; width: 6px; height: 6px;
    margin: -3px 0 0 -3px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.9);
}
.hud-top {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.2rem; pointer-events: none;
}
.hud-btns { display: flex; gap: 0.6rem; pointer-events: auto; }
/* live website overlay on the hut monitor */
#live-site {
    position: fixed; z-index: 5;
    border: 3px solid #20242e; border-radius: 10px;
    pointer-events: none; background: #fff;
}
#live-site.hidden { display: none; }
/* fade transition for interiors */
#fade {
    position: fixed; inset: 0; z-index: 60; background: #04060f;
    opacity: 0; pointer-events: none; transition: opacity 0.35s ease;
}
#fade.on { opacity: 1; }
/* rich panel heroes */
.panel-hero {
    border-radius: 16px; padding: 1.2rem 1.3rem; margin: -0.4rem -0.4rem 1.2rem;
    display: flex; align-items: center; gap: 1rem;
    border: 3px solid #20242e; box-shadow: 0 4px 0 #20242e;
}
.panel-hero i { font-size: 2rem; }
.panel-hero h2 { margin: 0 !important; padding: 0 !important; font-size: 1.5rem !important; }
.panel-hero p { font-size: 0.85rem; font-weight: 600; opacity: 0.8; }
.h-about { background: linear-gradient(120deg, #4cc9f0, #8b5cf6); color: #fff; }
.h-teaching { background: linear-gradient(120deg, #ffc93c, #ff9f43); color: #231a05; }
.h-study { background: linear-gradient(120deg, #2ec4a6, #4cc9f0); color: #06231d; }
.h-skills { background: linear-gradient(120deg, #8b5cf6, #ff5c7a); color: #fff; }
.h-journal { background: linear-gradient(120deg, #ff5c7a, #ff9f43); color: #fff; }
.h-school { background: linear-gradient(120deg, #2ec4a6, #a3e635); color: #0b2413; }
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.about-cell { border: 3px solid #20242e; border-radius: 14px; padding: 0.9rem 1rem; background: #fff; box-shadow: 0 3px 0 #20242e; }
.about-cell .k { font-family: 'Fredoka', sans-serif; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #0e6e5c; }
.about-cell .v { font-size: 0.95rem; font-weight: 600; margin-top: 0.15rem; }
.about-links { display: flex; gap: 0.8rem; margin-top: 1.1rem; flex-wrap: wrap; }
.about-links a {
    display: inline-flex; align-items: center; gap: 0.5rem;
    border: 3px solid #20242e; border-radius: 12px; padding: 0.55rem 1.1rem;
    font-size: 0.88rem; font-weight: 800; color: #20242e; text-decoration: none;
    background: #fff; box-shadow: 0 3px 0 #20242e;
    transition: transform 0.16s, box-shadow 0.16s;
}
.about-links a:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #20242e; }
.about-links i { color: #0e6e5c; }
@media (max-width: 600px) { .about-grid { grid-template-columns: 1fr; } }
.hud-brand {
    font-family: 'Fredoka', sans-serif; font-weight: 600; color: #20242e;
    background: #fffdf5; border: 3px solid #20242e;
    padding: 0.4rem 1rem; border-radius: 999px; font-size: 0.9rem;
    box-shadow: 0 3px 0 #20242e;
}
.hud-btn {
    pointer-events: auto;
    width: 2.6rem; height: 2.6rem; border-radius: 12px;
    background: #fffdf5; border: 3px solid #20242e;
    color: #20242e; cursor: pointer; font-size: 1rem;
    box-shadow: 0 3px 0 #20242e;
}
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #20242e; }
.prompt {
    position: absolute; bottom: 12%; left: 50%; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
    font-family: 'Nunito', sans-serif;
    background: #fffdf5; border: 3px solid #20242e;
    border-radius: 16px; padding: 0.8rem 1.5rem;
    box-shadow: 0 4px 0 #20242e;
    animation: prompt-in 0.25s ease;
    white-space: nowrap;
}
@keyframes prompt-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.prompt-name { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.15rem; color: #20242e; }
.prompt-hint { font-size: 0.82rem; color: #5b6478; font-weight: 700; }
.prompt-hint b { color: #e14b6a; }
.toast {
    position: absolute; top: 4.5rem; left: 50%; transform: translateX(-50%);
    font-family: 'Nunito', sans-serif; font-weight: 700;
    background: #20242e; border: 3px solid #20242e;
    padding: 0.7rem 1.3rem; border-radius: 12px; font-size: 0.88rem; color: #fffdf5;
    box-shadow: 0 4px 0 rgba(0,0,0,0.4);
}

/* ============ PANEL CONTENT ============ */
.panel-close {
    position: absolute; top: 1rem; right: 1rem;
    width: 2.5rem; height: 2.5rem; border-radius: 12px;
    background: #fff; border: 3px solid #20242e;
    color: #20242e; cursor: pointer; font-size: 1rem;
    box-shadow: 0 3px 0 #20242e;
}
.panel-close:active { transform: translateY(2px); box-shadow: 0 1px 0 #20242e; }
#panel-body h2 { font-size: 1.7rem; letter-spacing: -0.02em; margin-bottom: 0.3rem; padding-right: 2.5rem; }
#panel-body .panel-sub { color: #5b6478; margin-bottom: 1.4rem; font-size: 0.95rem; font-weight: 600; }
.panel-skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem; }
.pskill {
    border: 3px solid #20242e; border-radius: 16px; padding: 1.1rem 1.2rem;
    background: #fff; box-shadow: 0 4px 0 #20242e;
}
.pskill i { font-size: 1.3rem; margin-bottom: 0.5rem; display: block; }
.pskill:nth-child(1) i { color: #2ec4a6; }
.pskill:nth-child(2) i { color: #ff5c7a; }
.pskill:nth-child(3) i { color: #4cc9f0; }
.pskill:nth-child(4) i { color: #e8a100; }
.pskill h3 { font-size: 1rem; margin-bottom: 0.2rem; }
.pskill p { font-size: 0.82rem; color: #5b6478; font-weight: 600; }
.ptools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.2rem; }
.ptools span {
    font-size: 0.78rem; font-weight: 800;
    border: 3px solid #20242e; color: #20242e; background: #ffc93c;
    padding: 0.3rem 0.9rem; border-radius: 999px;
    box-shadow: 0 3px 0 #20242e;
}
.ptimeline h3 { font-size: 1.1rem; color: #0e6e5c; margin: 1.2rem 0 0.8rem; display: flex; align-items: center; gap: 0.6rem; }
.ptimeline h3:first-child { margin-top: 0; }
.pt-item { border-left: 4px solid #2ec4a6; padding: 0 0 1rem 1.1rem; margin-left: 0.3rem; position: relative; }
.pt-item::before {
    content: ''; position: absolute; left: -6px; top: 4px;
    width: 12px; height: 12px; border-radius: 50%; background: #ffc93c;
    border: 3px solid #20242e;
}
.pt-item .d { font-size: 0.74rem; font-weight: 800; color: #e14b6a; text-transform: uppercase; letter-spacing: 0.04em; }
.pt-item h4 { font-size: 0.98rem; }
.pt-item p { font-size: 0.85rem; color: #5b6478; font-weight: 600; }
.pjournal { display: flex; flex-direction: column; gap: 0.8rem; }
.pj { display: flex; gap: 1rem; align-items: center; border: 3px solid #20242e; border-radius: 14px; padding: 0.8rem 1rem; background: #fff; box-shadow: 0 3px 0 #20242e; }
.pj img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex-shrink: 0; border: 2px solid #20242e; }
.pj .t { font-family: 'Fredoka', sans-serif; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #e14b6a; }
.pj h4 { font-size: 0.95rem; }
.pj p { font-size: 0.8rem; color: #5b6478; font-weight: 600; }
.plinks { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.plink {
    display: block; border: 3px solid #20242e; border-radius: 16px;
    padding: 1.4rem; background: #fff; box-shadow: 0 4px 0 #20242e;
    transition: transform 0.16s, box-shadow 0.16s; color: #20242e; text-decoration: none;
}
.plink:hover { transform: translate(-2px, -4px); box-shadow: 0 8px 0 #20242e; }
.plink i { font-size: 1.6rem; color: #ff5c7a; margin-bottom: 0.6rem; display: block; }
.plink h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.plink p { font-size: 0.85rem; color: #5b6478; font-weight: 600; }

/* ============ HELP ============ */
.help-list { list-style: none; text-align: left; margin: 1.2rem 0; display: flex; flex-direction: column; gap: 0.7rem; }
.help-list li { font-size: 0.95rem; color: #5b6478; font-weight: 600; }
.help-list b { color: #e14b6a; }
.help-touch { font-size: 0.88rem; color: #5b6478; font-weight: 600; }

/* ============ TOUCH UI ============ */
#touch-ui { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
#joystick {
    position: absolute;
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    left: calc(1.6rem + env(safe-area-inset-left, 0px));
    width: 120px; height: 120px; border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(7, 10, 24, 0.4);
    pointer-events: auto;
    transition: opacity 0.3s;
}
#stick {
    position: absolute; top: 50%; left: 50%;
    width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%;
    background: #ffc93c; border: 3px solid #20242e; box-shadow: 0 3px 0 #20242e;
}
#visit-btn {
    position: absolute;
    bottom: calc(2.6rem + env(safe-area-inset-bottom, 0px));
    right: calc(1.6rem + env(safe-area-inset-right, 0px));
    pointer-events: auto;
    font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 1.05rem;
    background: #ffc93c; color: #20242e;
    border: 3px solid #20242e; border-radius: 999px; padding: 1rem 1.8rem;
    box-shadow: 0 5px 0 #20242e;
    min-height: 56px;
}
#visit-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #20242e; }

@media (max-width: 600px) {
    .panel-skills, .plinks { grid-template-columns: 1fr; }
    .prompt {
        bottom: 34%;
        white-space: normal;
        max-width: 86vw;
        text-align: center;
    }
    .hud-brand { font-size: 0.8rem; }
    .loader-card h1 { font-size: 2rem; }
}
