.streak-card.streak-card-v4 {
    --streak-accent: var(--primary);
    --streak-card-tint: rgba(99, 102, 241, 0.08);
    --streak-card-tint-strong: rgba(99, 102, 241, 0.14);
    --streak-card-glow: rgba(99, 102, 241, 0.12);
    --streak-pill-glow: rgba(99, 102, 241, 0.2);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 24px;
    margin-bottom: 16px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.76);
    background:
        radial-gradient(circle at 15% 12%, color-mix(in srgb, var(--streak-accent) 24%, #fff7ed 76%) 0%, transparent 27%),
        radial-gradient(circle at 88% 8%, var(--streak-card-tint-strong), transparent 38%),
        radial-gradient(circle at 74% 86%, var(--streak-card-tint), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.96) 100%);
    box-shadow:
        0 18px 40px var(--streak-card-glow),
        0 10px 24px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.streak-card.streak-card-v4::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 0% 100%, var(--streak-card-tint), transparent 32%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, transparent 38%),
        linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.42) 42%, transparent 56%);
    pointer-events: none;
}

.streak-card.streak-card-v4::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, var(--streak-card-tint-strong) 52%, transparent 100%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
}

.streak-card.streak-card-v4.is-week-complete {
    box-shadow:
        0 18px 40px color-mix(in srgb, var(--streak-card-glow) 80%, rgba(34, 197, 94, 0.16)),
        0 10px 24px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.streakv4-shell {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.streakv4-hero {
    display: grid;
    grid-template-columns: minmax(150px, 184px) minmax(0, 1fr);
    gap: 18px;
    align-items: center;
}

.streakv4-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.streakv4-score-visual {
    --streak-number-start: #94a3b8;
    --streak-number-end: #64748b;
    --streak-number-glow: rgba(148, 163, 184, 0.24);
    --streak-spark-color: #cbd5e1;
    --streak-beam-color: #e2e8f0;
    --streak-beam-opacity: 0.2;
    --streak-spark-opacity: 0.24;
    --streak-spark-scale: 1;
    --streak-number-scale: 1;
    --streak-spark-duration: 3.6s;
    --streak-beam-duration: 5.6s;
    --streak-orbit-duration: 9s;
    --streak-drift-duration: 5s;
    --streak-aura-opacity: 0.28;
    --streak-orbit-opacity: 0.24;
    --streak-orbit-scale: 1;
    --streak-number-lift: -10px;
    position: relative;
    width: 100%;
    min-height: 158px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 14px 8px;
    overflow: visible;
}

.streakv4-score-aura {
    position: absolute;
    left: 50%;
    bottom: -8px;
    width: 138px;
    height: 138px;
    border-radius: 999px;
    transform: translateX(-50%) scale(var(--streak-orbit-scale));
    background:
        radial-gradient(circle, color-mix(in srgb, var(--streak-beam-color) 38%, transparent 62%) 0%, transparent 62%),
        conic-gradient(from 120deg, transparent 0deg, color-mix(in srgb, var(--streak-beam-color) 48%, transparent 52%) 72deg, transparent 140deg, color-mix(in srgb, var(--streak-beam-color) 34%, transparent 66%) 220deg, transparent 360deg);
    filter: blur(1px);
    opacity: var(--streak-aura-opacity);
    pointer-events: none;
    animation: streakv4-aura-breathe var(--streak-drift-duration) ease-in-out infinite;
}

.streakv4-score-orbit {
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 126px;
    height: 126px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--streak-beam-color) 52%, transparent 48%);
    opacity: var(--streak-orbit-opacity);
    transform: translateX(-50%) scale(var(--streak-orbit-scale));
    pointer-events: none;
    animation: streakv4-orbit-spin var(--streak-orbit-duration) linear infinite;
}

.streakv4-score-orbit span {
    position: absolute;
    top: 9px;
    left: 50%;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--streak-spark-color);
    box-shadow:
        0 0 0 5px color-mix(in srgb, var(--streak-spark-color) 16%, transparent 84%),
        0 0 18px color-mix(in srgb, var(--streak-spark-color) 62%, transparent 38%);
    transform: translateX(-50%);
}

