@font-face {
    font-family: "Ngayogyan";
    src: url("/static/nykNgayogyanNew.ttf") format("truetype");
    font-display: swap;
}
:root {
    --cream: #fbf3e4;
    --cream-deep: #f3e6ce;
    --card: #ffffff;
    --ink: #223047;
    --ink-soft: #6b7688;
    --green: #4c9a5b;
    --green-deep: #367647;
    --green-pale: #e5f3e5;
    --orange: #f2802f;
    --orange-pale: #fdecd8;
    --gold: #d9a441;
    --gray-dot: #dee1e6;
    --gray-dot-text: #93989f;
    --star-gold: #f4b740;
    --line: #ece3d0;
    --shadow: 0 18px 40px -18px rgba(80, 60, 20, 0.22);
}
* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    font-family: "Plus Jakarta Sans", sans-serif;
    margin: 0;
    color: var(--ink);
    background-color: var(--cream);
    background-image:
        radial-gradient(
            circle at 0 0,
            rgba(217, 164, 65, 0.07) 0,
            transparent 45%
        ),
        radial-gradient(
            circle at 100% 0,
            rgba(76, 154, 91, 0.06) 0,
            transparent 45%
        );
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.display {
    font-family: "Baloo 2", sans-serif;
}
.topbar {
    display: flex;
    align-items: center;
    gap: 22px;
    justify-content: space-between;
    padding: 10px 32px;
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: "Baloo 2", sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: var(--ink);
    white-space: nowrap;
    text-decoration: none;
}
.brand .flourish {
    opacity: 0.7;
}
.progress-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 700;
    font-size: 14px;
    color: var(--ink);
}
.progress-track {
    width: 110px;
    height: 8px;
    background: #eef0f2;
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--green), var(--green-deep));
    border-radius: 999px;
    transition: width 0.4s ease;
}
.steps {
    display: flex;
    align-items: center;
    gap: 10px;
}
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    padding: 2px 4px;
    text-decoration: none;
}
.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #eff1f3;
    color: #97a0ac;
    transition: transform 0.15s ease;
}
.step.is-active .step-icon {
    background: var(--green);
    color: #fff;
    box-shadow: 0 6px 14px -4px rgba(76, 154, 91, 0.55);
}
.step:hover .step-icon {
    transform: translateY(-2px);
}
.step-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #97a0ac;
}
.step.is-active .step-label {
    color: var(--green-deep);
}
.step-arrow {
    color: #c7ccd3;
}
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease;
}
.icon-btn:hover {
    background: var(--cream-deep);
}
.icon-btn.is-muted {
    color: var(--orange);
}
.header-icons {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stage {
    max-width: 1180px;
    width: 100%;
    margin: 0 auto;
    padding: 14px 28px 16px;
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.corner-flourish {
    position: absolute;
    opacity: 0.5;
    pointer-events: none;
}
.corner-flourish.tl {
    top: 8px;
    left: 4px;
}
.corner-flourish.br {
    bottom: 46px;
    right: 4px;
}
.card {
    background: var(--card);
    border-radius: 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.card-header {
    text-align: center;
    padding: 16px 24px 10px;
    flex-shrink: 0;
}
.card-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.card-title .num {
    color: var(--orange);
}
.card-subtitle {
    margin: 4px 0 0;
    color: var(--ink-soft);
    font-size: 14px;
}
.game-area {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 20px;
    flex: 1 1 auto;
    min-height: 0;
}
.game-container {
    position: relative;
    height: 100%;
    max-height: 100%;
    width: auto;
    max-width: 100%;
    aspect-ratio: 1/1;
    margin: 0 auto;
}
.game-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}
#svgBgContainer {
    opacity: 0.16;
}
#svgFillContainer,
#svgSolidContainer {
    transition: opacity 0.4s ease;
}
.reveal-mask-path {
    fill: none;
    stroke: white;
    stroke-width: 65;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-dashoffset 0.35s ease-in-out;
}
.hint-connector {
    fill: none;
    stroke: var(--orange);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 1 14;
    opacity: 0.8;
}
.dot-circle {
    fill: var(--gray-dot);
    stroke: #fff;
    stroke-width: 4px;
    cursor: pointer;
    transition:
        fill 0.2s ease,
        transform 0.15s ease;
}
.dot-text {
    fill: var(--gray-dot-text);
    font-family: "Baloo 2", sans-serif;
    font-weight: 700;
    font-size: 17px;
    text-anchor: middle;
    dominant-baseline: central;
    pointer-events: none;
}
.dot-group.current .dot-circle {
    fill: var(--orange);
    animation: pulseGlow 1.4s ease-in-out infinite;
}
.dot-group.current .dot-text {
    fill: white;
}
.dot-group.active .dot-circle {
    fill: var(--green);
    cursor: default;
}
.dot-group.active .dot-text {
    fill: white;
}
.game-container.finished .dot-circle {
    opacity: 0.18;
}
.game-container.finished .hint-connector {
    opacity: 0;
}
@keyframes pulseGlow {
    0%,
    100% {
        filter: drop-shadow(0 0 0 rgba(242, 128, 47, 0.55));
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(242, 128, 47, 0.85));
    }
}
.bounce-hint {
    animation: bounceHint 0.6s ease;
}
@keyframes bounceHint {
    0%,
    100% {
        transform: scale(1);
    }
    30% {
        transform: scale(1.35);
    }
    60% {
        transform: scale(0.92);
    }
}
.canvas-holder {
    position: relative;
    height: 100%;
    max-height: 100%;
    width: auto;
    max-width: 100%;
    aspect-ratio: 1/1;
    margin: 0 auto;
    border-radius: 20px;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            rgba(34, 48, 71, 0.045) 40px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 39px,
            rgba(34, 48, 71, 0.045) 40px
        ),
        #fffdf7;
    border: 3px dashed var(--line);
    overflow: hidden;
    touch-action: none;
}
.canvas-holder.wide {
    aspect-ratio: 2/1;
    max-width: 1020px;
    width: 100%;
}
.canvas-holder.wide.mob-wide {
    aspect-ratio: 2/1;
}
@media (max-width: 640px) {
    .canvas-holder.wide {
        aspect-ratio: 1.5/1;
    }
}
.canvas-holder svg,
.canvas-holder canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
.bbox-rect {
    fill: none;
    stroke: var(--gold);
    stroke-width: 3;
    stroke-dasharray: 10 8;
    stroke-linecap: round;
    rx: 18;
}
.hint-glyph {
    fill: #8a5a2b;
    fill-rule: evenodd;
    opacity: 0;
}
.card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 26px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.btn-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fce29b;
    color: #6b4e10;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-family: "Baloo 2", sans-serif;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
    white-space: nowrap;
}
.btn-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -6px rgba(217, 164, 65, 0.55);
}
.btn-clear {
    background: #fff;
    color: var(--ink-soft);
    box-shadow: inset 0 0 0 1.5px var(--line);
}
.btn-next {
    background: #fff;
    color: var(--green-deep);
    box-shadow: inset 0 0 0 1.5px var(--green);
}
.btn-check {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 20px;
    font-family: "Baloo 2", sans-serif;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
    white-space: nowrap;
}
.btn-check:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -6px rgba(54, 118, 71, 0.55);
}
.instruction-pill {
    flex: 1 1 220px;
    text-align: center;
    background: var(--green-pale);
    color: var(--ink);
    border-radius: 999px;
    padding: 13px 20px;
    font-weight: 700;
    font-size: 15px;
}
.instruction-pill .num {
    color: var(--orange);
}
.stars {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.stars svg {
    width: 24px;
    height: 24px;
}
.star-filled {
    fill: var(--star-gold);
    stroke: var(--star-gold);
}
.star-empty {
    fill: #edeff2;
    stroke: #d7dbe0;
}
.completion-banner {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 18px;
    max-width: 640px;
    margin: 10px auto 0;
    background: var(--green-pale);
    border: 1px solid #cfe9d1;
    border-radius: 999px;
    padding: 10px 16px 10px 26px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.completion-banner.show {
    display: flex;
}
.completion-text {
    font-weight: 700;
    color: var(--green-deep);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.btn-continue {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 12px 22px;
    font-family: "Baloo 2", sans-serif;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
    white-space: nowrap;
}
.btn-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px -6px rgba(54, 118, 71, 0.55);
}
#toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(34, 48, 71, 0.94);
    color: #fff;
    padding: 18px 28px;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    max-width: 80vw;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
}
#toast.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}
.hall-wrap {
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    flex: 1 1 auto;
    padding: 20px 0;
}
.hall-card {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    margin-bottom: 16px;
}
.hall-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f0ede6;
    font-size: 14px;
}
.hall-row:last-child {
    border-bottom: none;
}
.hall-input {
    padding: 12px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    font-size: 15px;
    flex: 1 1 auto;
}
.sublevel-tabs {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 8px 0;
}
.sublevel-tab {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: #fff;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    color: var(--ink-soft);
}
.sublevel-tab.is-active {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
}
@media (max-width: 640px) {
    html,
    body {
        height: auto;
        min-height: 100%;
    }
    body {
        overflow: visible;
        min-height: 100dvh;
        height: 100dvh;
    }
    .stage {
        padding: 10px 12px 12px;
    }
    .topbar {
        justify-content: center;
        padding: 8px 12px;
        gap: 10px 16px;
    }
    .brand {
        font-size: 17px;
        gap: 8px;
    }
    .brand .flourish {
        width: 16px;
        height: 21px;
    }
    .progress-pill {
        padding: 6px 12px;
        font-size: 12px;
        gap: 7px;
    }
    .progress-track {
        width: 70px;
        height: 6px;
    }
    .steps {
        gap: 6px;
    }
    .step-icon {
        width: 32px;
        height: 32px;
    }
    .step-label {
        font-size: 11px;
    }
    .icon-btn {
        width: 34px;
        height: 34px;
    }
    .corner-flourish {
        display: none;
    }
    .card-header {
        padding: 12px 16px 8px;
    }
    .card-title {
        font-size: 20px;
        gap: 8px;
    }
    .game-area {
        padding: 4px 10px;
    }
    .card-footer {
        justify-content: center;
        padding: 12px 16px;
        gap: 10px;
    }
    .instruction-pill {
        order: 3;
        font-size: 14px;
        padding: 10px 16px;
    }
    .btn-hint,
    .btn-check {
        padding: 10px 16px;
        font-size: 14px;
    }
    .completion-banner {
        padding: 8px 14px 8px 20px;
    }
    .completion-text {
        font-size: 14px;
    }
    .btn-continue {
        padding: 10px 18px;
        font-size: 14px;
    }
}
