/*
 * Life Levels - styles.
 *
 * The palette is the logo's: navy #003F54, blue #006699, orange #FF6600,
 * cyan #00A8CC and ice #D9E8F5. Orange is for XP, coins and streaks - the
 * things worth getting excited about. Cyan is for done. Blue is for buttons.
 * Dark mode follows the device.
 */

@font-face {
    font-family: 'Montserrat';
    src: url(/fonts/Montserrat-VariableFont_wght.ttf) format('truetype');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --navy: #003F54;
    --blue: #006699;
    --orange: #FF6600;
    --cyan: #00A8CC;
    --ice: #D9E8F5;

    --bg: #EEF4FA;
    --surface: #FFFFFF;
    --surface-2: #F4F8FC;
    --text: #062C3B;
    --text-soft: #557585;
    --line: #DCE8F2;
    --track: #E3EDF6;
    --orange-soft: #FFF0E6;
    --cyan-soft: #E3F6FA;
    --blue-soft: #E5F0F7;
    --danger: #D93A1E;

    --hero: linear-gradient(140deg, #0A77AB 0%, #006699 30%, #003F54 100%);
    --xp-fill: linear-gradient(90deg, #FF6600 0%, #FF8B3D 100%);
    --cyan-fill: linear-gradient(90deg, #00A8CC 0%, #0088B8 100%);

    --radius: 20px;
    --radius-small: 14px;
    --shadow: 0 1px 2px rgba(0, 63, 84, 0.06), 0 6px 18px rgba(0, 63, 84, 0.07);
    --shadow-lift: 0 2px 4px rgba(0, 63, 84, 0.08), 0 14px 34px rgba(0, 63, 84, 0.16);

    --tabbar-height: 68px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #01161E;
        --surface: #072634;
        --surface-2: #0B3142;
        --text: #E7F1F8;
        --text-soft: #93B4C5;
        --line: #12405399;
        --track: #0F3B4C;
        --orange-soft: rgba(255, 102, 0, 0.14);
        --cyan-soft: rgba(0, 168, 204, 0.14);
        --blue-soft: rgba(0, 102, 153, 0.25);
        --danger: #FF6B4F;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.25);
        --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 16px 38px rgba(0, 0, 0, 0.4);
    }
}

/* ------------------------------------------------------------- base */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--blue);
    text-decoration: none;
}

@media (prefers-color-scheme: dark) {
    a {
        color: var(--cyan);
    }
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

p {
    margin: 0;
}

button {
    font: inherit;
    color: inherit;
}

img {
    max-width: 100%;
}

[hidden] {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.muted {
    color: var(--text-soft);
}

.center {
    text-align: center;
}

/* ------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: none;
    border-radius: 999px;
    background: var(--blue);
    color: #FFFFFF;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 102, 153, 0.28);
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 102, 153, 0.34);
}

.btn:active {
    transform: scale(0.96);
}

.btn:focus {
    outline: none;
}

.btn:focus-visible, .icon-btn:focus-visible, .check-btn:focus-visible, .tab:focus-visible, .template:focus-visible {
    outline: 3px solid rgba(0, 168, 204, 0.55);
    outline-offset: 3px;
}

.btn:disabled, .btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-orange {
    background: var(--orange);
    box-shadow: 0 4px 14px rgba(255, 102, 0, 0.32);
}

.btn-orange:hover {
    box-shadow: 0 6px 20px rgba(255, 102, 0, 0.4);
}

.btn-ghost {
    background: var(--blue-soft);
    color: var(--blue);
    box-shadow: none;
}

.btn-ghost:hover {
    box-shadow: none;
}

@media (prefers-color-scheme: dark) {
    .btn-ghost {
        color: var(--ice);
    }
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    box-shadow: none;
    border: 1.5px solid currentColor;
}

.btn-danger:hover {
    box-shadow: none;
}

.btn-small {
    min-height: 36px;
    padding: 0 14px;
    font-size: 14px;
}

.btn-block {
    width: 100%;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 17px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.icon-btn:hover {
    background: rgba(127, 160, 180, 0.15);
}

.icon-btn:active {
    transform: scale(0.92);
}

.icon-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.link-btn {
    border: none;
    background: none;
    padding: 0;
    color: var(--blue);
    font-weight: 700;
    cursor: pointer;
}

@media (prefers-color-scheme: dark) {
    .link-btn {
        color: var(--cyan);
    }
}

/* ------------------------------------------------------------- forms */

input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=date], select, textarea {
    width: 100%;
    padding: 13px 15px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 4px rgba(0, 168, 204, 0.16);
}

input::placeholder, textarea::placeholder {
    color: var(--text-soft);
    opacity: 0.7;
}

select {
    background-image: linear-gradient(45deg, transparent 50%, var(--text-soft) 50%), linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
    background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

.field {
    display: block;
    margin-bottom: 18px;
}

.field > .label, .label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-soft);
    text-transform: uppercase;
}

.field .hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-soft);
}

.inline-fields {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-fields input[type=number] {
    width: 90px;
    text-align: center;
}

/* a switch, for settings that are on or off */
.switch {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 50px;
    height: 30px;
}

.switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}

.switch span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--track);
    transition: background 0.25s ease;
}

.switch span::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.switch input:checked + span {
    background: var(--cyan);
}

.switch input:checked + span::after {
    transform: translateX(20px);
}

.switch input:focus-visible + span {
    box-shadow: 0 0 0 4px rgba(0, 168, 204, 0.25);
}

