.streak-sheet {
    position: fixed;
    inset: 0;
    z-index: 240;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(6, 10, 18, 0.72);
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}
.streak-sheet.is-open { display: flex; }
.streak-sheet__card {
    width: min(440px, 100%);
    max-height: min(920px, 100%);
    overflow: auto;
    background: #101722;
    color: #f8fafc;
    border-radius: 28px 28px 22px 22px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    padding: 18px 18px 22px;
    font-family: Inter, system-ui, sans-serif;
}
.streak-sheet__head {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 4px 44px 0;
    margin-bottom: 10px;
}
.streak-sheet__logo {
    display: block;
    height: 34px;
    width: auto;
    max-width: min(210px, 64vw);
}
.streak-sheet__head h2 {
    margin: 0;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}
[data-streak-open] { cursor: pointer; }
.streak-sheet__close {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #1c2636;
    color: #e5e7eb;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.streak-hero {
    position: relative;
    height: 168px;
    display: grid;
    place-items: center;
    margin: 6px 0 0;
}
.streak-flame,
.streak-ice {
    width: 128px;
    height: 150px;
    filter: drop-shadow(0 16px 18px rgba(0, 0, 0, 0.35));
}
.streak-flame { animation: streak-flicker 1.6s ease-in-out infinite; }
.streak-ice { animation: streak-float 2.8s ease-in-out infinite; }
.streak-ice__shine {
    transform-origin: center;
    animation: streak-shimmer 2.4s linear infinite;
}
.streak-embers {
    position: absolute;
    inset: 18px 0 auto;
    height: 80px;
    pointer-events: none;
}
.streak-embers i {
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 7px;
    height: 7px;
    margin-left: -3px;
    border-radius: 50%;
    background: #fbbf24;
    opacity: 0;
    animation: streak-ember 1.8s ease-out infinite;
}
.streak-embers i:nth-child(2) { margin-left: -18px; animation-delay: .4s; }
.streak-embers i:nth-child(3) { margin-left: 12px; animation-delay: .8s; background: #fb7185; }
.streak-count {
    margin: 0;
    text-align: center;
    font-size: 84px;
    line-height: 0.9;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: #f5c451;
}
.streak-sheet.is-ice .streak-count { color: #7dd3fc; }
.streak-count-label,
.streak-goal-line,
.streak-message {
    margin: 0;
    text-align: center;
}
.streak-count-label {
    color: #f5c451;
    font-size: 22px;
    font-weight: 800;
}
.streak-sheet.is-ice .streak-count-label { color: #7dd3fc; }
.streak-meta {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: end;
    margin: 22px 8px 8px;
}
.streak-meta p {
    margin: 0;
    color: #9aa3b2;
    font-size: 13px;
    font-weight: 600;
}
.streak-meta strong {
    display: block;
    margin-top: 4px;
    color: #f5c451;
    font-size: 16px;
}
.streak-sheet.is-ice .streak-meta strong { color: #bae6fd; }
.streak-meta__rule {
    width: 42px;
    height: 1px;
    background: #334155;
    margin-bottom: 10px;
}
.streak-goal-line {
    color: #cbd5e1;
    font-size: 15px;
    font-weight: 600;
    margin-top: 8px;
}
.streak-message {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.45;
    margin: 10px 12px 0;
}
.streak-week {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin: 22px 0 18px;
    padding: 0;
}
.streak-week li {
    display: grid;
    justify-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
}
.streak-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
}
.streak-mark svg { width: 32px; height: 32px; }
.streak-mark.is-empty {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2a3344;
    margin-top: 2px;
}
.streak-mark.is-fire svg { animation: streak-pop .45s ease both; }
.streak-mark.is-ice svg { animation: streak-pop .45s ease both; }
.streak-rows { display: grid; gap: 10px; }
.streak-row,
.streak-goal-btn,
.streak-back {
    width: 100%;
    border: 0;
    background: #1a2333;
    color: #f8fafc;
    border-radius: 16px;
    min-height: 58px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
}
.streak-row span:last-child,
.streak-goal-btn span { color: #94a3b8; font-weight: 600; }
.streak-panel { display: grid; gap: 12px; }
.streak-panel[hidden],
.streak-main[hidden] { display: none; }
.streak-panel p {
    margin: 0;
    color: #cbd5e1;
    line-height: 1.5;
    font-size: 15px;
}
.streak-back { justify-content: flex-start; gap: 8px; min-height: 46px; }
.streak-goal-btn.is-current {
    outline: 2px solid #f5c451;
    color: #f5c451;
}
@keyframes streak-flicker {
    0%, 100% { transform: scale(1) rotate(-1.5deg); }
    45% { transform: scale(1.05, 0.96) rotate(1.5deg); }
    70% { transform: scale(0.98, 1.04) rotate(-1deg); }
}
@keyframes streak-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
@keyframes streak-shimmer {
    0% { opacity: 0.25; transform: translateX(-8px); }
    50% { opacity: 0.9; transform: translateX(8px); }
    100% { opacity: 0.25; transform: translateX(-8px); }
}
@keyframes streak-ember {
    0% { transform: translateY(8px) scale(0.6); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(-52px) scale(0.3); opacity: 0; }
}
@keyframes streak-pop {
    from { transform: scale(0.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@media (max-width: 640px) {
    .streak-sheet {
        padding: 0;
        align-items: stretch;
    }
    .streak-sheet__card {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    }
}
/* Home Screen draws under the clock and frosts that band. Paint it solid,
   and start the logo and title below it so nothing is cut off. */
html.is-standalone .streak-sheet.is-open::before {
    content: "";
    position: fixed;
    z-index: 260;
    top: 0;
    left: 0;
    width: 100%;
    height: 12px;
    background: #101722;
    pointer-events: none;
}
html.is-standalone .streak-sheet__card {
    padding-top: calc(28px + max(env(safe-area-inset-top, 0px), 59px));
    padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
}
@media (display-mode: standalone), (display-mode: fullscreen) {
    .streak-sheet.is-open::before {
        content: "";
        position: fixed;
        z-index: 260;
        top: 0;
        left: 0;
        width: 100%;
        height: 12px;
        background: #101722;
        pointer-events: none;
    }
    .streak-sheet__card {
        padding-top: calc(28px + max(env(safe-area-inset-top, 0px), 59px));
        padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    }
}
@media (prefers-reduced-motion: reduce) {
    .streak-flame,
    .streak-ice,
    .streak-ice__shine,
    .streak-embers i,
    .streak-mark.is-fire svg,
    .streak-mark.is-ice svg { animation: none; }
}
