/* The night mode is intentionally scoped to /tonight. It keeps the rest of Goutilizer calm and clinical. */
.tonight-scene,
.tonight-sheet {
    --night-ink: #140d1f;
    --night-panel: rgba(35, 20, 48, .92);
    --night-panel-deep: rgba(20, 11, 31, .96);
    --night-plum: #5e2b68;
    --night-wine: #8f214d;
    --night-gold: #f4bd5a;
    --night-ivory: #fff0d3;
}

.tonight-scene {
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
    margin-bottom: 2rem;
    padding: clamp(1rem, 3vw, 2.25rem) !important;
    color: var(--night-ivory);
    border: 1px solid rgba(244, 189, 90, .35);
    border-radius: 28px;
    background:
        radial-gradient(circle at 88% 6%, rgba(244, 189, 90, .18) 0, transparent 22rem),
        radial-gradient(circle at 4% 82%, rgba(143, 33, 77, .3) 0, transparent 28rem),
        linear-gradient(135deg, #100817 0%, #25112f 52%, #120916 100%);
    box-shadow: 0 24px 60px rgba(22, 5, 30, .28), inset 0 0 0 1px rgba(255, 240, 211, .04);
}

.tonight-scene::before,
.tonight-scene::after {
    position: absolute;
    z-index: 0;
    color: rgba(244, 189, 90, .08);
    font-family: Georgia, serif;
    line-height: 1;
    pointer-events: none;
    content: "✦  ☾  ✦";
}

.tonight-scene::before {
    top: 1.5rem;
    right: 1.75rem;
    font-size: clamp(2rem, 6vw, 5rem);
    letter-spacing: .2em;
}

.tonight-scene::after {
    bottom: 1rem;
    left: 1.5rem;
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    transform: rotate(180deg);
}

.tonight-scene > * {
    position: relative;
    z-index: 1;
}

.tonight-hero {
    padding: 0 .25rem .75rem;
}

.tonight-sigil {
    display: grid;
    flex: none;
    width: 2.25rem;
    height: 2.25rem;
    place-items: center;
    color: #2d1029;
    border: 1px solid rgba(255, 240, 211, .75);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #ffe5a2, var(--night-gold) 48%, #a44c4c 100%);
    box-shadow: 0 0 26px rgba(244, 189, 90, .55), inset 0 0 10px rgba(74, 20, 54, .45);
}

.tonight-title {
    color: var(--night-ivory) !important;
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 700 !important;
    letter-spacing: .05em;
    text-shadow: 0 2px 14px rgba(244, 189, 90, .28);
}

/* Status strip: the numbers come first, decoration stays quiet. */
.tonight-scene .tonight-status {
    padding: .85rem 1rem;
    color: var(--night-ivory);
}

.tonight-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    align-items: flex-start;
    justify-content: space-between;
}

