.heart-tracker {
    --ht-canvas: #fff7f8;
    --ht-surface: #ffffff;
    --ht-surface-warm: #fff7f8;
    --ht-text: #1a1a1a;
    --ht-muted: #6b6b6b;
    --ht-primary: #e83d6f;
    --ht-primary-dark: #c72f5a;
    --ht-soft-rose: #ffe7ee;
    --ht-rose-hover: #fff0f4;
    --ht-rose-active: #ffdce8;
    --ht-sage: #dfece5;
    --ht-blue-grey: #e5eef4;
    --ht-warm-sand: #f3eadf;
    --ht-border: #ffd1dc;
    --ht-focus: #e83d6f;
    --ht-danger: #c72f5a;
    --ht-shadow: 0 18px 50px rgba(232, 61, 111, 0.14);
    --ht-soft-shadow: 0 10px 28px rgba(26, 26, 26, 0.07);
    --ht-nav-button-height: 58px;
    --ht-nav-padding-y: 8px;
    --ht-nav-height: calc(var(--ht-nav-button-height) + (var(--ht-nav-padding-y) * 2) + env(safe-area-inset-bottom, 0px));
    --ht-nav-clearance: calc(var(--ht-nav-height) + 16px);
    color: var(--ht-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

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

.heart-tracker button,
.heart-tracker input,
.heart-tracker select,
.heart-tracker textarea {
    font: inherit;
}

.heart-tracker button {
    cursor: pointer;
}

.heart-tracker button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.heart-tracker :focus-visible {
    outline: 3px solid rgba(232, 61, 111, 0.26);
    outline-offset: 3px;
}

.ht-shell,
.ht-lock-wrap {
    width: min(100%, 760px);
    min-height: 100%;
    min-height: 100dvh;
    margin: 0 auto;
    background:
        radial-gradient(circle at 12% 0%, rgba(255, 231, 238, 0.9), transparent 28%),
        linear-gradient(180deg, #fffafa 0%, var(--ht-canvas) 48%, #fff0f4 100%);
}

.ht-shell {
    position: relative;
    padding: 24px 18px 0;
}

@supports not (height: 100dvh) {
    .ht-shell,
    .ht-lock-wrap {
        min-height: 100%;
        min-height: -webkit-fill-available;
    }
}

.ht-lock-wrap {
    display: grid;
    place-items: center;
    padding: 22px;
}

.ht-lock-card {
    width: min(100%, 430px);
    padding: 34px 24px 26px;
    border: 1px solid rgba(255, 209, 220, 0.95);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--ht-shadow);
    text-align: center;
    backdrop-filter: blur(18px);
    animation: ht-rise 180ms ease-out;
}

.ht-lock-mark {
    display: grid;
    width: 74px;
    height: 74px;
    margin: 0 auto 12px;
    place-items: center;
    border-radius: 24px;
    background: var(--ht-soft-rose);
    box-shadow: inset 0 0 0 1px rgba(232, 61, 111, 0.12);
    font-size: 38px;
}

.ht-lock-card h1,
.ht-app-header h1,
.ht-section-title h2,
.ht-hero .ht-greeting {
    margin: 0;
    color: var(--ht-text);
    letter-spacing: 0;
}

.ht-lock-card h1 {
    font-size: clamp(34px, 9vw, 44px);
    line-height: 1.04;
}

.ht-lock-copy {
    margin: 24px 0 10px;
    font-size: 18px;
    color: var(--ht-text);
}

.ht-lock-form {
    display: grid;
    gap: 14px;
    margin-top: 12px;
    text-align: left;
}

.ht-pin-field input {
    text-align: center;
    letter-spacing: 0.24em;
    font-size: 24px;
    font-weight: 700;
}

.ht-app-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 2px 22px;
}

.ht-app-header h1 {
    font-size: clamp(30px, 8vw, 40px);
    line-height: 1.05;
}

.ht-kicker,
.ht-credit,
.ht-muted,
.ht-error {
    margin: 0;
}

.ht-kicker {
    color: var(--ht-primary-dark);
    font-size: 13px;
    font-weight: 750;
    letter-spacing: 0.04em;
}

.ht-credit {
    color: var(--ht-muted);
    font-size: 14px;
    font-style: italic;
}

.ht-credit a {
    color: inherit;
    text-decoration: none;
}

.ht-credit a:hover {
    color: var(--ht-primary);
    text-decoration: underline;
}

.ht-main {
    display: grid;
    gap: 16px;
    padding-bottom: 16px;
    scroll-padding-bottom: var(--ht-nav-clearance);
}

.ht-animate-in,
.ht-card,
.ht-section-title {
    animation: ht-rise 170ms ease-out;
}

.ht-hero {
    display: grid;
    gap: 14px;
    padding: 28px 22px;
    border: 1px solid rgba(255, 209, 220, 0.95);
    border-radius: 30px;
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.96), rgba(255, 240, 244, 0.94));
    box-shadow: var(--ht-shadow);
}