/* chips that act as radio buttons or checkboxes */
.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.choice {
    position: relative;
}

.choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.choice span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 14px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
}

.choice span:hover {
    border-color: var(--cyan);
}

.choice input:checked + span {
    border-color: var(--blue);
    background: var(--blue);
    color: #FFFFFF;
}

.choice input:focus-visible + span {
    box-shadow: 0 0 0 4px rgba(0, 168, 204, 0.25);
}

.choices.week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.choice.day span {
    width: 100%;
    min-height: 42px;
    padding: 0;
    justify-content: center;
}

/* difficulty: one row of four */
.difficulty {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.difficulty .choice span {
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 8px 4px;
    border-radius: var(--radius-small);
    line-height: 1.2;
}

.difficulty .choice small {
    font-size: 12px;
    font-weight: 800;
    color: var(--orange);
}

.difficulty .choice input:checked + span small {
    color: #FFD2B3;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 6px;
    max-height: 152px;
    overflow-y: auto;
    padding: 2px;
}

.icon-grid .choice span {
    width: 100%;
    height: 44px;
    padding: 0;
    justify-content: center;
    border-radius: 12px;
    font-size: 17px;
}

.swatches {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.swatch input {
    position: absolute;
    opacity: 0;
}

.swatch span {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--swatch);
    cursor: pointer;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.0);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swatch input:checked + span {
    transform: scale(1.12);
    box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--swatch);
}

.stepper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}

.stepper button {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 800;
    cursor: pointer;
}

.stepper output {
    min-width: 36px;
    text-align: center;
    font-weight: 800;
}

/* ------------------------------------------------------------- the app shell */

.app-body {
    min-height: 100vh;
    padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 24px);
}

.shell {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
}

.splash {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    color: var(--text-soft);
    font-weight: 600;
}

.splash img {
    width: 96px;
    height: 96px;
    animation: float 2.4s ease-in-out infinite;
}

/* the header: who you are and how far you've come */
.app-header {
    position: relative;
    padding: calc(14px + env(safe-area-inset-top, 0px)) 18px 22px;
    background: var(--hero);
    color: #FFFFFF;
    border-radius: 0 0 30px 30px;
    box-shadow: 0 10px 30px rgba(0, 63, 84, 0.25);
    overflow: hidden;
}

.app-header::before, .app-header::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.app-header::before {
    width: 260px;
    height: 260px;
    right: -90px;
    top: -120px;
    background: radial-gradient(circle, rgba(0, 168, 204, 0.35), transparent 70%);
}

.app-header::after {
    width: 220px;
    height: 220px;
    left: -100px;
    bottom: -140px;
    background: radial-gradient(circle, rgba(255, 102, 0, 0.22), transparent 70%);
}

.header-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #FFFFFF;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -0.01em;
}

.brand img {
    width: 30px;
    height: 30px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.pill i {
    font-size: 13px;
}

.coin-pill i {
    color: #FFB37A;
}

.sync-pill.pending i {
    color: #FFB37A;
}

.sync-pill.offline {
    background: rgba(255, 102, 0, 0.3);
}

.sync-pill.error {
    background: rgba(217, 58, 30, 0.6);
}

.level-strip {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
}

.level-ring {
    position: relative;
    flex: 0 0 auto;
    width: 70px;
    height: 70px;
}

.level-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.level-ring .track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.16);
    stroke-width: 7;
}

.level-ring .fill {
    fill: none;
    stroke: var(--orange);
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.level-ring .value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.level-ring .value small {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    opacity: 0.75;
}

.level-ring .value strong {
    font-size: 24px;
    font-weight: 900;
}

.level-info {
    flex: 1 1 auto;
    min-width: 0;
}

.level-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-weight: 800;
    font-size: 18px;
}

.level-title span {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.8;
    white-space: nowrap;
}

.xp-bar {
    position: relative;
    height: 12px;
    margin: 8px 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.xp-bar .fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    border-radius: inherit;
    background: var(--xp-fill);
    transition: width 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.xp-bar .fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
    transform: translateX(-100%);
}

.xp-bar.gain .fill::after {
    animation: shine 1.1s ease-out;
}

.xp-text {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
}

/* the tab bar */
.tabbar {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: 0;
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    box-shadow: 0 -6px 24px rgba(0, 63, 84, 0.1);
    border-radius: 24px 24px 0 0;
}

.tabbar .shell {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: var(--tabbar-height);
    padding: 0 10px;
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-soft);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    position: relative;
}

.tab i {
    font-size: 19px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tab.active {
    color: var(--blue);
}

@media (prefers-color-scheme: dark) {
    .tab.active {
        color: var(--cyan);
    }
}

.tab.active i {
    transform: translateY(-2px) scale(1.12);
}

.tab.active::before {
    content: '';
    position: absolute;
    top: 8px;
    width: 44px;
    height: 30px;
    border-radius: 999px;
    background: var(--blue-soft);
    z-index: -1;
}

.tab .dot {
    position: absolute;
    top: 10px;
    right: calc(50% - 18px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--orange);
}

/* adding a goal, at the foot of the day's list */
.add-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin-top: 18px;
    padding: 16px;
    border: 2px dashed color-mix(in srgb, var(--blue) 35%, transparent);
    border-radius: var(--radius);
    background: transparent;
    color: var(--blue);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.add-card:hover {
    background: var(--blue-soft);
    border-color: var(--blue);
}

.add-card:active {
    transform: scale(0.98);
}

.add-card i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: var(--orange);
    color: #FFFFFF;
    font-size: 13px;
}

