:root {
    --bg: #f4efe5;
    --surface: rgba(255, 252, 247, 0.82);
    --ink: #1f1a17;
    --muted: #61564f;
    --accent: #d55d3a;
    --accent-dark: #9a3619;
    --line: rgba(31, 26, 23, 0.12);
    --shadow: 0 24px 60px rgba(70, 40, 22, 0.14);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(213, 93, 58, 0.18), transparent 30%),
        radial-gradient(circle at bottom right, rgba(78, 125, 102, 0.16), transparent 25%),
        var(--bg);
}

img {
    max-width: 100%;
}

.container {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
}

.narrow {
    width: min(760px, calc(100% - 2rem));
}

.site-header {
    position: sticky;
    top: 0;
    backdrop-filter: blur(16px);
    background: rgba(244, 239, 229, 0.78);
    border-bottom: 1px solid var(--line);
}

.nav,
.footer-row,
.hero-grid,
.cta-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.nav {
    padding: 1rem 0;
}

.nav nav,
.footer-row div,
.hero-actions,
.cta-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.brand,
a {
    color: inherit;
    text-decoration: none;
}

.brand {
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.brand-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 20px;
}

.page-logo {
    display: block;
    width: min(220px, 56vw);
    height: auto;
    margin: 0 auto 1.5rem;
}

.legal-logo {
    width: min(180px, 46vw);
    margin: 0 auto 1.75rem;
}

.hero .eyebrow,
.hero h1,
.hero-copy,
.legal-page .eyebrow,
.legal-page h1 {
    text-align: center;
}

.hero-copy {
    margin-left: auto;
    margin-right: auto;
}

.search-panel {
    max-width: 42rem;
    margin: 2rem auto 0;
}

.legal-page {
    text-align: center;
}

.hero {
    padding: 5rem 0 3rem;
}

.maintenance-hero {
    min-height: calc(100vh - 132px);
    display: flex;
    align-items: center;
    padding: 3rem 0 5rem;
}

.maintenance-shell {
    display: flex;
    justify-content: center;
}

.maintenance-card {
    width: min(760px, 100%);
    padding: 2.5rem;
    text-align: center;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 32px;
    box-shadow: var(--shadow);
}

.maintenance-logo {
    margin-bottom: 1.75rem;
}

.maintenance-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.tester-access {
    padding: 0 0 2rem;
}

.tester-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 1rem;
}

.auth-card {
    padding: 1.75rem;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.auth-copy {
    max-width: 38rem;
}

.auth-mode-toggle {
    display: inline-flex;
    padding: 0.3rem;
    border-radius: 999px;
    background: rgba(31, 26, 23, 0.08);
    margin-bottom: 1.25rem;
}

.auth-mode-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 700;
    padding: 0.6rem 1rem;
    border-radius: 999px;
    cursor: pointer;
}

.auth-mode-button.is-active {
    background: #fff8f1;
    color: var(--ink);
    box-shadow: 0 8px 18px rgba(70, 40, 22, 0.08);
}

.auth-form {
    display: grid;
    gap: 0.75rem;
}

.auth-form input,
.profile-field input {
    min-height: 52px;
    padding: 0 1rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
    font: inherit;
    color: var(--ink);
}