.ht-hero .ht-greeting {
    font-size: clamp(28px, 8vw, 42px);
    line-height: 1.08;
}

.ht-date {
    margin: 0;
    color: var(--ht-muted);
    font-size: 17px;
    font-weight: 650;
}

.ht-hero p:not(.ht-greeting):not(.ht-date) {
    margin: 0;
    color: #424242;
    font-size: 16px;
}

.ht-privacy-note {
    padding: 14px 15px;
    border-radius: 18px;
    border: 1px solid rgba(232, 61, 111, 0.12);
    background: var(--ht-rose-hover);
}

.ht-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}

.ht-primary,
.ht-secondary,
.ht-danger,
.ht-icon-button {
    min-height: 52px;
    border: 0;
    border-radius: 14px;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.ht-primary,
.ht-secondary,
.ht-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    font-weight: 850;
    text-decoration: none;
}

.ht-primary {
    background: linear-gradient(135deg, var(--ht-primary), var(--ht-primary-dark));
    color: #fff;
    box-shadow: 0 10px 24px rgba(232, 61, 111, 0.28);
}

.ht-secondary {
    border: 1.5px solid var(--ht-primary);
    background: rgba(255, 255, 255, 0.92);
    color: var(--ht-primary);
    box-shadow: none;
}

.ht-danger {
    border: 1.5px solid var(--ht-primary-dark);
    background: #fff;
    color: var(--ht-primary-dark);
    box-shadow: none;
}

.ht-primary:hover,
.ht-secondary:hover,
.ht-danger:hover,
.ht-icon-button:hover {
    transform: translateY(-1px);
}

.ht-secondary:hover,
.ht-danger:hover,
.ht-icon-button:hover {
    background: var(--ht-rose-hover);
    color: var(--ht-primary);
}

.ht-primary:active,
.ht-secondary:active,
.ht-danger:active,
.ht-icon-button:active {
    transform: translateY(1px) scale(0.99);
}

.ht-full {
    width: 100%;
}

.ht-small {
    min-height: 44px;
    padding-inline: 15px;
    font-size: 14px;
}

.ht-icon-button {
    display: grid;
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1.5px solid var(--ht-primary);
    background: rgba(255, 255, 255, 0.88);
    color: var(--ht-primary);
    box-shadow: none;
}

.ht-icon-button svg,
.ht-bottom-nav svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.ht-section-title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 2px 2px;
}

.ht-section-title h2 {
    font-size: clamp(26px, 7vw, 34px);
    line-height: 1.12;
}

.ht-card {
    display: grid;
    gap: 16px;
    padding: 20px;
    border: 1px solid rgba(255, 209, 220, 0.95);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--ht-soft-shadow);
}

.ht-card h3 {
    margin: 0;
    color: var(--ht-text);
    font-size: 20px;
    line-height: 1.2;
}

.ht-home-card {
    grid-template-columns: 1fr 1fr;
}

.ht-home-card > div {
    display: grid;
    gap: 2px;
}

.ht-stat {
    display: block;
    color: var(--ht-primary);
    font-size: 24px;
    font-weight: 800;
    line-height: 1.15;
}

.ht-muted {
    color: var(--ht-muted);
    font-size: 15px;
}

.ht-error {
    min-height: 20px;
    color: var(--ht-danger);
    font-size: 14px;
    font-weight: 650;
    text-align: center;
}