@media (prefers-color-scheme: dark) {
    .add-card {
        color: var(--cyan);
        border-color: color-mix(in srgb, var(--cyan) 35%, transparent);
    }
}

/* ------------------------------------------------------------- views */

.view {
    padding: 22px 16px 0;
}

/* added by app.js only to what has just appeared, see markEntering */
.view.entering,
.goal-card.entering,
.reward-card.entering {
    animation: viewIn 0.35s ease;
}

.view-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.view-head h1 {
    font-size: 26px;
}

.view-head p {
    margin-top: 2px;
    font-size: 14px;
    color: var(--text-soft);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 26px 2px 12px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.section-title .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--track);
    color: var(--text);
    font-size: 12px;
    letter-spacing: 0;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}

.card + .card {
    margin-top: 14px;
}

.stack > * + * {
    margin-top: 10px;
}

/* ------------------------------------------------------------- today */

.day-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.day-head .day-name {
    flex: 1 1 auto;
    min-width: 0;
}

.day-head h1 {
    font-size: 28px;
}

.day-head p {
    font-size: 14px;
    color: var(--text-soft);
    font-weight: 600;
}

.day-progress {
    position: relative;
    width: 62px;
    height: 62px;
    flex: 0 0 auto;
}

.day-progress svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.day-progress .track {
    fill: none;
    stroke: var(--track);
    stroke-width: 6;
}

.day-progress .fill {
    fill: none;
    stroke: var(--cyan);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.day-progress.perfect .fill {
    stroke: var(--orange);
}

.day-progress span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
}

.past-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 14px 0 0;
    padding: 10px 14px;
    border-radius: var(--radius-small);
    background: var(--blue-soft);
    font-size: 14px;
    font-weight: 600;
}

.goal-list {
    display: grid;
    gap: 12px;
}

.goal-card {
    --goal: var(--blue);
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 14px 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
}

.goal-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--goal);
}

.goal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 15px;
    background: color-mix(in srgb, var(--goal) 14%, transparent);
    color: var(--goal);
    font-size: 20px;
}

@media (prefers-color-scheme: dark) {
    .goal-icon {
        background: color-mix(in srgb, var(--goal) 26%, transparent);
        color: color-mix(in srgb, var(--goal) 55%, #FFFFFF);
    }
}

.goal-main {
    flex: 1 1 auto;
    min-width: 0;
}

.goal-title {
    font-weight: 700;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.goal-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    margin-top: 3px;
    font-size: 13px;
    color: var(--text-soft);
    font-weight: 600;
}

.goal-meta .xp {
    color: var(--orange);
    font-weight: 800;
}

.goal-meta .streak {
    color: var(--orange);
}

.goal-meta .boost {
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--orange-soft);
    color: var(--orange);
    font-size: 11px;
    font-weight: 800;
}

.goal-meta .reminder i {
    font-size: 11px;
}

.dots {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.dots span {
    flex: 1 1 0;
    max-width: 28px;
    height: 6px;
    border-radius: 999px;
    background: var(--track);
}

.dots span.on {
    background: var(--goal);
}

.check-btn {
    --p: 0;
    position: relative;
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 50%;
    padding: 0;
    background: conic-gradient(var(--goal) calc(var(--p) * 1%), var(--track) 0);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.check-btn::before {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--surface);
    transition: background 0.25s ease;
}

.check-btn i, .check-btn b {
    position: relative;
    font-size: 20px;
    color: color-mix(in srgb, var(--goal) 45%, var(--track));
    transition: color 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.check-btn b {
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
}

.check-btn:hover i {
    color: var(--goal);
    transform: scale(1.15);
}

.check-btn:active {
    transform: scale(0.88);
}

.check-btn:disabled {
    cursor: default;
}

.goal-card.done {
    box-shadow: none;
    background: var(--surface-2);
}

.goal-card.done .goal-title {
    color: var(--text-soft);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
    text-decoration-color: color-mix(in srgb, var(--cyan) 60%, transparent);
}

.goal-card.done .goal-icon {
    filter: saturate(0.4);
    opacity: 0.7;
}

.goal-card.done .check-btn {
    background: var(--cyan);
}

.goal-card.done .check-btn::before {
    background: var(--cyan);
}

.goal-card.done .check-btn i {
    color: #FFFFFF;
}

.goal-card.just-done {
    animation: pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.goal-card.just-done .check-btn i {
    animation: checkIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.goal-card.later {
    opacity: 0.72;
    box-shadow: none;
    background: var(--surface-2);
}

.goal-card .undo {
    font-size: 12px;
    font-weight: 700;
}

.perfect-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    padding: 16px 18px;
    border-radius: var(--radius);
    background: linear-gradient(120deg, #FF6600, #FF8B3D 55%, #FFB37A);
    color: #FFFFFF;
    box-shadow: 0 10px 26px rgba(255, 102, 0, 0.32);
}

.perfect-banner.entering {
    animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.perfect-banner i {
    font-size: 28px;
}

.perfect-banner strong {
    display: block;
    font-size: 17px;
    font-weight: 800;
}

.perfect-banner span {
    font-size: 14px;
    opacity: 0.95;
}

.nudge {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    border: 1.5px dashed color-mix(in srgb, var(--cyan) 50%, transparent);
}

.nudge > i {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: var(--cyan-soft);
    color: var(--cyan);
    font-size: 18px;
}

.nudge div {
    flex: 1 1 auto;
    font-size: 14px;
}

.nudge strong {
    display: block;
    font-size: 15px;
}

.nudge .actions {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}

details.later-list > summary {
    list-style: none;
    cursor: pointer;
}

details.later-list > summary::-webkit-details-marker {
    display: none;
}

details.later-list > summary .chev {
    margin-left: auto;
    transition: transform 0.2s ease;
}

details.later-list[open] > summary .chev {
    transform: rotate(180deg);
}

/* the first visit: nothing yet */
.empty {
    padding: 26px 20px 22px;
    text-align: center;
}

.empty .art {
    width: 92px;
    height: 92px;
    margin: 0 auto 14px;
    animation: float 3s ease-in-out infinite;
}

.empty h2 {
    font-size: 22px;
}

.empty p {
    margin: 8px auto 0;
    max-width: 380px;
    color: var(--text-soft);
}

.templates {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

.template {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px 9px 10px;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.template:hover {
    transform: translateY(-2px);
    border-color: var(--cyan);
    box-shadow: var(--shadow);
}

.template i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--tint, var(--blue)) 14%, transparent);
    color: var(--tint, var(--blue));
    font-size: 13px;
}

/* ------------------------------------------------------------- goals */

.area-group + .area-group {
    margin-top: 6px;
}

.area-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 22px 2px 10px;
}

.area-head .area-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 14px;
}

@media (prefers-color-scheme: dark) {
    .area-head .area-icon {
        color: var(--cyan);
    }
}

.area-head h2 {
    font-size: 16px;
}

.area-head .lvl {
    margin-left: auto;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-soft);
}

.goal-row {
    cursor: pointer;
}

.goal-row:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lift);
}