.auth-actions,
.auth-session {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.auth-session {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.tester-panel {
    padding-top: 0;
}

.profile-section {
    padding-top: 0;
    padding-bottom: 4rem;
}

.profile-form {
    display: grid;
    gap: 1rem;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.profile-field {
    display: grid;
    gap: 0.4rem;
}

.profile-field span {
    font-size: 0.92rem;
    color: var(--muted);
    font-weight: 700;
}

.field-error {
    color: #b2321f;
    font-size: 0.82rem;
    line-height: 1.4;
}

.profile-field-full {
    grid-column: 1 / -1;
}

.profile-toggle {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-weight: 700;
}

.profile-toggle input {
    width: 18px;
    height: 18px;
}

.hero-grid {
    align-items: stretch;
}

.hero-grid > * {
    flex: 1;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
    color: var(--accent-dark);
    margin-bottom: 1rem;
}

h1,
h2 {
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    line-height: 0.95;
    margin: 0 0 1rem;
}

h1 {
    font-size: clamp(3rem, 7vw, 5.8rem);
}

h2 {
    font-size: clamp(2rem, 4vw, 3.4rem);
}

h3 {
    margin-top: 0;
}

p {
    color: var(--muted);
    line-height: 1.65;
}

.hero-copy {
    max-width: 34rem;
    font-size: 1.08rem;
}

.search-panel {
    margin-top: 2rem;
    padding: 1.2rem;
    border-radius: 28px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
}

.search-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.search-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.search-row input {
    flex: 1;
    min-height: 52px;
    padding: 0 1rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
    font: inherit;
    color: var(--ink);
}

.search-row input:focus {
    outline: 2px solid rgba(213, 93, 58, 0.24);
    outline-offset: 2px;
}

.search-button {
    min-width: 124px;
}

.search-note {
    margin: 0.75rem 0 0;
    font-size: 0.92rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 0.85rem 1.2rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    transition: transform 160ms ease, background-color 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: var(--accent);
    color: #fff9f5;
    border-color: transparent;
}

.button.secondary {
    background: var(--surface);
}

.hero-card,
.feature-card,
.cta-panel,
.legal-page {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
    border-radius: 28px;
}

.hero-card {
    padding: 1rem;
}

.screen-card {
    min-height: 100%;
    padding: 1.5rem;
    border-radius: 22px;
    background: linear-gradient(180deg, #1e2522 0%, #303834 100%);
    color: #f8f1e9;
}

.screen-label,
.price-chip {
    display: inline-flex;
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
}

.screen-label {
    background: rgba(255, 255, 255, 0.12);
}

.price-chip {
    margin-top: 3rem;
    background: rgba(213, 93, 58, 0.2);
    color: #ffd5c8;
}

.screen-content h2 {
    margin-top: 1rem;
    font-size: clamp(2.5rem, 5vw, 4rem);
    color: #fff;
}

.results {
    padding: 0 0 4rem;
}

.tracked-deals {
    padding: 0 0 4rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.results-summary {
    max-width: 26rem;
    text-align: right;
}

.status-message,
.loading-state {
    margin-bottom: 1rem;
    padding: 1rem 1.2rem;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow);
}

.loading-state {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 2px solid rgba(31, 26, 23, 0.15);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}

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

.result-card {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1.2rem;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.result-card.best-deal {
    border-color: rgba(213, 93, 58, 0.4);
}

.result-media {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(31, 26, 23, 0.08);
}

.result-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.result-image-amazon {
    padding: 1rem;
}

.result-logo-placeholder {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.result-badge {
    display: inline-flex;
    align-self: flex-start;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(213, 93, 58, 0.14);
    color: var(--accent-dark);
    font-size: 0.82rem;
    font-weight: 700;
}

.result-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
}

.result-store {
    font-size: 0.92rem;
    color: var(--accent-dark);
    font-weight: 700;
}

.result-price {
    font-family: "Instrument Serif", serif;
    font-size: 2rem;
    color: var(--ink);
}

.result-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.35;
}

.result-link {
    width: fit-content;
}

.result-actions,
.tracked-deals-actions,
.saved-actions,
.saved-badges {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.result-actions {
    justify-content: space-between;
    margin-top: auto;
    flex-wrap: wrap;
}

.result-track-button,
.tracked-button {
    min-width: 96px;
}

.tracked-button {
    background: rgba(31, 26, 23, 0.08);
}

.saved-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.saved-card {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 1rem;
    padding: 1.2rem;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.saved-media {
    aspect-ratio: 1 / 1;
    border-radius: 20px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(31, 26, 23, 0.08);
}

.saved-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.saved-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.saved-content {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.saved-meta,
.saved-pricing,
.saved-details,
.saved-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.saved-details,
.saved-tracked-at,
.target-price-field span {
    color: var(--muted);
    font-size: 0.92rem;
}

.saved-badge {
    display: inline-flex;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.saved-badge.target-hit {
    background: rgba(41, 129, 91, 0.16);
    color: #1f6847;
}

.saved-badge.price-drop {
    background: rgba(213, 93, 58, 0.14);
    color: var(--accent-dark);
}

.target-price-field {
    display: grid;
    gap: 0.4rem;
}

.target-price-field input {
    min-height: 44px;
    width: 120px;
    padding: 0 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
    font: inherit;
    color: var(--ink);
}

.features {
    padding: 2rem 0 4rem;
}

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

.feature-card,
.legal-page {
    padding: 1.5rem;
}

.cta {
    padding-bottom: 4rem;
}

.cta-panel {
    padding: 1.5rem;
}

.site-footer {
    padding: 0 0 2rem;
}

.footer-row {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.legal-page {
    margin: 3rem auto;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.2rem;
    color: var(--accent-dark);
}

.help-page {
    padding: 2rem 0 4rem;
}

.help-hero {
    padding-bottom: 2rem;
}

.help-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.85fr);
    gap: 1rem;
    align-items: stretch;
}

.help-intro,
.help-summary-card,
.help-card,
.faq-card {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.help-intro {
    padding: 2rem;
}

.help-logo {
    margin: 0 0 1.25rem;
    width: min(160px, 42vw);
}

.help-intro h1,
.help-intro .eyebrow,
.help-copy {
    text-align: left;
}

.help-copy {
    max-width: 34rem;
    font-size: 1.05rem;
}

.help-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.help-summary-card {
    padding: 1.6rem;
    background: linear-gradient(180deg, #1e2522 0%, #303834 100%);
    color: #f8f1e9;
}

.help-summary-card h2,
.help-summary-card p,
.help-summary-card li {
    color: inherit;
}

.help-summary-list {
    margin: 1.25rem 0 0;
    padding-left: 1.2rem;
    line-height: 1.7;
}

.help-section {
    padding-top: 1rem;
}

.help-grid,
.faq-list,
.store-grid {
    display: grid;
    gap: 1rem;
}

.help-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.faq-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.store-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 1rem;
}

.help-card,
.faq-card,
.store-card {
    padding: 1.5rem;
}

.help-card .eyebrow {
    margin-bottom: 0.75rem;
}

.store-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.store-card h3 {
    margin-bottom: 0.35rem;
}

.store-card p {
    margin: 0;
}

.store-card-muted {
    opacity: 0.82;
}

.store-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 18px;
    font-weight: 700;
    font-size: 1.25rem;
    text-transform: uppercase;
    color: #fff;
    flex-shrink: 0;
}

.store-icon-google {
    background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
}

.store-icon-amazon {
    background: linear-gradient(135deg, #131921 0%, #ff9900 100%);
}

.store-icon-walmart {
    background: linear-gradient(135deg, #0071ce 0%, #5fb5ff 100%);
}

.store-icon-ebay {
    background: linear-gradient(135deg, #e53238 0%, #0064d2 100%);
}

.store-icon-target {
    background: linear-gradient(135deg, #cc0000 0%, #ff6b6b 100%);
}

@media (max-width: 860px) {
    .hero-grid,
    .nav,
    .footer-row,
    .cta-panel,
    .results-header,
    .search-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .feature-grid,
    .results-grid,
    .saved-grid {
        grid-template-columns: 1fr;
    }

    .help-shell,
    .help-grid,
    .faq-list,
    .store-grid,
    .tester-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .nav nav,
    .hero-actions,
    .maintenance-actions,
    .help-actions,
    .cta-links,
    .footer-row div {
        flex-wrap: wrap;
    }

    .results-summary {
        text-align: left;
    }

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

    .search-button {
        width: 100%;
    }

    .help-intro {
        padding: 1.5rem;
    }

    .maintenance-card {
        padding: 1.75rem;
    }
}

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