:root {
    --bg: #050507;
    --card: rgba(28, 28, 32, 0.72);
    --card-border: rgba(255, 255, 255, 0.11);
    --text: #f5f5f7;
    --muted: #8e8e93;
    --accent: #ff375f;
    --gold: #ffd60a;
    --green: #30d158;
    --yellow: #ffd60a;
    --red: #ff453a;
    --orb-a: #5e5ce6;
    --orb-b: #ff375f;
    --safe-top: env(safe-area-inset-top, 44px);
    --safe-bottom: env(safe-area-inset-bottom, 24px);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", sans-serif;
}

input, textarea { user-select: text; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    overflow-x: hidden;
    padding: calc(var(--safe-top) + 12px) 18px calc(var(--safe-bottom) + 96px);
}

.ambient-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
    radial-gradient(circle at 20% 15%, rgba(255, 55, 95, 0.2), transparent 45%),
    radial-gradient(circle at 85% 30%, rgba(94, 92, 230, 0.2), transparent 50%),
    #050507;
    animation: ambientShift 14s ease-in-out infinite alternate;
}

@keyframes ambientShift {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.06) translate(-1%, 2%); }
}

body.blurred #app {
    filter: blur(28px) brightness(0.4);
    transition: filter 0.15s ease;
}

/* Floating Emoji Particle Layer */
.particle-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.float-emoji {
    position: absolute;
    font-size: 28px;
    will-change: transform, opacity;
    animation: floatUp 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes floatUp {
    0% { opacity: 0; transform: translateY(0) scale(0.4) rotate(-10deg); }
    20% { opacity: 1; transform: translateY(-30px) scale(1.15) rotate(8deg); }
    100% { opacity: 0; transform: translateY(-260px) scale(0.85) rotate(-12deg); }
}

.glass {
    background: var(--card);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.6px; margin: 0 0 4px; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.3px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 13px; margin: 0; }

.mb-4 { margin-bottom: 4px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-18 { margin-bottom: 18px; }
.mt-0 { margin-top: 0; }
.mt-14 { margin-top: 14px; }
.text-center { text-align: center; }
.uppercase { text-transform: uppercase; }

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.e2ee-badge {
    font-size: 11px;
    padding: 6px 10px;
    border-radius: 99px;
    background: rgba(48, 209, 88, 0.16);
    color: var(--green);
    font-weight: 600;
}

/* Live Partner Pulse Banner */
.pulse-banner {
    background: linear-gradient(135deg, rgba(255, 55, 95, 0.26), rgba(94, 92, 230, 0.24));
    border: 1px solid rgba(255, 55, 95, 0.45);
    border-radius: 20px;
    padding: 13px 16px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: popSpring 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popSpring {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* Thinking of You Spark Bar */
.spark-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.spark-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 10px 4px;
    color: var(--text);
    font-size: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.spark-btn span {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.spark-btn:active {
    transform: scale(0.86);
    background: rgba(255, 55, 95, 0.24);
}

/* Happiness Ring */
.ring-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ring {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--pct, 0) * 1%), rgba(255, 255, 255, 0.08) 0);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    box-shadow: 0 0 24px rgba(255, 55, 95, 0.22);
}

.ring-inner {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: #141417;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-num { font-size: 24px; font-weight: 700; }
.ring-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }

/* Bandwidth & Toggle Pills */
.pill-row { display: flex; gap: 8px; margin-top: 10px; }

.bw-pill {
    flex: 1;
    border: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 10px 8px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.bw-pill:active { transform: scale(0.94); }
.bw-pill.active-green { background: rgba(48, 209, 88, 0.22); border-color: var(--green); }
.bw-pill.active-yellow { background: rgba(255, 214, 10, 0.22); border-color: var(--yellow); }
.bw-pill.active-red { background: rgba(255, 69, 58, 0.22); border-color: var(--red); }

/* Breathing Apple Health Mood Orb */
.mood-orb {
    width: 126px;
    height: 126px;
    margin: 10px auto 18px;
    border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
    background: radial-gradient(circle at 35% 30%, var(--orb-a), var(--orb-b));
    box-shadow: 0 0 42px var(--orb-b);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    transition: background 0.35s ease, box-shadow 0.35s ease;
    animation: orbBreathe 4.5s ease-in-out infinite alternate;
}

@keyframes orbBreathe {
    0% { transform: scale(0.96); border-radius: 46% 54% 52% 48% / 50% 46% 54% 50%; }
    100% { transform: scale(1.04); border-radius: 54% 46% 48% 52% / 48% 54% 46% 52%; }
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.14);
    outline: none;
    margin: 8px 0 14px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.chip {
    padding: 7px 13px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid transparent;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease;
}

.chip:active { transform: scale(0.93); }
.chip.selected { background: rgba(255, 55, 95, 0.24); border-color: var(--accent); }

input.field, textarea.field {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 15px;
    margin-bottom: 10px;
    outline: none;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 12px;
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 16px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn:active { transform: scale(0.96); }
.btn-ghost { background: rgba(255, 255, 255, 0.1); }
.btn-sm { padding: 8px; font-size: 13px; }

/* Log Feed & Emoji Reactions */
.list-item {
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.list-item:last-child { border-bottom: none; }

.react-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.react-pill {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text);
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.react-pill:active { transform: scale(1.2); }
.react-pill.reacted {
    background: rgba(255, 55, 95, 0.24);
    border-color: var(--accent);
}

/* Touch-Draggable Desire Card */
.desire-card {
    position: relative;
    background: linear-gradient(145deg, rgba(255, 55, 95, 0.24), rgba(94, 92, 230, 0.24));
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 26px;
    padding: 28px 20px;
    text-align: center;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    touch-action: pan-y;
    will-change: transform;
}

.swipe-stamp {
    position: absolute;
    top: 16px;
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1px;
    opacity: 0;
    pointer-events: none;
}

.stamp-yes {
    left: 16px;
    color: var(--green);
    border: 2px solid var(--green);
    transform: rotate(-12deg);
}

.stamp-no {
    right: 16px;
    color: var(--red);
    border: 2px solid var(--red);
    transform: rotate(12deg);
}

.desire-tag {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--gold);
    margin-bottom: 10px;
}

.desire-text {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
}

/* Mutual Match Celebration Modal */
.match-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 200;
    display: none;
    place-items: center;
    padding: 24px;
}

.match-overlay.show {
    display: grid;
    animation: fadeUp 0.25s ease;
}

.match-modal {
    background: linear-gradient(155deg, rgba(40, 22, 34, 0.95), rgba(24, 24, 34, 0.95));
    border: 1px solid rgba(255, 55, 95, 0.45);
    border-radius: 28px;
    padding: 28px 22px;
    text-align: center;
    max-width: 340px;
    width: 100%;
    box-shadow: 0 20px 50px rgba(255, 55, 95, 0.3);
    animation: popSpring 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.match-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.2px;
    color: var(--gold);
    background: rgba(255, 214, 10, 0.14);
    padding: 6px 12px;
    border-radius: 99px;
}

/* Floating iOS Glass Bottom Dock with Sliding Pill */
.dock {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(var(--safe-bottom) + 6px);
    background: rgba(28, 28, 32, 0.84);
    backdrop-filter: blur(28px) saturate(200%);
    -webkit-backdrop-filter: blur(28px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    display: flex;
    padding: 6px;
    z-index: 50;
}

.dock-indicator {
    position: absolute;
    top: 6px;
    bottom: 6px;
    left: 6px;
    width: calc(25% - 3px);
    background: rgba(255, 255, 255, 0.13);
    border-radius: 22px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.dock button {
    position: relative;
    z-index: 1;
    flex: 1;
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 9px 4px;
    border-radius: 22px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.dock button.active { color: #fff; }

.view { display: none; }
.view.active { display: block; animation: fadeUp 0.28s cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