.goal-row .chev {
    color: var(--text-soft);
    font-size: 14px;
}

.goal-row.archived {
    opacity: 0.6;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.form-actions .grow {
    flex: 1 1 auto;
}

.form-section {
    padding: 16px;
    margin: 0 -4px 16px;
    border-radius: var(--radius-small);
    background: var(--surface-2);
}

/* ------------------------------------------------------------- rewards */

.coin-hero {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border-radius: var(--radius);
    background: linear-gradient(130deg, #FF6600 0%, #FF7F2A 45%, #FF9A52 100%);
    color: #FFFFFF;
    box-shadow: 0 12px 30px rgba(255, 102, 0, 0.3);
}

.coin-hero::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent 70%);
}

.coin-hero .amount {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 42px;
    font-weight: 900;
    line-height: 1;
}

.coin-hero .amount i {
    font-size: 32px;
    animation: wobble 3s ease-in-out infinite;
}

.coin-hero p {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.95;
}

.reward-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.reward-card .reward-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: var(--orange-soft);
    color: var(--orange);
    font-size: 21px;
}

.reward-card .reward-main {
    flex: 1 1 auto;
    min-width: 0;
}

.reward-card .reward-title {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reward-card .reward-cost {
    font-size: 13px;
    font-weight: 700;
    color: var(--orange);
}

.reward-card .mini-bar {
    height: 6px;
    margin-top: 7px;
    border-radius: 999px;
    background: var(--track);
    overflow: hidden;
}

.reward-card .mini-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--xp-fill);
}

.history-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 4px;
    font-size: 14px;
    border-bottom: 1px solid var(--line);
}

.history-row:last-child {
    border-bottom: none;
}

.history-row i {
    width: 22px;
    text-align: center;
    color: var(--orange);
}

.history-row .grow {
    flex: 1 1 auto;
    min-width: 0;
}

/* ------------------------------------------------------------- profile */

.profile-card {
    text-align: center;
    padding: 26px 18px 22px;
}

.avatar {
    position: relative;
    width: 108px;
    height: 108px;
    margin: 0 auto 12px;
}

.avatar svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.avatar .track {
    fill: none;
    stroke: var(--track);
    stroke-width: 6;
}

.avatar .fill {
    fill: none;
    stroke: var(--orange);
    stroke-width: 6;
    stroke-linecap: round;
}

.avatar .face {
    position: absolute;
    inset: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--hero);
    color: #FFFFFF;
    font-size: 36px;
    font-weight: 900;
}

.avatar .lvl {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 11px;
    border-radius: 999px;
    background: var(--orange);
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(255, 102, 0, 0.4);
}

.profile-card h1 {
    font-size: 24px;
}

.profile-card .subtitle {
    margin-top: 4px;
    color: var(--text-soft);
    font-weight: 600;
}

.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 520px) {
    .stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat {
    padding: 16px 12px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat i {
    display: block;
    margin-bottom: 6px;
    font-size: 18px;
    color: var(--cyan);
}

.stat.hot i {
    color: var(--orange);
}

.stat strong {
    display: block;
    font-size: 24px;
    font-weight: 900;
    line-height: 1.1;
}

.stat span {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.area-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.area-row + .area-row {
    border-top: 1px solid var(--line);
}

.area-row .area-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--blue-soft);
    color: var(--blue);
}

@media (prefers-color-scheme: dark) {
    .area-row .area-icon {
        color: var(--cyan);
    }
}

.area-row .grow {
    flex: 1 1 auto;
    min-width: 0;
}

.area-row .name {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 700;
}

.area-row .name span {
    color: var(--text-soft);
    font-size: 12px;
}

.bar {
    height: 8px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--track);
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--cyan-fill);
    transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.heatmap {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(12px, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.heatmap span {
    width: 100%;
    min-width: 13px;
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--track);
}

.heatmap .l1 { background: rgba(0, 168, 204, 0.3); }
.heatmap .l2 { background: rgba(0, 168, 204, 0.62); }
.heatmap .l3 { background: #0088B8; }
.heatmap .l4 { background: var(--orange); }
.heatmap .future { background: transparent; }

.heatmap-wrap {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    align-items: stretch;
}

.heatmap-days {
    display: grid;
    grid-template-rows: repeat(7, 1fr);
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-soft);
}

.heatmap-days span {
    display: flex;
    align-items: center;
}

.legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-soft);
    font-weight: 600;
}

