body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    font-family: "Fredoka", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #62b1f6 0%, #a4daf8 100%);
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    display: block;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

.btn-green {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    border: 2px solid #A5D6A7;
    box-shadow: 0 4px 0 #1b4d1f;
}

.btn-green:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #1b4d1f;
}

@keyframes bounce-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.animate-bounce-gentle {
    animation: bounce-gentle 2s infinite ease-in-out;
}

.game-hud.is-hidden {
    display: none;
}

.start-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(24px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
    background:
        radial-gradient(circle at 18% 18%, rgba(251, 191, 36, 0.32), transparent 42%),
        radial-gradient(circle at 86% 78%, rgba(56, 189, 248, 0.32), transparent 46%),
        rgba(15, 23, 42, 0.42);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.start-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.start-card {
    width: min(100%, 400px);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.94), rgba(15, 23, 42, 0.94));
    border: 2px solid rgba(250, 204, 21, 0.35);
    border-radius: 28px;
    box-shadow: 0 18px 0 rgba(0, 0, 0, 0.28), 0 30px 50px rgba(0, 0, 0, 0.35);
    padding: 22px 18px 18px;
    text-align: center;
    color: #f8fafc;
}

.start-badge {
    display: inline-block;
    background: #f59e0b;
    color: #431407;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    padding: 4px 10px;
    border-radius: 999px;
}

.start-icon {
    width: 88px;
    height: 88px;
    margin: 10px auto 4px;
    filter: drop-shadow(0 10px 0 rgba(0, 0, 0, 0.18));
    animation: bounce-gentle 1.8s ease-in-out infinite;
}

.start-icon svg {
    width: 100%;
    height: 100%;
}

.start-title {
    margin: 4px 0;
    font-size: clamp(1.7rem, 7vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #f8fafc;
}

.start-tagline,
.howto-title {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #bae6fd;
}

.start-progress {
    display: none;
    margin: 0 0 18px;
    font-size: 13px;
    font-weight: 700;
    color: #fde68a;
}

.start-progress.is-visible {
    display: block;
}

.start-progress.is-visible::before {
    content: "Progress · ";
    font-weight: 600;
    color: #94a3b8;
}

.howto-title {
    margin-bottom: 16px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #f8fafc;
}

.btn-mulai,
.btn-cara-main {
    width: 100%;
    border: none;
    border-radius: 18px;
    padding: 14px 16px;
    min-height: 52px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.12s ease;
}

.btn-mulai {
    background: linear-gradient(180deg, #fbbf24, #d97706);
    color: #431407;
    box-shadow: 0 7px 0 #92400e;
    font-size: 1.25rem;
    letter-spacing: 0.08em;
}

.btn-mulai i {
    font-size: 14px;
}

.btn-cara-main {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.btn-mulai:active,
.btn-cara-main:active {
    transform: translateY(4px) scale(0.97);
}

.btn-mulai:active {
    box-shadow: 0 2px 0 #92400e;
}

.howto-list {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    text-align: left;
}

.howto-list li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.5;
    color: #e2e8f0;
    margin-bottom: 12px;
}

.howto-list i {
    margin-top: 2px;
    color: #fbbf24;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.is-hidden {
    display: none !important;
}

.hidden {
    display: none !important;
}

/* HUD — ringkas seperti sebelumnya */
.game-hud {
    position: fixed;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

.hud-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: calc(12px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 12px calc(16px + env(safe-area-inset-left));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.hud-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
    border-radius: 16px;
    pointer-events: auto;
}

.hud-stat-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hud-stat-icon {
    color: #d97706;
    font-size: 18px;
}

.hud-sheep-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.hud-stat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    line-height: 1;
}

.hud-stat-values {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.hud-stat-num {
    font-size: 1.15rem;
    font-weight: 800;
    color: #92400e;
    line-height: 1;
}

.hud-stat-num-green {
    color: #047857;
}

.hud-expert {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.06em;
    background: #dc2626;
    color: #fff;
    padding: 2px 6px;
    border-radius: 999px;
}

.hud-stat-divider {
    width: 1px;
    height: 28px;
    background: #d1d5db;
}

.hud-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.hud-icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 16px rgba(31, 38, 135, 0.12);
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hud-icon-btn:active {
    transform: scale(0.95);
}

.level-tip {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    max-width: min(92vw, 360px);
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.4);
    border-radius: 999px;
    color: #bae6fd;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 11;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.level-tip i {
    color: #fbbf24;
}

/* Toast */
.toast {
    position: fixed;
    top: 88px;
    left: 50%;
    transform: translateX(-50%) translateY(-16px);
    background: rgba(220, 38, 38, 0.95);
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Peta pulau */
.island-map-chapters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 10px;
    justify-content: center;
}

.map-chapter-chip {
    border: none;
    border-radius: 10px;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #e2e8f0;
    transition: transform 0.12s ease, background 0.12s ease;
}

.map-chapter-chip.is-active {
    background: rgba(251, 191, 36, 0.22);
    border-color: rgba(250, 204, 21, 0.65);
    color: #fde68a;
}

.map-chapter-chip.is-locked {
    opacity: 0.35;
    cursor: not-allowed;
}

.map-chapter-chip:active:not(:disabled) {
    transform: scale(0.94);
}

.island-map-subtitle {
    margin: 0 0 10px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
}

.island-map-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 0 0 16px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

.island-tile {
    border: none;
    border-radius: 14px;
    padding: 10px 4px 8px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    transition: transform 0.12s ease;
}

.island-tile:active:not(:disabled) {
    transform: scale(0.95);
}

.island-tile.is-current {
    border-color: rgba(250, 204, 21, 0.7);
    background: rgba(251, 191, 36, 0.12);
}

.island-tile.is-locked {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

.island-tile-icon {
    font-size: 22px;
    line-height: 1;
}

.island-tile-num {
    font-size: 11px;
    font-weight: 700;
}

.island-tile-fog {
    font-size: 9px;
    color: #94a3b8;
    font-weight: 600;
}

@media (max-width: 360px) {
    .island-map-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
