* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0d0d12;
    font-family: 'Segoe UI', Arial, sans-serif;
}

#game {
    display: block;
    width: 100%;
    height: 100%;
}

.btn-primary {
    padding: 12px 32px;
    font-size: 18px;
    font-weight: 700;
    color: #0d0d12;
    background: #ffd54a;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-primary:hover {
    background: #ffe680;
}

/* ---------- HUD ---------- */

#hud {
    position: fixed;
    top: 12px;
    left: 12px;
    color: #e0e0e0;
    font-size: 14px;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#buildinfo {
    position: fixed;
    bottom: 12px;
    left: 12px;
    color: #b8b8c4;
    font-size: 12px;
    line-height: 1.6;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    white-space: pre;
}

#xpbar-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

#xpbar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #2e8fff, #6fd1ff);
    transition: width 0.15s ease-out;
}

#pause-btn {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 25;
    width: 44px;
    height: 44px;
    font-size: 20px;
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    display: none;
}

#pause-btn.show {
    display: block;
}

#pause-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ---------- Joystick analog (layar sentuh) ---------- */

#joystick {
    position: fixed;
    left: 18px;
    bottom: 96px;
    z-index: 5;
    display: none;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.22);
    user-select: none;
    touch-action: none;
}

body.touch #joystick {
    display: block;
}

#joystick-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

#joystick.active #joystick-knob {
    background: rgba(255, 255, 255, 0.38);
}

/* ---------- Banner ---------- */

.banner {
    position: fixed;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    font-weight: 800;
    letter-spacing: 3px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.2s, transform 0.2s;
}

.banner.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#levelup {
    top: 30%;
    color: #ffd54a;
    font-size: 44px;
    text-shadow: 0 0 20px rgba(255, 213, 74, 0.7), 0 2px 4px rgba(0, 0, 0, 0.9);
}

#synergy {
    top: 40%;
    color: #ff6ee7;
    font-size: 26px;
    text-shadow: 0 0 20px rgba(255, 110, 231, 0.8), 0 2px 4px rgba(0, 0, 0, 0.9);
}

#warning {
    top: 22%;
    color: #ff5252;
    font-size: 30px;
    text-shadow: 0 0 20px rgba(255, 82, 82, 0.8), 0 2px 4px rgba(0, 0, 0, 0.9);
}

/* ---------- Layar awal ---------- */

#start {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(5, 5, 10, 0.85);
    color: #fff;
    user-select: none;
    z-index: 30;
    text-align: center;
}

#start.show {
    display: flex;
}

#start h1 {
    font-size: 56px;
    color: #ffd54a;
    letter-spacing: 6px;
    text-shadow: 0 0 24px rgba(255, 213, 74, 0.5);
}

#start p {
    font-size: 15px;
    color: #aab;
    line-height: 1.7;
}

/* ---------- Layar pause ---------- */

#pause {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(5, 5, 10, 0.85);
    user-select: none;
    z-index: 18;
    overflow-y: auto;
    padding: 24px 0;
}

#pause.show {
    display: flex;
}

#pause h2 {
    color: #ffd54a;
    font-size: 30px;
    letter-spacing: 3px;
}

#pause-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: min(640px, 92vw);
}

.pause-section {
    background: #14141c;
    border: 1px solid #2c2c3e;
    border-radius: 10px;
    padding: 14px 16px;
}

.pause-section h3 {
    font-size: 12px;
    letter-spacing: 2px;
    color: #8888a0;
    margin-bottom: 10px;
}

.pause-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
    color: #e0e0e8;
    padding: 4px 0;
}

.pause-row .effect {
    color: #9a9ab0;
    font-size: 12.5px;
}

.pause-row .lv {
    color: #8bc34a;
    font-weight: 700;
    white-space: nowrap;
}

.pause-row .lv.max {
    color: #ffd54a;
}

.syn-row {
    font-size: 13px;
    color: #c0c0d0;
    padding: 8px 0;
    border-top: 1px dashed #2c2c3e;
    line-height: 1.6;
}

.syn-row:first-of-type {
    border-top: none;
}

.syn-row .syn-name {
    font-weight: 700;
    color: #e8e8f0;
}

.syn-row.unlocked .syn-name,
.syn-row.unlocked {
    color: #ff6ee7;
}

.syn-row .lv {
    color: #8bc34a;
    font-weight: 700;
}

.syn-row .lv.max {
    color: #ffd54a;
}

/* ---------- Layar chest ---------- */

#chest-overlay {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    background: rgba(5, 5, 10, 0.78);
    user-select: none;
    z-index: 15;
}

#chest-overlay.show {
    display: flex;
}

#chest-tier {
    font-size: 34px;
    font-weight: 800;
    letter-spacing: 4px;
    text-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}

#chest-rewards {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chest-reward {
    min-width: 280px;
    padding: 10px 18px;
    background: linear-gradient(160deg, #1c1c28, #14141c);
    border: 1px solid #3a3a4e;
    border-radius: 8px;
    color: #e8e8f0;
    font-size: 15px;
    text-align: center;
}

/* ---------- Layar pilihan upgrade ---------- */

#upgrade {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: rgba(5, 5, 10, 0.78);
    user-select: none;
    z-index: 10;
}

#upgrade.show {
    display: flex;
}

#upgrade h2 {
    color: #ffd54a;
    font-size: 30px;
    letter-spacing: 3px;
    text-shadow: 0 0 16px rgba(255, 213, 74, 0.5);
}

#cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.card {
    width: 220px;
    min-height: 230px;
    padding: 18px 16px;
    background: linear-gradient(160deg, #1c1c28, #14141c);
    border: 2px solid #3a3a4e;
    border-radius: 12px;
    color: #e8e8f0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.card:hover {
    transform: translateY(-6px);
    border-color: #ffd54a;
    box-shadow: 0 8px 24px rgba(255, 213, 74, 0.25);
}

.card.artifact {
    border-color: #7e57c2;
}

.card.artifact:hover {
    border-color: #c792ff;
    box-shadow: 0 8px 24px rgba(199, 146, 255, 0.3);
}

.card .tag {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: #8bc34a;
}

.card.artifact .tag {
    color: #c792ff;
}

.card .icon {
    font-size: 34px;
    line-height: 1;
}

.card .name {
    font-size: 17px;
    font-weight: 700;
}

.card .pips {
    display: flex;
    gap: 4px;
}

.card .pips span {
    width: 14px;
    height: 6px;
    border-radius: 3px;
    background: #33334a;
}

.card .pips span.on {
    background: #8bc34a;
}

.card.artifact .pips span.on {
    background: #c792ff;
}

.card .pips span.next {
    background: #ffd54a;
    box-shadow: 0 0 6px rgba(255, 213, 74, 0.8);
}

.card .desc {
    font-size: 12.5px;
    color: #b0b0c0;
    flex: 1;
}

.card .syn {
    font-size: 11px;
    color: #ff6ee7;
    border-top: 1px solid #2c2c3e;
    padding-top: 8px;
}

.card .key {
    font-size: 11px;
    color: #666;
    text-align: right;
}

/* ---------- Layar game over ---------- */

#gameover {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    user-select: none;
    z-index: 20;
}

#gameover h1 {
    font-size: 52px;
    color: #ff5252;
    letter-spacing: 3px;
}

#gameover p {
    font-size: 18px;
    color: #ccc;
}