.tonight-status-peak {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.tonight-scene .tonight-count {
    color: var(--night-ivory) !important;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.tonight-scene .tonight-peak {
    color: var(--night-ivory) !important;
    font-weight: 700;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.tonight-scene .tonight-omen {
    font-style: italic;
}

/* Risk chips keep their meaning colour; the text label carries the meaning too. */
.tonight-scene .mud-chip.tonight-risk {
    margin: .25rem 0 0;
    color: #1d0f19;
    font-weight: 700;
}

.tonight-scene .mud-chip.tonight-risk-high {
    color: #fff3d6;
    background: #c62f45 !important;
}

.tonight-scene .mud-chip.tonight-risk-moderate {
    background: #f29a3a !important;
}

.tonight-scene .mud-chip.tonight-risk-slightly {
    background: #8fc3e8 !important;
}

.tonight-scene .mud-chip.tonight-risk-low {
    background: #8fd6a4 !important;
}

.tonight-scene .tonight-section-title {
    color: var(--night-ivory) !important;
    font-weight: 700;
}

.tonight-secondary-button {
    min-height: 44px;
}

.tonight-scene .tonight-card {
    overflow: hidden;
    color: var(--night-ivory);
    border: 1px solid rgba(244, 189, 90, .22);
    border-radius: 18px;
    background: linear-gradient(145deg, var(--night-panel), var(--night-panel-deep)) !important;
    box-shadow: 0 14px 32px rgba(10, 4, 16, .25), inset 0 1px 0 rgba(255, 240, 211, .05);
}

.tonight-scene .tonight-card .mud-card-header {
    border-bottom: 1px solid rgba(244, 189, 90, .13);
    background: linear-gradient(90deg, rgba(143, 33, 77, .15), transparent 70%);
}

.tonight-scene .mud-typography {
    color: inherit;
}

.tonight-scene .mud-typography.mud-typography-caption,
.tonight-scene .mud-typography.mud-typography-body2 {
    color: rgba(255, 240, 211, .72);
}

.tonight-scene .mud-chip {
    color: #2a1423;
    border: 1px solid rgba(255, 240, 211, .64);
    background: linear-gradient(135deg, #ffd886, var(--night-gold)) !important;
    box-shadow: 0 0 14px rgba(244, 189, 90, .18);
}

.tonight-drink-button.mud-button-filled {
    position: relative;
    overflow: hidden;
    min-height: 76px;
    height: 100%;
    padding: .5rem .5rem;
    touch-action: manipulation;
    text-transform: none;
    color: #2a1423 !important;
    border: 1px solid rgba(255, 240, 211, .72);
    background: linear-gradient(135deg, #b13d5c 0%, #7b2352 48%, #4d1e5d 100%) !important;
    box-shadow: 0 9px 20px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .24);
    transition: transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

.tonight-drink-button.mud-button-filled::after {
    position: absolute;
    top: -80%;
    left: -15%;
    width: 28%;
    height: 260%;
    background: rgba(255, 234, 177, .28);
    content: "";
    transform: rotate(22deg);
}

.tonight-drink-button.mud-button-filled:hover {
    filter: brightness(1.1) saturate(1.08);
    box-shadow: 0 14px 28px rgba(0, 0, 0, .38), 0 0 20px rgba(177, 61, 92, .3);
    transform: translateY(-2px);
}

.tonight-drink-button .mud-typography {
    color: #fff3d6 !important;
    text-shadow: 0 1px 3px rgba(31, 6, 25, .6);
}

/* Room on both sides (keeps the name centred) so the corner badge never covers a long name. */
.tonight-drink-button .tonight-drink-name {
    padding-inline: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

/* Tonight's count for this favourite, e.g. "×2". */
.tonight-drink-badge {
    position: absolute;
    top: .3rem;
    right: .4rem;
    z-index: 1;
    padding: 0 .4rem;
    color: #2a1423;
    border-radius: 999px;
    background: var(--night-gold);
    font-size: .8rem;
    font-weight: 700;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}

/* Short tap feedback. Two identical animations let a repeated tap restart it. */
.tonight-drink-button.tonight-pulse-a {
    animation: tonight-pulse-a 180ms ease-out;
}

.tonight-drink-button.tonight-pulse-b {
    animation: tonight-pulse-b 180ms ease-out;
}

@keyframes tonight-pulse-a {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 189, 90, .8); }
    45% { transform: scale(.95); }
    100% { transform: scale(1); box-shadow: 0 0 0 12px rgba(244, 189, 90, 0); }
}

@keyframes tonight-pulse-b {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(244, 189, 90, .8); }
    45% { transform: scale(.95); }
    100% { transform: scale(1); box-shadow: 0 0 0 12px rgba(244, 189, 90, 0); }
}

.tonight-empty-state,
.tonight-drink-log {
    color: var(--night-ivory);
    border-color: rgba(244, 189, 90, .24) !important;
    background: rgba(13, 7, 20, .4) !important;
}

.tonight-scene .tonight-log-text {
    /* Wraps the time controls below the drink on narrow phones instead of squeezing the name. */
    flex: 1 1 11rem;
    min-width: 0;
    color: var(--night-ivory) !important;
}

.tonight-log-time {
    color: var(--night-gold);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tonight-log-actions {
    flex: 0 0 auto;
    gap: .15rem;
}

.tonight-time-nudge.mud-button-outlined {
    min-width: 3.15rem;
    min-height: 44px;
    padding: 0 .45rem;
    color: var(--night-ivory) !important;
    border-color: rgba(244, 189, 90, .52) !important;
    background: rgba(244, 189, 90, .06);
    font-size: .88rem;
    font-weight: 700;
}

.tonight-time-nudge.mud-button-outlined:active,
.tonight-set-now-button:active {
    color: #2a1423 !important;
    background: var(--night-gold) !important;
}

.tonight-set-now-button {
    min-width: 44px;
    min-height: 44px;
    color: var(--night-gold) !important;
    border: 1px solid rgba(244, 189, 90, .52);
    border-radius: 50%;
    background: rgba(244, 189, 90, .1);
}

.tonight-library-button.mud-button-outlined {
    color: var(--night-ivory) !important;
    border-color: rgba(244, 189, 90, .48) !important;
    background: rgba(255, 240, 211, .035);
}

.tonight-library-button.mud-button-filled {
    color: #2a1423 !important;
    border-color: rgba(255, 240, 211, .75);
    background: linear-gradient(135deg, #ffd886, var(--night-gold)) !important;
}

/* Name and caption on a selected (gold) item stay dark: #2a1423 on gold is well above 4.5:1. */
.tonight-sheet .tonight-library-button.mud-button-filled .mud-typography,
.tonight-sheet .tonight-library-button.mud-button-filled .mud-typography.mud-typography-caption {
    color: #2a1423 !important;
}

.tonight-library-item,
.tonight-favorite-editor {
    color: var(--night-ivory);
    border-color: rgba(244, 189, 90, .3) !important;
    background: rgba(13, 7, 20, .32) !important;
}

.tonight-library-item {
    display: flex;
    gap: .25rem;
    align-items: center;
}

.tonight-library-item .tonight-library-button {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 56px;
    justify-content: flex-start;
    border-radius: 12px;
    text-align: left;
    text-transform: none;
}

.tonight-library-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.tonight-favorite-editor {
    box-shadow: inset 0 0 22px rgba(244, 189, 90, .05);
}

.tonight-favorite-editor .mud-input-control-input-container,
.tonight-favorite-editor .mud-input-root {
    color: var(--night-ivory);
}

.tonight-wheel-label {
    display: block;
    margin: 0 0 .3rem .2rem;
    color: rgba(255, 240, 211, .78);
}

/* "Något annat i bägaren": Öl / Vin / Sprit on wheels, below the one-tap tiles. */
.tonight-new-drink-toggle {
    min-height: 48px;
    justify-content: space-between !important;
    font-size: 1.05rem !important;
    text-transform: none !important;
}

.tonight-kind-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .5rem;
}

.tonight-kind-button {
    min-height: 56px;
    color: var(--night-ivory) !important;
    border-color: rgba(244, 189, 90, .62) !important;
    font-size: 1.05rem !important;
    text-transform: none !important;
}

.tonight-kind-button.mud-button-filled {
    color: #2a1423 !important;
    background: linear-gradient(135deg, #ffd886, var(--night-gold)) !important;
}

.tonight-new-drink-wheels {
    display: grid;
    max-width: 28rem;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: .75rem;
    margin-top: .9rem;
}

.tonight-save-as-favorite {
    margin-top: .4rem;
    color: var(--night-ivory);
}

.tonight-new-drink-register {
    min-height: 56px;
    margin-top: .25rem;
    font-size: 1.05rem !important;
}

.tonight-barcode-open {
    min-height: 48px;
    border-color: rgba(114, 244, 213, .68) !important;
    color: #9cffe9 !important;
    text-transform: none !important;
}

.tonight-barcode-scanner,
.tonight-barcode-result {
    margin-top: .75rem;
    border: 1px solid rgba(114, 244, 213, .38);
    border-radius: 15px;
    background: linear-gradient(145deg, rgba(24, 48, 61, .66), rgba(26, 12, 42, .84));
    box-shadow: inset 0 0 22px rgba(114, 244, 213, .05);
}

.tonight-barcode-scanner {
    padding: .9rem;
}

.tonight-barcode-camera-frame {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border: 1px solid rgba(244, 189, 90, .55);
    border-radius: 12px;
    background: #09070f;
}

.tonight-barcode-camera {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tonight-barcode-target {
    position: absolute;
    inset: 29% 9%;
    border: 2px solid rgba(255, 216, 134, .96);
    border-radius: 8px;
    box-shadow: 0 0 0 200vmax rgba(6, 2, 12, .22), 0 0 18px rgba(244, 189, 90, .55);
    pointer-events: none;
}

.tonight-barcode-manual .mud-input-control {
    min-width: 0;
}

.tonight-barcode-manual .mud-button-root {
    min-height: 48px;
}

.tonight-barcode-result {
    color: var(--night-ivory);
}

.tonight-reset-alert {
    color: var(--night-ivory) !important;
    border-color: rgba(244, 189, 90, .62) !important;
    background: rgba(100, 27, 63, .26) !important;
}

.tonight-scene .chart-container {
    box-shadow: inset 0 0 28px rgba(81, 37, 57, .2), 0 8px 18px rgba(0, 0, 0, .2);
}

.tonight-scene .chart-toolbar .mud-typography,
.tonight-scene .uric-acid-chart > .mud-typography {
    color: rgba(255, 240, 211, .72) !important;


/* Bottom sheet for the favourite library and editor. Only Kvällen renders .tonight-sheet, so the
   scrim rule below dims the page behind its temporary drawer without touching other drawers. */
body:has(.tonight-sheet) .mud-drawer-overlay-temporary .mud-overlay-scrim {
    background-color: rgba(6, 2, 12, .66);
    backdrop-filter: blur(2px);
}

.mud-drawer.tonight-sheet {
    /* dvh follows the mobile browser's collapsing toolbars; vh is the fallback. */
    height: 85vh !important;
    height: 85dvh !important;
    color: var(--night-ivory);
    border-top: 1px solid rgba(244, 189, 90, .45);
    border-radius: 20px 20px 0 0;
    background: linear-gradient(160deg, #25112f 0%, #140d1f 100%);
}

.tonight-sheet-content {
    max-width: 60rem;
    margin: 0 auto;
    padding: 1rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
}

.tonight-sheet-content::before {
    display: block;
    width: 3rem;
    height: 4px;
    margin: 0 auto .75rem;
    border-radius: 999px;
    background: rgba(244, 189, 90, .45);
    content: "";
}

.tonight-sheet .mud-typography {
    color: inherit;
}

.tonight-sheet .tonight-sheet-title {
    margin: 0;
    color: var(--night-ivory);
    font-weight: 700;
}

.tonight-sheet .tonight-sheet-title:focus {
    outline: none;
}

.tonight-sheet .tonight-sheet-title:focus-visible {
    outline: 2px solid var(--night-gold);
    outline-offset: 2px;
}

.tonight-sheet .mud-typography.mud-typography-caption {
    color: rgba(255, 240, 211, .72);
}

.tonight-sheet .mud-input-control-input-container,
.tonight-sheet .mud-input-root {
    color: var(--night-ivory);
}

/* Lens choice: "Bara jag" and one lens per ongoing ritual, then "Alla ritualer". Wraps on phones. */
.tonight-lens-row {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    align-items: center;
    justify-content: space-between;
}

.tonight-lens-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.tonight-lens-button {
    min-height: 48px;
    text-transform: none !important;
}

.tonight-lens-button.mud-button-filled {
    color: #2a1423 !important;
    background: linear-gradient(135deg, #ffd886, var(--night-gold)) !important;
}

.tonight-all-rituals-row {
    position: relative;
    z-index: 1;
    text-align: right;
}

.tonight-all-rituals {
    color: var(--night-gold) !important;
}

.tonight-new-ritual {
    min-height: 44px;
}

.tonight-ritual-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    align-items: center;
    justify-content: flex-end;
}

/* Favourites outside tonight's quick list: still one tap, a little quieter than the quick list. */
.tonight-other-favorite-button.mud-button-outlined {
    min-height: 64px;
    height: 100%;
    touch-action: manipulation;
    text-transform: none;
    color: var(--night-ivory) !important;
    border-color: rgba(244, 189, 90, .62) !important;
}

/* The ritual lens sits in Kvällen's column, so it drops the room's outer margins. */
.tonight-scene .competition-ritual-lens {
    margin-top: 0;
}

@media (max-width: 600px) {
    .tonight-scene {
        margin: .5rem;
        padding: 1rem !important;
        border-radius: 20px;
    }

    .tonight-scene::before {
        top: .5rem;
        right: .5rem;
    }

    .tonight-sigil {
        width: 2rem;
        height: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tonight-drink-button.mud-button-filled {
        transition: none;
    }

    .tonight-drink-button.tonight-pulse-a,
    .tonight-drink-button.tonight-pulse-b {
        animation: none;
    }
}
