/* uPirate Ordslungan - fyller hela fönstret, inga bildfiler */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0f1d2b;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

#scene {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

.layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------------- spelet */

.hud-top {
    position: absolute;
    top: env(safe-area-inset-top, 0);
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px;
}

.question-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 26px;
    border-radius: 999px;
    background: rgba(12, 26, 40, 0.72);
    border: 2px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.question-card.bump { transform: scale(1.06); border-color: rgba(255, 255, 255, 0.5); }

.q-flag { font-size: 30px; line-height: 1; }

.q-word {
    font-size: 34px;
    font-weight: 700;
    color: #f4f8fb;
    letter-spacing: 0.4px;
}

.hud-stats { display: flex; gap: 10px; }

.stat {
    min-width: 74px;
    padding: 8px 14px;
    border-radius: 14px;
    background: rgba(12, 26, 40, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-align: center;
    backdrop-filter: blur(6px);
}

.stat-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #9fb4c8; }
.stat-value { display: block; font-size: 22px; font-weight: 700; color: #ffffff; }

.pair-flash {
    position: absolute;
    left: 50%;
    top: 22%;
    transform: translate(-50%, -12px) scale(0.92);
    padding: 12px 30px;
    border-radius: 16px;
    font-size: 30px;
    font-weight: 700;
    color: #0d2a17;
    background: linear-gradient(180deg, #d6ffe7, #a8f0c6);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.hint {
    position: absolute;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    padding: 8px 20px;
    border-radius: 999px;
    background: rgba(12, 26, 40, 0.55);
    color: #cfe0ef;
    font-size: 15px;
    transition: opacity 0.4s ease;
}

.hint.fade { opacity: 0; }

.hud-bottom {
    position: absolute;
    right: 18px;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(12, 26, 40, 0.66);
    color: #eaf3fb;
    font-size: 20px;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

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

/* ------------------------------------------------------------ paneler */

.overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: radial-gradient(circle at 50% 30%, rgba(12, 30, 46, 0.55), rgba(6, 14, 22, 0.88));
    backdrop-filter: blur(3px);
    pointer-events: auto;
    overflow-y: auto;
}

.panel {
    width: min(520px, 100%);
    padding: 30px 28px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(20, 42, 62, 0.96), rgba(12, 26, 40, 0.96));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    text-align: center;
    color: #eaf3fb;
}

.title { margin: 0 0 6px; font-size: 34px; }
.subtitle { margin: 0 0 22px; color: #a8c0d4; font-size: 15px; }

.field { text-align: left; margin-bottom: 18px; }
.field label { display: block; margin-bottom: 8px; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; color: #9fb4c8; }

select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(8, 18, 28, 0.9);
    color: #eaf3fb;
    font-size: 16px;
}

.dir-group { display: flex; flex-wrap: wrap; gap: 8px; }

.dir-btn {
    flex: 1 1 auto;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(8, 18, 28, 0.7);
    color: #cfe0ef;
    font-size: 14px;
    cursor: pointer;
}

.dir-btn.active {
    background: linear-gradient(180deg, #37d67a, #22a95c);
    border-color: #6ef0a4;
    color: #06231a;
    font-weight: 700;
}

.primary-btn {
    width: 100%;
    padding: 18px;
    margin-top: 6px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffd260, #f0a92c);
    color: #3a2405;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 14px 30px rgba(240, 169, 44, 0.28);
}

.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: 0.55; cursor: default; box-shadow: none; }

.ghost-btn {
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #cfe0ef;
    font-size: 16px;
    cursor: pointer;
}

.status { min-height: 20px; margin: 12px 0 0; font-size: 14px; color: #ffc9c9; }

.garden-summary { margin-top: 16px; font-size: 14px; color: #a8c0d4; }
.garden-summary b { color: #ffe6a8; }

.end-stats { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.end-stat {
    flex: 1;
    padding: 16px;
    border-radius: 16px;
    background: rgba(8, 18, 28, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.end-stat span { display: block; font-size: 38px; font-weight: 700; color: #ffe6a8; }
.end-stat small { color: #9fb4c8; font-size: 13px; }

.harvest { font-size: 17px; color: #b8f5cf; }

.end-buttons { margin-top: 8px; }

@media (max-width: 560px) {
    .q-word { font-size: 26px; }
    .q-flag { font-size: 24px; }
    .question-card { padding: 10px 18px; }
    .hud-stats { gap: 6px; }
    .stat { min-width: 60px; padding: 6px 10px; }
    .stat-value { font-size: 18px; }
    .title { font-size: 27px; }
    .pair-flash { font-size: 22px; padding: 10px 20px; }
    .hint { font-size: 13px; }
}
