/* =============================================================
   KENNENLERNSPIEL — QuizioMatch
   Same language as the Game Hub: dark base #0D0A0F, soulmate
   pink #E91E63, violet #7C4DFF, 22-24px cards, 999px pills.
   Mobile portrait is the primary case; the layout only widens.
   ============================================================= */

#klScreen {
    display: none;
    background: #0D0A0F;
    color: #e7e9ee;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

#klScreen.active {
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
    overflow: hidden;
}

/* ambient halo, like the hub */
#klScreen::before {
    content: '';
    position: absolute;
    top: -70px; left: 50%;
    width: 660px; max-width: 135%; height: 420px;
    transform: translateX(-50%);
    background:
        radial-gradient(ellipse 55% 55% at 50% 38%, rgba(233, 30, 99, 0.20) 0%, transparent 62%),
        radial-gradient(ellipse 70% 35% at 50% 0%, rgba(124, 77, 255, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    filter: blur(2px);
}
#klScreen > * { position: relative; z-index: 1; }

/* ---------- header ---------- */

.kl-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 10px 18px;
}

.kl-back {
    width: 38px; height: 38px;
    flex: 0 0 auto;
    display: grid; place-items: center;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    cursor: pointer;
}
.kl-back:active { transform: scale(0.94); }

.kl-title-wrap { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.kl-title { font-size: 17px; font-weight: 800; letter-spacing: -0.2px; }
.kl-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kl-free {
    flex: 0 0 auto;
    font-size: 10.5px; font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.14);
    color: #4ADE80;
}

.kl-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 6px 18px calc(30px + env(safe-area-inset-bottom, 0px)) 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---------- shared bits ---------- */

.kl-btn {
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    font-size: 13.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
    transition: transform .12s ease, filter .15s ease;
}
.kl-btn:active { transform: scale(0.97); }
.kl-btn--primary {
    background: linear-gradient(135deg, #E91E63, #FF4081);
    box-shadow: 0 6px 18px rgba(233, 30, 99, 0.32);
}
.kl-btn--ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.16); }
.kl-btn--flat { background: transparent; color: rgba(255, 255, 255, 0.55); font-weight: 600; }
.kl-btn--block { width: 100%; }
.kl-btn[disabled] { opacity: .5; pointer-events: none; }

.kl-empty {
    margin: auto;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    max-width: 320px;
    padding: 40px 0;
}
.kl-empty-emoji { font-size: 34px; }

.kl-note {
    font-size: 11.5px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.42);
    text-align: center;
    margin: 4px 0 0 0;
}

/* ---------- lobby ---------- */

.kl-lobby { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }

.kl-lobby-av {
    width: 108px; height: 108px;
    border-radius: 50%;
    background-size: cover; background-position: center;
    display: grid; place-items: center;
    font-size: 38px; font-weight: 800; color: #fff;
    box-shadow: 0 12px 34px rgba(233, 30, 99, 0.28);
    margin-top: 8px;
}
.kl-lobby-name { font-size: 22px; font-weight: 800; margin: 0; }
.kl-lobby-name span { font-weight: 500; color: rgba(255, 255, 255, 0.55); }
.kl-lobby-bio { margin: 0; font-size: 13.5px; color: rgba(255, 255, 255, 0.62); max-width: 330px; }
.kl-lobby-quote {
    margin: 2px 0 0 0;
    font-size: 14.5px; line-height: 1.5;
    color: #fff;
    background: rgba(233, 30, 99, 0.12);
    border: 1px solid rgba(233, 30, 99, 0.25);
    border-radius: 20px;
    padding: 12px 16px;
    max-width: 360px;
}

.kl-rules {
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column; gap: 8px;
    margin-top: 6px;
}
.kl-rule {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 13px; line-height: 1.45;
    color: rgba(255, 255, 255, 0.72);
    text-align: left;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 11px 13px;
}
.kl-rule span {
    flex: 0 0 auto;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(233, 30, 99, 0.2);
    color: #FF80AB;
    font-size: 11px; font-weight: 800;
}

.kl-lobby-actions {
    width: 100%; max-width: 380px;
    display: flex; flex-direction: column; gap: 8px;
    margin-top: 8px;
}

/* ---------- partner strip + progress ---------- */

.kl-strip { display: flex; align-items: center; gap: 9px; }
.kl-strip-av {
    width: 30px; height: 30px; border-radius: 50%;
    background-size: cover; background-position: center;
    display: grid; place-items: center;
    font-size: 13px; font-weight: 700; color: #fff;
}
.kl-strip span { font-size: 13.5px; font-weight: 700; }