.streakv4-score-orbit.orbit-b {
    width: 96px;
    height: 96px;
    bottom: 12px;
    border-style: dashed;
    animation-duration: calc(var(--streak-orbit-duration) * 0.72);
    animation-direction: reverse;
}

.streakv4-score-orbit.orbit-b span {
    top: 5px;
    width: 6px;
    height: 6px;
}

.streakv4-score-number {
    position: relative;
    z-index: 2;
    display: inline-block;
    font-family: "Nunito", "Inter", sans-serif;
    font-size: clamp(98px, 15.8vw, 126px);
    font-weight: 900;
    line-height: 0.82;
    letter-spacing: -0.08em;
    padding-right: 0.12em;
    margin-right: -0.12em;
    transform-origin: center bottom;
    transform: translateY(var(--streak-number-lift)) scale(var(--streak-number-scale));
    background: linear-gradient(180deg, var(--streak-number-start) 0%, var(--streak-number-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter:
        drop-shadow(0 0 18px var(--streak-number-glow))
        drop-shadow(0 14px 22px rgba(15, 23, 42, 0.06));
    animation: streakv4-number-pulse var(--streak-beam-duration) ease-in-out infinite;
}

.streakv4-score-visual[data-digits="2"] .streakv4-score-number {
    font-size: clamp(92px, 13.6vw, 116px);
}

.streakv4-score-visual[data-digits="3"] .streakv4-score-number,
.streakv4-score-visual[data-digits="4"] .streakv4-score-number {
    font-size: clamp(58px, 11vw, 76px);
}

.streakv4-score-beam {
    position: absolute;
    left: 48%;
    bottom: 4px;
    transform: translateX(-50%);
    pointer-events: none;
    opacity: var(--streak-beam-opacity);
    animation: streakv4-beam-sway var(--streak-beam-duration) ease-in-out infinite;
}

.streakv4-score-beam.beam-back {
    width: 30px;
    height: 132px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, var(--streak-beam-color) 38%, rgba(255, 255, 255, 0) 100%);
    clip-path: polygon(50% 0%, 88% 54%, 50% 100%, 12% 54%);
    filter: blur(0.2px);
}

.streakv4-score-beam.beam-front {
    left: 62%;
    width: 16px;
    height: 76px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, color-mix(in srgb, var(--streak-beam-color) 70%, white 30%) 50%, rgba(255, 255, 255, 0) 100%);
    clip-path: polygon(50% 0%, 84% 52%, 50% 100%, 16% 52%);
    opacity: calc(var(--streak-beam-opacity) * 0.78);
    animation-direction: reverse;
}

.streakv4-score-spark {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.98) 0%, var(--streak-spark-color) 38%, transparent 76%);
    box-shadow: 0 0 14px color-mix(in srgb, var(--streak-spark-color) 54%, transparent 46%);
    opacity: var(--streak-spark-opacity);
    transform: scale(var(--streak-spark-scale));
    pointer-events: none;
    animation: streakv4-spark-float var(--streak-spark-duration) linear infinite;
}

.streakv4-score-spark.spark-a {
    top: 16px;
    left: 38px;
    width: 3px;
    height: 18px;
    border-radius: 999px;
    animation-delay: -0.2s;
}

.streakv4-score-spark.spark-b {
    top: 22px;
    left: 62px;
    width: 5px;
    height: 5px;
    animation-delay: -1.1s;
}

.streakv4-score-spark.spark-c {
    top: 10px;
    left: 90px;
    width: 14px;
    height: 3px;
    border-radius: 999px;
    animation-delay: -1.8s;
}

.streakv4-score-spark.spark-d {
    top: 34px;
    left: 122px;
    width: 4px;
    height: 4px;
    animation-delay: -2.4s;
}

.streakv4-score-spark.spark-e {
    top: 28px;
    left: 142px;
    width: 12px;
    height: 3px;
    border-radius: 999px;
    animation-delay: -0.9s;
}