.legend span {
    width: 11px;
    height: 11px;
    border-radius: 3px;
    background: var(--track);
}

.badges {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    gap: 14px 8px;
}

.badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    text-align: center;
}

.badge .medal {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #FF9A52, #FF6600 60%, #D94F00);
    color: #FFFFFF;
    font-size: 22px;
    box-shadow: 0 6px 16px rgba(255, 102, 0, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.15);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge:hover .medal {
    transform: scale(1.08) rotate(-6deg);
}

.badge .medal::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.badge.locked .medal {
    background: var(--track);
    color: var(--text-soft);
    box-shadow: none;
    opacity: 0.75;
}

.badge.locked .medal::after {
    border-color: transparent;
}

.badge span {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.badge.locked span {
    color: var(--text-soft);
}

.badge-detail {
    text-align: center;
    padding: 6px 0 4px;
}

.badge-detail .medal {
    width: 88px;
    height: 88px;
    margin: 0 auto 14px;
    font-size: 34px;
}

.badge-detail h3 {
    font-size: 20px;
}

.badge-detail p {
    margin-top: 6px;
    color: var(--text-soft);
}

.share-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--hero);
    color: #FFFFFF;
}

.share-card i.big {
    font-size: 30px;
    color: var(--cyan);
}

.share-card .grow {
    flex: 1 1 auto;
}

.share-card strong {
    display: block;
    font-size: 17px;
}

.share-card span {
    font-size: 14px;
    opacity: 0.85;
}

.menu-list {
    padding: 6px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}

.menu-item + .menu-item {
    border-top: 1px solid var(--line);
}

.menu-item > i:first-child {
    width: 22px;
    text-align: center;
    color: var(--blue);
}

@media (prefers-color-scheme: dark) {
    .menu-item > i:first-child {
        color: var(--cyan);
    }
}

.menu-item .grow {
    flex: 1 1 auto;
}

.menu-item .chev {
    color: var(--text-soft);
    font-size: 13px;
}

.menu-item.danger, .menu-item.danger > i:first-child {
    color: var(--danger);
}

.version {
    margin: 18px 0 6px;
    text-align: center;
    font-size: 12px;
    color: var(--text-soft);
}

/* ------------------------------------------------------------- celebrations */

#fx {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 20000;
}

.float-text {
    position: fixed;
    z-index: 20001;
    pointer-events: none;
    font-weight: 900;
    font-size: 22px;
    color: var(--orange);
    text-shadow: 0 2px 0 #FFFFFF, 0 4px 14px rgba(255, 102, 0, 0.35);
    transform: translate(-50%, -50%);
    animation: floatUp 1.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
    .float-text {
        text-shadow: 0 2px 0 #01161E, 0 4px 14px rgba(255, 102, 0, 0.45);
    }
}

.float-text small {
    display: block;
    font-size: 12px;
    font-weight: 800;
    color: var(--cyan);
    text-align: center;
}

.celebrate {
    position: fixed;
    inset: 0;
    z-index: 19999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 30, 42, 0.62);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.celebrate.show {
    opacity: 1;
}