.kl-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kl-dots { display: flex; gap: 6px; }
.kl-dot {
    width: 26px; height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
}
.kl-dot--done { background: linear-gradient(90deg, #E91E63, #FF4081); }
.kl-dot--now { background: rgba(255, 255, 255, 0.4); }
.kl-progress-label { font-size: 11.5px; color: rgba(255, 255, 255, 0.5); font-weight: 600; }

/* ---------- question card ---------- */

.kl-card {
    border-radius: 24px;
    padding: 22px 20px;
    background:
        linear-gradient(155deg, rgba(233, 30, 99, 0.16), rgba(124, 77, 255, 0.10)),
        rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
}
.kl-card-cat {
    display: inline-block;
    font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 8px;
}
.kl-card-cat:empty { display: none; }
.kl-question {
    margin: 0;
    font-size: 20px; line-height: 1.32; font-weight: 800; letter-spacing: -0.3px;
}
.kl-card--revealed { padding: 18px 20px; }
.kl-first {
    display: inline-block;
    margin-top: 10px;
    font-size: 11.5px; font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
}

/* ---------- covered notice ---------- */

.kl-covered {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 15px;
    border-radius: 18px;
    background: rgba(124, 77, 255, 0.10);
    border: 1px dashed rgba(124, 77, 255, 0.35);
}
.kl-covered--user {
    background: rgba(255, 255, 255, 0.035);
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.08);
}
.kl-covered-icon { font-size: 19px; }
.kl-covered div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kl-covered strong { font-size: 13px; font-weight: 700; }
.kl-covered span { font-size: 12px; line-height: 1.4; color: rgba(255, 255, 255, 0.55); }

/* ---------- answer input ---------- */

.kl-answer-box {
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 12px 10px 12px;
}
.kl-answer-box textarea {
    width: 100%;
    box-sizing: border-box;
    resize: none;
    border: none;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    outline: none;
    padding: 4px 6px;
    min-height: 92px;
}
.kl-answer-box textarea::placeholder { color: rgba(255, 255, 255, 0.32); }
.kl-answer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; }
.kl-count { font-size: 11px; color: rgba(255, 255, 255, 0.35); }

.kl-card-actions { display: flex; justify-content: space-between; gap: 8px; }

/* ---------- reveal ---------- */

.kl-answers { display: flex; flex-direction: column; gap: 10px; }
.kl-ans {
    display: flex; gap: 11px;
    padding: 14px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    animation: klReveal .35s ease both;
}
.kl-ans--profile { border-color: rgba(233, 30, 99, 0.28); background: rgba(233, 30, 99, 0.08); }
.kl-ans--user { animation-delay: .09s; }
.kl-ans-av {
    flex: 0 0 auto;
    width: 34px; height: 34px; border-radius: 50%;
    background-size: cover; background-position: center;
    display: grid; place-items: center;
    font-size: 14px; font-weight: 700; color: #fff;
}
.kl-ans-av--user { background: linear-gradient(135deg, #7C4DFF, #B388FF); }
.kl-ans-body { min-width: 0; }
.kl-ans-name { font-size: 11.5px; font-weight: 800; color: rgba(255, 255, 255, 0.55); }
.kl-ans-body p { margin: 3px 0 0 0; font-size: 15px; line-height: 1.5; word-break: break-word; }

@keyframes klReveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .kl-ans { animation: none; }
}

.kl-reacts { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.kl-react {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 12.5px; font-weight: 600; font-family: inherit;
    cursor: pointer;
}
.kl-react--on {
    background: rgba(233, 30, 99, 0.2);
    border-color: rgba(233, 30, 99, 0.5);
    color: #fff;
}

/* ---------- finish ---------- */

.kl-finish { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.kl-finish-avs { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.kl-finish-av {
    width: 74px; height: 74px; border-radius: 50%;
    background-size: cover; background-position: center;
    display: grid; place-items: center;
    font-size: 26px; font-weight: 800; color: #fff;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}
.kl-finish-av--user { background: linear-gradient(135deg, #7C4DFF, #B388FF); }
.kl-finish-heart { font-size: 22px; }
.kl-finish h2 { margin: 6px 0 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.3px; }
.kl-finish-sub { margin: 0; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.62); max-width: 360px; }

.kl-hls { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.kl-hl {
    text-align: left;
    display: flex; flex-direction: column; gap: 4px;
    padding: 12px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
}
.kl-hl-q { font-size: 12px; font-weight: 800; color: rgba(255, 255, 255, 0.55); }
.kl-hl-a { font-size: 13px; line-height: 1.45; color: rgba(255, 255, 255, 0.85); }
.kl-hl-a b { color: #FF80AB; font-weight: 700; }

.kl-finish .kl-btn--block { max-width: 420px; }

/* ---------- Game Hub section ---------- */

.kl-hub-card {
    width: 100%;
    display: flex; align-items: center; gap: 13px;
    text-align: left;
    padding: 16px;
    border-radius: 22px;
    border: 1px solid rgba(124, 77, 255, 0.3);
    background: linear-gradient(135deg, rgba(124, 77, 255, 0.16), rgba(233, 30, 99, 0.12));
    color: #fff;
    font-family: inherit;
    cursor: pointer;
}
.kl-hub-card:active { transform: scale(0.99); }
.kl-hub-emoji { font-size: 26px; flex: 0 0 auto; }
.kl-hub-body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.kl-hub-t { font-size: 14.5px; font-weight: 800; }
.kl-hub-s { font-size: 12px; line-height: 1.4; color: rgba(255, 255, 255, 0.62); }
.kl-hub-cta {
    flex: 0 0 auto;
    font-size: 11.5px; font-weight: 800;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #E91E63, #FF4081);
}
.kl-invite-rules { margin-top: 4px; opacity: .75; }

/* the profile card gets a secondary action below the quiz button */
.pc-action-btn--kl {
    margin-top: 8px;
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    color: #fff !important;
}

/* ---------- wider screens ---------- */

@media (min-width: 720px) {
    .kl-scroll { padding-left: 0; padding-right: 0; align-items: center; }
    .kl-scroll > * { width: 100%; max-width: 560px; }
    .kl-hub-cta { font-size: 12px; }
}