.streakv4-score-spark.spark-f {
    top: 0;
    left: 118px;
    width: 5px;
    height: 5px;
    animation-delay: -2.9s;
}

.streakv4-score-visual.is-calm .spark-e,
.streakv4-score-visual.is-calm .spark-f {
    opacity: 0;
}

.streakv4-score-visual.is-awake .spark-f {
    opacity: calc(var(--streak-spark-opacity) * 0.6);
}

.streakv4-score-visual.is-elite .streakv4-score-spark,
.streakv4-score-visual.is-legendary .streakv4-score-spark,
.streakv4-score-visual.is-titan .streakv4-score-spark {
    box-shadow:
        0 0 18px color-mix(in srgb, var(--streak-spark-color) 62%, transparent 38%),
        0 0 28px color-mix(in srgb, var(--streak-spark-color) 30%, transparent 70%);
}

.streakv4-score-visual.is-titan .streakv4-score-number {
    filter:
        drop-shadow(0 0 22px var(--streak-number-glow))
        drop-shadow(0 16px 24px rgba(15, 23, 42, 0.07));
}

.streakv4-score-label {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: rgba(100, 116, 139, 0.7);
}

.streakv4-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.streakv4-level-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.streakv4-level-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid color-mix(in srgb, var(--streak-accent) 18%, white 82%);
    box-shadow:
        0 10px 18px color-mix(in srgb, var(--streak-accent) 13%, transparent 87%),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
    font-size: 24px;
    line-height: 1;
    flex-shrink: 0;
}

.streakv4-level-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 52px;
    padding: 0 24px;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, color-mix(in srgb, var(--streak-level-color, var(--primary)) 82%, white 18%) 0%, var(--streak-level-color, var(--primary)) 100%);
    box-shadow:
        0 12px 24px var(--streak-pill-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 8px rgba(0, 0, 0, 0.12);
}

.streakv4-level-pill span {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.streakv4-level-description {
    font-size: 14px;
    font-style: italic;
    color: #475569;
}

.streakv4-progress {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.streakv4-progress-track {
    position: relative;
    height: 16px;
    overflow: hidden;
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(226, 232, 240, 0.92) 100%);
    border: 1px solid rgba(255, 255, 255, 0.86);
    box-shadow:
        inset 0 2px 5px rgba(15, 23, 42, 0.08),
        0 6px 12px rgba(148, 163, 184, 0.12);
}

.streakv4-progress-fill {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: inherit;
    transition: width 0.45s ease;
    box-shadow:
        0 8px 18px color-mix(in srgb, var(--streak-accent) 34%, transparent 66%),
        inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.streakv4-next-level {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.streakv4-next-level strong {
    color: var(--text-primary);
}

.streakv4-next-level-mark {
    color: color-mix(in srgb, var(--streak-accent) 88%, white 12%);
    font-size: 15px;
    line-height: 1;
}

.streakv4-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(226, 232, 240, 0.95) 16%, rgba(226, 232, 240, 0.95) 84%, transparent 100%);
}

.streakv4-week {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.streakv4-section-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1e293b;
}

.streakv4-week-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 152px;
    gap: 18px;
    align-items: start;
}

.streakv4-week-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.streakv4-week-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-secondary);
}

.streakv4-week-status strong {
    font-size: 20px;
    line-height: 1;
    color: var(--text-primary);
}

.streakv4-week-status.is-success strong,
.streakv4-week-status.is-success .streakv4-week-status-text {
    color: #166534;
}

.streakv4-week-status.is-success .streakv4-week-status-icon {
    color: #16a34a;
}

.streakv4-week-status-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    color: var(--text-primary);
}

.streakv4-week-status-icon svg {
    width: 100%;
    height: 100%;
}

.streakv4-week-status-sep {
    color: var(--text-muted);
}

.streakv4-week-status-text {
    font-size: 13px;
    font-weight: 700;
}

.streakv4-session-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(56px, 56px));
    gap: 12px;
}