.celebrate .panel {
    position: relative;
    width: 100%;
    max-width: 360px;
    padding: 34px 24px 24px;
    border-radius: 28px;
    background: var(--surface);
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    transform: scale(0.6) translateY(30px);
    transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebrate.show .panel {
    transform: none;
}

.celebrate .emblem {
    position: relative;
    width: 128px;
    height: 128px;
    margin: -96px auto 14px;
}

.celebrate .emblem .rays {
    position: absolute;
    inset: -34px;
    border-radius: 50%;
    background: repeating-conic-gradient(from 0deg, rgba(255, 179, 122, 0.55) 0deg 10deg, transparent 10deg 30deg);
    -webkit-mask: radial-gradient(circle, #000 35%, transparent 70%);
    mask: radial-gradient(circle, #000 35%, transparent 70%);
    animation: spin 12s linear infinite;
}

.celebrate .emblem .core {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #FF9A52, #FF6600 60%, #D94F00);
    color: #FFFFFF;
    font-size: 48px;
    font-weight: 900;
    box-shadow: 0 14px 34px rgba(255, 102, 0, 0.5), inset 0 -5px 0 rgba(0, 0, 0, 0.15);
    border: 5px solid var(--surface);
    animation: bounceIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.celebrate.level .emblem .core {
    background: var(--hero);
    box-shadow: 0 14px 34px rgba(0, 102, 153, 0.5), inset 0 -5px 0 rgba(0, 0, 0, 0.2);
}

.celebrate.perfect .emblem .core {
    background: radial-gradient(circle at 30% 25%, #4FD3EE, #00A8CC 60%, #00809C);
    box-shadow: 0 14px 34px rgba(0, 168, 204, 0.5), inset 0 -5px 0 rgba(0, 0, 0, 0.15);
}

.celebrate .kicker {
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--orange);
}

.celebrate h2 {
    margin-top: 6px;
    font-size: 28px;
}

.celebrate p {
    margin: 8px 0 20px;
    color: var(--text-soft);
    font-weight: 600;
}

.celebrate .reward {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: -8px 0 18px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--orange-soft);
    color: var(--orange);
    font-weight: 800;
    font-size: 14px;
}

/* ------------------------------------------------------------- gooeytoolbox */

.gtb-background {
    background: rgba(0, 30, 42, 0.55) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.gtb-alert-frame, .gtb-confirm-frame {
    width: 94vw !important;
    max-width: 520px !important;
    max-height: 88vh !important;
    padding: 58px 20px 20px !important;
    border-radius: 26px !important;
    background: var(--surface) !important;
    color: var(--text) !important;
    font-family: inherit !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3) !important;
}

.gtb-alert-header, .gtb-confirm-header {
    padding: 16px 16px 0 20px !important;
    width: 100% !important;
    justify-content: space-between !important;
    color: var(--text) !important;
    font-size: 19px;
    font-weight: 800 !important;
    text-align: left !important;
}

.gtb-close-button {
    width: 36px;
    height: 36px;
    padding: 0 !important;
    border-radius: 12px !important;
    background: var(--track) !important;
    color: var(--text-soft) !important;
    box-shadow: none !important;
}

.gtb-alert-content, .gtb-confirm-content {
    padding-top: 0 !important;
    font-size: 15px;
}

.gtb-confirm-button-bar {
    justify-content: flex-end !important;
    gap: 10px;
    margin-top: 20px;
}

.gtb-yes-button, .gtb-no-button {
    min-height: 44px;
    margin: 0 !important;
    padding: 0 20px !important;
    border: none !important;
    border-radius: 999px !important;
    font-family: inherit;
    font-size: 15px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    box-shadow: none !important;
}

.gtb-yes-button {
    background: var(--blue) !important;
    color: #FFFFFF !important;
}

.gtb-no-button {
    background: var(--track) !important;
    color: var(--text) !important;
}

/* The container stays on the page after its toasts fade and spans the width of
 * the screen, over the tab bar, so clicks pass through it to what is below. */
.gtb-toast-container {
    padding: 0 12px 14px;
    pointer-events: none;
}

.gtb-toast-container .gtb-toast {
    pointer-events: auto;
}

.app-body .gtb-toast-container {
    padding-bottom: calc(var(--tabbar-height) + var(--safe-bottom) + 14px);
}

.gtb-toast {
    max-width: min(480px, calc(100vw - 24px)) !important;
    padding: 12px 18px !important;
    border-radius: 16px !important;
    background: var(--navy) !important;
    color: #FFFFFF !important;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 30, 42, 0.35) !important;
}

/* ------------------------------------------------------------- pages for people not logged in */

.auth-body {
    min-height: 100vh;
    background: var(--hero);
    background-attachment: fixed;
}

.auth {
    position: relative;
    min-height: 100vh;
    display: grid;
    align-items: center;
    gap: 34px;
    max-width: 1060px;
    margin: 0 auto;
    padding: 36px 20px 40px;
}

@media (min-width: 900px) {
    .auth {
        grid-template-columns: 1.1fr 0.9fr;
        gap: 60px;
        padding: 40px;
    }
}

.auth-hero {
    color: #FFFFFF;
}

.auth-hero .logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #FFFFFF;
    font-size: 22px;
    font-weight: 800;
}

.auth-hero .logo img {
    width: 52px;
    height: 52px;
}

.auth-hero h1 {
    margin-top: 26px;
    font-size: clamp(34px, 6vw, 56px);
    font-weight: 900;
    letter-spacing: -0.02em;
}

.auth-hero h1 em {
    font-style: normal;
    color: #FF8B3D;
}

.auth-hero > p {
    margin-top: 16px;
    max-width: 480px;
    font-size: 17px;
    color: var(--ice);
    opacity: 0.92;
}

.features {
    display: grid;
    gap: 14px;
    margin-top: 28px;
    padding: 0;
    list-style: none;
}

.features li {
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
    color: #FFFFFF;
}

.features li i {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.12);
    color: #FF8B3D;
    font-size: 16px;
}

.features li:nth-child(2n) i {
    color: var(--cyan);
}

@media (max-width: 899px) {
    .auth-hero h1 {
        margin-top: 18px;
    }

    .auth-hero > p, .features {
        display: none;
    }

    .auth-body.landing .auth-hero > p {
        display: block;
    }
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    justify-self: center;
    padding: 28px 24px 24px;
    border-radius: 28px;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 30px 70px rgba(0, 20, 30, 0.35);
}

.auth-card h2 {
    font-size: 24px;
}

.auth-card > p {
    margin-top: 6px;
    color: var(--text-soft);
}

.auth-card form {
    margin-top: 22px;
}

.auth-card .footer {
    margin-top: 18px;
    text-align: center;
    font-size: 14px;
    color: var(--text-soft);
}

.auth-card .footer a {
    font-weight: 700;
}

.google-slot {
    display: flex;
    justify-content: center;
    min-height: 44px;
    margin-top: 20px;
}

/* Google's button frame is a light page. Inside a dark one the browser would
 * paint the frame white behind the button; matching schemes keeps it clear. */
.google-slot iframe {
    color-scheme: light;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.divider::before, .divider::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: var(--line);
}

.divider + form {
    margin-top: 16px;
}

/* the whole screen, not just the column the page sits in, so on a wide screen
 * no bubble is cut off partway across it */
.bubbles {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-hero {
    position: relative;
    z-index: 1;
}

.bubbles span {
    position: absolute;
    border-radius: 28%;
    opacity: 0.16;
    animation: drift 14s ease-in-out infinite;
    pointer-events: none;
}

/* ------------------------------------------------------------- pages the server renders for people logged in */

.page-header {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 14px;
    background: var(--hero);
    color: #FFFFFF;
}

.page-header .shell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 {
    font-size: 20px;
}

.page-header .icon-btn {
    color: #FFFFFF;
}

.page {
    padding: 20px 16px 60px;
}

/* the privacy policy and terms of service */
.legal {
    padding: 24px 22px 28px;
    font-size: 15px;
    line-height: 1.65;
}

.legal .updated {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

.legal h2 {
    margin: 30px 0 8px;
    font-size: 19px;
}

.legal h3 {
    margin: 20px 0 4px;
    font-size: 15px;
}

.legal p {
    margin: 8px 0 0;
}

.legal ul {
    margin: 8px 0 0;
    padding-left: 22px;
}

.legal li + li {
    margin-top: 6px;
}

.legal a {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal .summary {
    margin-top: 16px;
    padding: 16px 18px 18px;
    border-radius: var(--radius-small);
    background: var(--blue-soft);
}

.legal .summary h2 {
    margin: 0;
    font-size: 16px;
}

/* links to them under pages and forms */
.legal-links, .fine-print {
    margin: 16px 0 0;
    text-align: center;
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-soft);
}

.legal-links a, .fine-print a {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.settings-section h2 {
    margin: 30px 2px 12px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.settings-section:first-child h2 {
    margin-top: 6px;
}

.setting {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
}

.setting + .setting {
    border-top: 1px solid var(--line);
}

.setting .grow {
    flex: 1 1 auto;
    min-width: 0;
}

.setting strong {
    display: block;
    font-size: 15px;
}

.setting span {
    font-size: 13px;
    color: var(--text-soft);
}

.setting input[type=time] {
    width: 150px;
}

.setting-pair {
    display: flex;
    gap: 16px;
}

.setting-pair label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-soft);
}

.copy-field {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.copy-field input {
    flex: 1 1 auto;
    font-size: 14px;
}

.notice {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    margin-top: 12px;
    border-radius: var(--radius-small);
    background: var(--orange-soft);
    font-size: 14px;
}

.notice i {
    color: var(--orange);
    margin-top: 3px;
}

details.danger-zone summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--danger);
    list-style: none;
}

details.danger-zone summary::-webkit-details-marker {
    display: none;
}

/* ------------------------------------------------------------- the share page */

.share-hero {
    position: relative;
    overflow: hidden;
    padding: 30px 20px 90px;
    background: var(--hero);
    color: #FFFFFF;
    text-align: center;
}

.share-hero .brand {
    justify-content: center;
}

.share-hero .avatar {
    margin-top: 26px;
}

.share-hero .avatar .track {
    stroke: rgba(255, 255, 255, 0.18);
}

.share-hero .avatar .face {
    background: rgba(255, 255, 255, 0.14);
    border: 2px solid rgba(255, 255, 255, 0.25);
}

.share-hero h1 {
    margin-top: 4px;
    font-size: 30px;
}

.share-hero p {
    margin-top: 6px;
    color: var(--ice);
    font-weight: 600;
}

.share-body {
    position: relative;
    margin-top: -64px;
    padding: 0 16px 40px;
}

.share-body .card + .card, .share-body .stats + .card, .share-body .card + .stats {
    margin-top: 14px;
}

.share-body h2 {
    margin-bottom: 14px;
    font-size: 17px;
}

.cta {
    padding: 26px 20px;
    border-radius: var(--radius);
    background: var(--hero);
    color: #FFFFFF;
    text-align: center;
}

.cta h2 {
    color: #FFFFFF;
    font-size: 22px;
}

.cta p {
    margin: 8px 0 18px;
    color: var(--ice);
}

/* ------------------------------------------------------------- goal form extras */

/* days of the month, seven across like a calendar */
.choices.month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.choices.month .choice.day span {
    min-height: 38px;
    font-size: 13px;
}

/* the 29th to the 31st fill three of the last row; this takes the rest */
.choices.month .last-day {
    grid-column: span 4;
}

.remind-days {
    margin-top: 10px;
}

.remind-days .choices {
    margin-top: 10px;
}

.toggle-field {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-small);
    background: var(--surface-2);
    cursor: pointer;
}

.toggle-field .label {
    margin-bottom: 2px;
}

.toggle-field .hint {
    margin-top: 2px;
}

.goal-meta .on-profile {
    color: var(--cyan);
}

.goal-meta .on-profile i {
    font-size: 12px;
}

/* ------------------------------------------------------------- sharing */

.share-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 0 0 auto;
}