.ht-entry-form {
    display: grid;
    gap: 16px;
}

.ht-field,
.ht-fieldset {
    display: grid;
    gap: 9px;
    margin: 0;
}

.ht-field > span,
.ht-fieldset legend {
    color: var(--ht-text);
    font-size: 15px;
    font-weight: 720;
}

.ht-fieldset {
    min-width: 0;
    padding: 0;
    border: 0;
}

.ht-field input,
.ht-field select,
.ht-field textarea {
    width: 100%;
    min-height: 54px;
    border: 1.5px solid rgba(232, 61, 111, 0.22);
    border-radius: 14px;
    background: #fff;
    color: var(--ht-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.ht-field input,
.ht-field select {
    padding: 0 15px;
}

.ht-number-wrap {
    position: relative;
    display: block;
}

.ht-weight-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
}

.ht-weight-part {
    gap: 7px;
}

.ht-weight-part > span:first-child {
    font-size: 13px;
}

.ht-number-wrap input {
    padding-right: 58px;
    font-size: 20px;
    font-weight: 850;
}

.ht-field-unit {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: var(--ht-text);
    font-size: 17px;
    font-weight: 850;
    pointer-events: none;
}

.ht-field textarea {
    min-height: 132px;
    padding: 14px 15px;
    resize: vertical;
}

.ht-scale {
    grid-template-columns: 1fr auto;
    align-items: center;
}

.ht-scale span {
    grid-column: 1 / -1;
}

.ht-scale input[type="range"] {
    min-height: 42px;
    padding: 0;
    accent-color: var(--ht-primary);
    background: transparent;
    box-shadow: none;
}

.ht-scale input[type="range"]::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--ht-primary), var(--ht-primary-dark));
}

.ht-scale input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    margin-top: -8.5px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--ht-primary);
    box-shadow: 0 2px 8px rgba(232, 61, 111, 0.28);
}

.ht-scale input[type="range"]::-moz-range-track {
    height: 5px;
    border-radius: 999px;
    background: var(--ht-primary);
}

.ht-scale input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 3px solid #fff;
    border-radius: 50%;
    background: var(--ht-primary);
    box-shadow: 0 2px 8px rgba(232, 61, 111, 0.28);
}

.ht-scale output {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: 15px;
    background: var(--ht-soft-rose);
    color: var(--ht-primary);
    font-weight: 800;
}

.ht-segmented {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 8px;
}

.ht-segmented label,
.ht-check-row {
    position: relative;
    min-height: 52px;
}

.ht-segmented input,
.ht-check-row input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ht-segmented span,
.ht-check-row span {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    border: 1.5px solid rgba(232, 61, 111, 0.34);
    border-radius: 14px;
    background: #fff;
    color: var(--ht-primary);
    font-weight: 820;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.ht-check-row span {
    justify-content: flex-start;
    padding: 0 14px;
}

.ht-segmented input:checked + span,
.ht-check-row input:checked + span {
    border-color: var(--ht-primary);
    background: linear-gradient(135deg, var(--ht-primary), var(--ht-primary-dark));
    color: #fff;
}

.ht-segmented input:focus-visible + span,
.ht-check-row input:focus-visible + span {
    outline: 3px solid rgba(232, 61, 111, 0.26);
    outline-offset: 3px;
}

.ht-checkbox-grid {
    display: grid;
    gap: 8px;
}

.ht-save-bar {
    position: sticky;
    bottom: calc(var(--ht-nav-height) + 4px);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 209, 220, 0.95);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--ht-shadow);
    backdrop-filter: blur(18px);
}

.ht-save-state {
    margin: 0;
    color: var(--ht-muted);
    font-size: 14px;
}

.ht-list {
    display: grid;
    gap: 10px;
}

.ht-history-row {
    display: grid;
    grid-template-columns: minmax(108px, 0.8fr) 1.2fr;
    gap: 14px;
    width: 100%;
    min-height: 74px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid rgba(255, 209, 220, 0.95);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--ht-text);
    text-align: left;
    box-shadow: var(--ht-soft-shadow);
}