.streakv4-session-indicator {
    width: 56px;
    height: 56px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(191, 204, 219, 0.86);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.92));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.88),
        0 6px 14px rgba(148, 163, 184, 0.12);
}

.streakv4-session-indicator svg {
    width: 22px;
    height: 22px;
}

.streakv4-session-indicator.is-filled {
    border-color: #16a34a;
    background: linear-gradient(135deg, var(--success) 0%, #16a34a 100%);
    color: #ffffff;
    box-shadow:
        0 10px 18px rgba(34, 197, 94, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.34),
        inset 0 -2px 8px rgba(21, 128, 61, 0.22);
}

.streakv4-week-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    text-align: right;
}

.streakv4-shields-header {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

.streakv4-shields-label {
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 13px;
}

.streakv4-shields-count {
    color: color-mix(in srgb, var(--streak-accent) 88%, var(--primary) 12%);
    font-weight: 900;
    font-size: 18px;
    line-height: 1;
}

.streakv4-shields-row {
    display: flex;
    gap: 12px;
}

.streakv4-shield {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.streakv4-shield svg {
    width: 100%;
    height: 100%;
}

.streakv4-shield.is-filled {
    color: color-mix(in srgb, var(--streak-accent) 92%, var(--primary) 8%);
    filter: drop-shadow(0 6px 10px color-mix(in srgb, var(--streak-accent) 26%, transparent 74%));
}

.streakv4-shield.is-half {
    color: color-mix(in srgb, var(--streak-accent) 56%, white 44%);
}

.streakv4-shield.is-empty {
    color: rgba(191, 204, 219, 0.84);
}

.streakv4-shields-hint {
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-muted);
}

.streakv4-shields-hint.is-full {
    color: color-mix(in srgb, var(--streak-accent) 88%, var(--primary) 12%);
    font-weight: 700;
}

.streakv4-protected {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
}

.streak-card.streak-card-v4.celebrating .streakv4-score-number {
    animation: streakv4-number-burst 0.75s ease;
}

.streak-card.streak-card-v4.celebrating .streakv4-score-spark {
    animation-duration: 1.1s;
    opacity: calc(var(--streak-spark-opacity) * 1.18);
}

.streak-card.streak-card-v4.celebrating .streakv4-score-aura,
.streak-card.streak-card-v4.celebrating .streakv4-score-orbit {
    animation-duration: 0.95s;
    opacity: calc(var(--streak-orbit-opacity) * 1.22);
}

html,
body,
#app,
.home-content,
.streak-card.streak-card-v4 {
    overflow-x: clip;
    max-width: 100%;
}

@keyframes streakv4-number-pulse {
    0%,
    100% {
        transform: translateY(var(--streak-number-lift)) scale(var(--streak-number-scale));
    }
    50% {
        transform: translateY(var(--streak-number-lift)) scale(calc(var(--streak-number-scale) + 0.018));
    }
}

@keyframes streakv4-beam-sway {
    0%,
    100% {
        transform: translateX(-50%) translateY(0) scaleY(0.96);
        opacity: calc(var(--streak-beam-opacity) * 0.84);
    }
    50% {
        transform: translateX(-50%) translateY(-4px) scaleY(1.04);
        opacity: var(--streak-beam-opacity);
    }
}

@keyframes streakv4-spark-float {
    0% {
        transform: translate3d(0, 0, 0) scale(var(--streak-spark-scale));
        opacity: 0;
    }
    18% {
        opacity: var(--streak-spark-opacity);
    }
    100% {
        transform: translate3d(0, -12px, 0) scale(calc(var(--streak-spark-scale) * 0.86));
        opacity: 0;
    }
}

@keyframes streakv4-aura-breathe {
    0%,
    100% {
        transform: translateX(-50%) scale(calc(var(--streak-orbit-scale) * 0.94));
        opacity: calc(var(--streak-aura-opacity) * 0.72);
    }
    50% {
        transform: translateX(-50%) scale(calc(var(--streak-orbit-scale) * 1.06));
        opacity: var(--streak-aura-opacity);
    }
}

@keyframes streakv4-orbit-spin {
    0% {
        transform: translateX(-50%) scale(var(--streak-orbit-scale)) rotate(0deg);
    }
    100% {
        transform: translateX(-50%) scale(var(--streak-orbit-scale)) rotate(360deg);
    }
}

@keyframes streakv4-number-burst {
    0% {
        transform: translateY(var(--streak-number-lift)) scale(var(--streak-number-scale));
    }
    35% {
        transform: translateY(var(--streak-number-lift)) scale(calc(var(--streak-number-scale) + 0.08));
    }
    100% {
        transform: translateY(var(--streak-number-lift)) scale(var(--streak-number-scale));
    }
}

@media (max-width: 720px) {
    .streakv4-hero {
        grid-template-columns: minmax(138px, 0.45fr) minmax(0, 1fr);
        gap: 14px;
    }

    .streakv4-week-grid {
        grid-template-columns: minmax(0, 1fr) minmax(116px, auto);
        gap: 14px;
    }

    .streakv4-week-side {
        align-items: flex-end;
        text-align: right;
    }

    .streakv4-shields-header {
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    .streak-card.streak-card-v4 {
        padding: 18px;
    }

    .streakv4-shell {
        gap: 16px;
    }

    .streakv4-hero {
        grid-template-columns: minmax(126px, 0.46fr) minmax(0, 1fr);
        gap: 10px;
    }

    .streakv4-score-visual {
        min-height: 132px;
        padding: 0 10px 8px;
    }

    .streakv4-score-number {
        font-size: 90px;
    }

    .streakv4-score-visual[data-digits="2"] .streakv4-score-number {
        font-size: 88px;
    }

    .streakv4-score-aura {
        width: 112px;
        height: 112px;
    }

    .streakv4-score-orbit {
        width: 104px;
        height: 104px;
    }

    .streakv4-score-orbit.orbit-b {
        width: 78px;
        height: 78px;
    }

    .streakv4-level-row {
        gap: 8px;
    }

    .streakv4-level-icon {
        width: 34px;
        height: 34px;
        border-radius: 12px;
        font-size: 22px;
    }

    .streakv4-level-pill {
        min-height: 44px;
        padding: 0 18px;
    }

    .streakv4-level-pill span {
        font-size: 12px;
    }

    .streakv4-level-description {
        font-size: 13px;
    }

    .streakv4-progress-track {
        height: 14px;
    }

    .streakv4-next-level {
        font-size: 12px;
    }

    .streakv4-week-grid {
        grid-template-columns: minmax(0, 1fr) minmax(106px, auto);
        gap: 12px;
    }

    .streakv4-session-row {
        grid-template-columns: repeat(auto-fit, minmax(48px, 48px));
        gap: 9px;
    }

    .streakv4-session-indicator {
        width: 48px;
        height: 48px;
        border-radius: 17px;
    }

    .streakv4-shields-row {
        gap: 9px;
    }

    .streakv4-shield {
        width: 25px;
        height: 25px;
    }
}

@media (max-width: 360px) {
    .streak-card.streak-card-v4 {
        padding: 16px;
    }

    .streakv4-hero {
        grid-template-columns: minmax(112px, 0.44fr) minmax(0, 1fr);
        gap: 8px;
    }

    .streakv4-score-visual {
        min-height: 118px;
        padding: 0 8px 6px;
    }

    .streakv4-score-number,
        .streakv4-score-visual[data-digits="2"] .streakv4-score-number {
        font-size: 76px;
    }

    .streakv4-session-row {
        grid-template-columns: repeat(auto-fit, minmax(42px, 42px));
        gap: 8px;
    }

    .streakv4-session-indicator {
        width: 42px;
        height: 42px;
        border-radius: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .streakv4-score-number,
        .streakv4-score-beam,
        .streakv4-score-spark,
        .streakv4-score-aura,
        .streakv4-score-orbit {
        animation: none !important;
    }
}