.perfect-banner .share-day {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.22);
    color: #FFFFFF;
    box-shadow: none;
}

.perfect-banner .share-day i {
    font-size: 14px;
}

.celebrate .share-moment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.segmented {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: var(--surface-2);
}

.segmented button {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-soft);
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.segmented button[aria-pressed="true"] {
    background: var(--surface);
    color: var(--blue);
    box-shadow: var(--shadow);
}

@media (prefers-color-scheme: dark) {
    .segmented button[aria-pressed="true"] {
        color: var(--cyan);
    }
}

/* the picture, at the 4:5 it is made, small enough to leave room for the buttons */
.post-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: min(100%, 40vh);
    aspect-ratio: 4 / 5;
    margin: 14px auto 16px;
    border-radius: 18px;
    overflow: hidden;
    background: var(--hero);
    color: rgba(255, 255, 255, 0.7);
    font-size: 26px;
    box-shadow: var(--shadow-lift);
}

.post-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.post-preview.loading img {
    opacity: 0.45;
}

.post-preview p {
    padding: 20px;
    color: #FFFFFF;
    font-size: 14px;
    text-align: center;
}

.post-maker .field {
    margin-bottom: 0;
}

.post-maker textarea {
    min-height: 70px;
    font-size: 14px;
}

.post-maker .form-actions {
    margin-top: 12px;
}