.ht-history-row strong,
.ht-history-row em {
    display: block;
}

.ht-history-row em {
    color: var(--ht-muted);
    font-size: 13px;
    font-style: normal;
}

.ht-chart-card canvas {
    width: 100%;
    height: 190px;
}

.ht-bottom-nav {
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    width: 100%;
    margin: 0;
    min-height: var(--ht-nav-height);
    padding: var(--ht-nav-padding-y) 8px calc(var(--ht-nav-padding-y) + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 209, 220, 0.95);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 -14px 36px rgba(232, 61, 111, 0.12);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.ht-bottom-nav button {
    display: grid;
    min-width: 0;
    min-height: var(--ht-nav-button-height);
    place-items: center;
    gap: 3px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: var(--ht-text);
    font-size: 11px;
    font-weight: 760;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.ht-bottom-nav button[aria-current="page"] {
    background: var(--ht-soft-rose);
    color: var(--ht-primary);
    font-weight: 900;
}

.ht-bottom-nav button:hover {
    background: var(--ht-rose-hover);
    color: var(--ht-primary);
}

.ht-bottom-nav button[aria-current="page"] svg {
    transform: scale(1.08);
}

.ht-empty {
    text-align: center;
}

.ht-noscript {
    margin: 20px;
}

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

@media (min-width: 720px) {
    .ht-shell {
        margin-top: 24px;
        margin-bottom: 24px;
        border-radius: 36px;
        box-shadow: 0 24px 80px rgba(232, 61, 111, 0.14);
    }

    .ht-card {
        padding: 24px;
    }

    .ht-checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 430px) {
    .heart-tracker {
        --ht-nav-button-height: 56px;
    }

    .ht-shell {
        padding-inline: 14px;
    }

    .ht-home-card,
    .ht-history-row,
    .ht-weight-grid {
        grid-template-columns: 1fr;
    }

    .ht-save-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .ht-save-bar .ht-primary {
        width: 100%;
    }

    .ht-bottom-nav {
        padding-inline: 5px;
    }

    .ht-bottom-nav button {
        border-radius: 15px;
        font-size: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .heart-tracker *,
    .heart-tracker *::before,
    .heart-tracker *::after {
        animation-duration: 0.001ms !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}

/* Theme guard: keep WordPress/theme button styles from overriding the app. */
.heart-tracker button.ht-primary,
.heart-tracker .ht-save-bar button.ht-primary,
.heart-tracker .ht-lock-form button.ht-primary {
    min-height: 52px !important;
    padding: 0 22px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, var(--ht-primary), var(--ht-primary-dark)) !important;
    color: #fff !important;
    box-shadow: 0 10px 24px rgba(232, 61, 111, 0.28) !important;
    font-weight: 850 !important;
    opacity: 1 !important;
}

.heart-tracker button.ht-secondary,
.heart-tracker button.ht-icon-button {
    min-height: 52px !important;
    border: 1.5px solid var(--ht-primary) !important;
    border-radius: 14px !important;
    background: rgba(255, 255, 255, 0.94) !important;
    color: var(--ht-primary) !important;
    box-shadow: none !important;
    font-weight: 850 !important;
    opacity: 1 !important;
}

.heart-tracker button.ht-secondary:hover,
.heart-tracker button.ht-icon-button:hover {
    background: var(--ht-rose-hover) !important;
    color: var(--ht-primary) !important;
}

.heart-tracker button.ht-danger {
    min-height: 52px !important;
    border: 1.5px solid var(--ht-primary-dark) !important;
    border-radius: 14px !important;
    background: #fff !important;
    color: var(--ht-primary-dark) !important;
    box-shadow: none !important;
    font-weight: 850 !important;
    opacity: 1 !important;
}

.heart-tracker .ht-help-button {
    display: inline-flex !important;
    width: auto !important;
    gap: 8px !important;
    padding: 0 16px !important;
    white-space: nowrap !important;
}

.heart-tracker .ht-help-button svg {
    width: 18px !important;
    height: 18px !important;
}

.heart-tracker .ht-help-button span {
    display: inline !important;
    color: inherit !important;
    font-size: 14px !important;
    line-height: 1 !important;
}