.post-maker .hint, .invite-share .hint {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-soft);
}

/* ------------------------------------------------------------- buddies */

.buddy-art {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 92px;
    height: 92px;
    margin: 0 auto 14px;
    border-radius: 50%;
    background: var(--hero);
    color: #FFFFFF;
    font-size: 38px;
    animation: float 3s ease-in-out infinite;
}

.buddy-card.poked {
    box-shadow: 0 0 0 2px var(--orange), var(--shadow);
}

.buddy-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.buddy-face {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--hero);
    color: #FFFFFF;
    font-size: 22px;
    font-weight: 900;
    text-decoration: none;
}

.buddy-face b {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--orange);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.buddy-name {
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.buddy-name strong {
    display: block;
    overflow: hidden;
    font-size: 17px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buddy-name span {
    display: block;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.poke-btn {
    flex: 0 0 auto;
}

.poked-you {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-small);
    background: var(--orange-soft);
    color: var(--orange);
    font-size: 14px;
    font-weight: 700;
}

.buddy-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 14px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.buddy-meta .fa-fire, .buddy-goal small .fa-fire {
    color: var(--orange);
}

.buddy-today.on {
    color: var(--cyan);
}

.buddy-goals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.buddy-goal {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: var(--radius-small);
    background: var(--surface-2);
}

.buddy-goal .goal-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 16px;
}

.buddy-goal .grow {
    flex: 1 1 auto;
    min-width: 0;
}

.buddy-goal strong {
    display: block;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.buddy-goal small {
    display: block;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 600;
}

.buddy-goal .state {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 800;
}

.buddy-goal .state.muted {
    font-size: 12px;
    font-weight: 600;
}

.buddy-goal .state.todo {
    width: 24px;
    height: 24px;
    border: 2px solid var(--line);
    border-radius: 50%;
}

.buddy-goal .state.done {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cyan);
    color: #FFFFFF;
    font-size: 12px;
}

.buddy-none {
    margin-top: 12px;
    font-size: 14px;
}

.buddy-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 14px;
    font-size: 14px;
}

.link-btn.danger, .buddy-remove .link-btn {
    color: var(--danger);
}

.buddy-note {
    margin-top: 18px;
    font-size: 13px;
    text-align: center;
}

.buddy-note i {
    margin-right: 4px;
    color: var(--cyan);
}

/* a buddy's profile page */
.poke-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.poke-card i.big {
    color: var(--orange);
    font-size: 26px;
}

.poke-card .grow {
    flex: 1 1 auto;
    min-width: 0;
}

.poke-card strong {
    display: block;
    font-size: 16px;
}

.poke-card span {
    color: var(--text-soft);
    font-size: 13px;
}

.poke-card form {
    flex: 0 0 auto;
}

.buddy-remove {
    margin-top: 22px;
    text-align: center;
}

/* the page an invite link opens */
.invite-card .invite-avatar {
    width: 92px;
    height: 92px;
    margin-bottom: 18px;
}

.invite-avatar .face {
    inset: 0;
    font-size: 34px;
}

.message-page .invite-card .kicker {
    margin: 0 0 4px;
    color: var(--orange);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.message-page .invite-card h1 + p {
    margin: 6px 0 18px;
}

.invite-perks {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0 0 22px;
    padding: 0;
    list-style: none;
    text-align: left;
}

.invite-perks li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-small);
    background: var(--surface-2);
    font-size: 14px;
    font-weight: 600;
}

.invite-perks i {
    width: 18px;
    margin-top: 3px;
    color: var(--cyan);
    text-align: center;
}

.invite-card .notice {
    margin: 0 0 18px;
    text-align: left;
}

/* ------------------------------------------------------------- small pages */

.message-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.message-page .card {
    max-width: 420px;
    text-align: center;
    padding: 34px 26px;
}

.message-page .card img {
    width: 76px;
    height: 76px;
    margin-bottom: 14px;
}

.message-page h1 {
    font-size: 24px;
}

.message-page p {
    margin: 10px 0 22px;
    color: var(--text-soft);
}

/* ------------------------------------------------------------- motion */

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

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

@keyframes pop {
    0% { transform: scale(1); }
    35% { transform: scale(1.035); }
    100% { transform: scale(1); }
}

@keyframes checkIn {
    0% { transform: scale(0) rotate(-30deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes floatUp {
    0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); }
    15% { opacity: 1; transform: translate(-50%, -80%) scale(1.15); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -260%) scale(1); }
}

@keyframes shine {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes bounceIn {
    0% { transform: scale(0.2) rotate(-20deg); }
    60% { transform: scale(1.12) rotate(6deg); }
    100% { transform: scale(1) rotate(0); }
}

@keyframes wobble {
    0%, 100% { transform: rotate(0); }
    10% { transform: rotate(-14deg); }
    20% { transform: rotate(10deg); }
    30% { transform: rotate(0); }
}

@keyframes drift {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    50% { transform: translate(18px, -26px) rotate(20deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
