:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f6f6;
    --bg-tertiary: #ececec;
    --text-primary: #1a1a1a;
    --text-secondary: #555555;
    --text-tertiary: #888888;
    --accent: #cc0000;
    --accent-light: #e63333;
    --accent-dark: #990000;
    --green: #00a047;
    --green-light: #e6f7ee;
    --border: #e0e0e0;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 8px;
}

body.dark-mode {
    --bg-primary: #121212;
    --bg-secondary: #1e1e1e;
    --bg-tertiary: #2a2a2a;
    --text-primary: #f0f0f0;
    --text-secondary: #bbbbbb;
    --text-tertiary: #888888;
    --accent: #e63333;
    --accent-light: #ff5555;
    --accent-dark: #cc0000;
    --green: #00c457;
    --green-light: #0d2e1a;
    --border: #333333;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* ── Header (Redfin-style white nav) ── */
.header {
    background: #ffffff;
    color: var(--text-primary);
    padding: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 0 2rem;
    height: 64px;
}

.brand h1 {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.tagline { display: none; }

.header-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex: 1;
    justify-content: flex-end;
}

.search-box {
    position: relative;
    max-width: 320px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.55rem 2.5rem 0.55rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 24px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input::placeholder { color: var(--text-tertiary); }

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(204,0,0,0.08);
    background: #fff;
}

.search-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-tertiary);
}

.theme-btn {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-secondary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Navigation Tabs (Redfin-style) ── */
.nav-tabs {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 64px;
    z-index: 90;
}

body.dark-mode .header,
body.dark-mode .nav-tabs { background: #1a1a1a; }

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    padding: 0 2rem;
    gap: 0.25rem;
}

.nav-tab {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.9rem 1.25rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.nav-tab:hover { color: var(--accent); }

.nav-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Main Content */
.main-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

/* Filter Tags */
.filter-tags {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tag-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--border);
    background-color: transparent;
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.tag-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tag-btn.active {
    background-color: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Posts List */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.post-item {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s;
}

.post-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateX(4px);
}

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

.post-title {
    font-size: 1.5rem;
    color: var(--accent);
    margin: 0;
}

.post-date {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.post-meta {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
    flex-wrap: wrap;
    align-items: center;
}

.post-category {
    display: inline-block;
    background-color: var(--accent);
    color: white;
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.read-time {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.post-excerpt {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.post-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.no-results {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

/* Archives */
.archives-list {
    display: grid;
    gap: 1rem;
}

.archive-month {
    background-color: var(--bg-secondary);
    border-left: 4px solid var(--accent);
    padding: 1.5rem;
    border-radius: 8px;
}

.archive-month h3 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.archive-post {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.archive-post:last-child {
    border-bottom: none;
}

.archive-post:hover {
    color: var(--accent);
}

/* About Box */
.about-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.about-text h3 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.about-text p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.about-text h4 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.about-text ul {
    list-style: none;
    margin-left: 0;
}

.about-text li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

/* Contact Box */
.contact-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 62, 219, 0.1);
}

.form-input.full-width {
    grid-column: 1 / -1;
}

.submit-btn {
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal[style*="display: flex"] {
    display: flex !important;
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--accent);
}

#modal-body h2 {
    color: var(--accent);
    margin-bottom: 1rem;
}

#modal-body .modal-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

#modal-body .modal-content-text {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
}

#modal-body .modal-tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

#modal-body .modal-tags .badge {
    cursor: pointer;
}

#modal-body .modal-tags .badge:hover {
    background-color: var(--accent);
    color: white;
}

.related-posts {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-posts h4 {
    color: var(--accent);
    margin-bottom: 1rem;
}

.related-item {
    padding: 0.75rem 0;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.related-item:hover {
    color: var(--accent);
}

/* Snake Game */
.game-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-top: 2rem;
}

.game-board {
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    background-color: var(--bg-secondary);
    border: 3px solid var(--accent);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    image-rendering: pixelated;
    max-width: 100%;
    height: auto;
}

.game-controls {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.game-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stat {
    background-color: var(--bg-primary);
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    color: var(--accent);
    font-size: 2rem;
    font-weight: 800;
}

.game-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.game-buttons .submit-btn {
    width: 100%;
}

.game-status {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.game-instructions {
    background-color: var(--bg-primary);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--accent);
}

.game-instructions h4 {
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.game-instructions ul {
    list-style: none;
    margin-left: 0;
}

.game-instructions li {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.game-instructions strong {
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
    }

    .search-box {
        min-width: 100%;
    }

    .brand h1 {
        font-size: 1.8rem;
    }

    .nav-container {
        padding: 0 1rem;
        overflow-x: auto;
    }

    .nav-tab {
        padding: 1rem 1rem;
    }

    .main-content {
        padding: 2rem 1rem;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .filter-tags {
        gap: 0.5rem;
    }

    .tag-btn {
        padding: 0.4rem 1rem;
        font-size: 0.85rem;
    }

    .post-item {
        padding: 1.5rem;
    }

    .post-title {
        font-size: 1.2rem;
    }

    .post-header {
        flex-direction: column;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 90%;
        padding: 1.5rem;
    }

    .game-container {
        grid-template-columns: 1fr;
    }

    #game-canvas {
        width: 100%;
        max-width: 100%;
    }

    .game-controls {
        padding: 1rem;
    }

/* Poetry Buffer */
.poetry-buffer {
    background-color: var(--bg-primary);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--accent);
    margin-top: 1rem;
}

.poetry-buffer h4 {
    color: var(--accent);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.word-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    row-gap: 0.75rem;
    min-height: 2.5rem;
    align-items: center;
    align-content: flex-start;
    width: 100%;
    word-wrap: break-word;
}

.word-chip {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    animation: slideIn 0.3s ease-out;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.word-chip.noun { background: linear-gradient(135deg, #4a9eff 0%, #2d7ee8 100%); }
.word-chip.verb { background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%); }
.word-chip.adjective { background: linear-gradient(135deg, #4ecdc4 0%, #00bfa5 100%); }
.word-chip.other { background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%); }

/* Poem Modal */
.poem-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.poem-modal-content {
    background-color: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--accent);
}

.poem-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.poem-text-container {
    background-color: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent);
}

.poem-text-container p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
}

.poem-image-container {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.poem-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.poem-actions .submit-btn {
    flex: 1;
}

/* Spinner Loading Animation */
.spinner {
    border: 4px solid var(--bg-secondary);
    border-top-color: var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    background-color: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: var(--shadow-md);
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.gallery-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
}

.gallery-content {
    padding: 1rem;
}

.gallery-theme {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.gallery-poem {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.gallery-delete {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.3s;
}

.gallery-delete:hover {
    background: #ff5252;
}

/* Power-up Display */
.powerup-display {
    background-color: var(--bg-primary);
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #ffb700;
    margin-top: 1rem;
}

.powerup-display h4 {
    color: #ffb700;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}

.active-powerup {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Poem Modal */
@media (max-width: 900px) {
    .poem-display {
        grid-template-columns: 1fr;
    }

    .poem-modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 600px) {
    .poem-display {
        grid-template-columns: 1fr;
    }

    .poem-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .word-chips {
        gap: 0.5rem;
    }

    .word-chip {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
        margin: 0.2rem;
    }
}

/* ══════════════════════════════════════
   HOUSES — Redfin-Style Property Cards
   ══════════════════════════════════════ */

.houses-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.houses-date-badge { font-size: 0.88rem; color: var(--text-secondary); font-weight: 500; }
.houses-refresh-tag {
    font-size: 0.75rem;
    background: var(--accent);
    color: #fff;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-weight: 600;
}

.houses-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    align-items: stretch;
}
@media (max-width: 1024px) {
    .houses-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .houses-grid { grid-template-columns: 1fr; }
}

/* ── House Card (Redfin style) ───────────────────────────────────────────── */
.house-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
    transition: box-shadow 0.2s, transform 0.15s;
    cursor: pointer;
    border: 1px solid #e8e8e8;
}
body.dark-mode .house-card { background: var(--bg-secondary); border-color: var(--border); }
.house-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,0.15); transform: translateY(-2px); }

/* Photo */
.house-photo-wrap {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #e8e8e8;
    flex-shrink: 0;
}
.house-photo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.4s ease;
}
.house-card:hover .house-photo { transform: scale(1.03); }

/* Rank badge — bottom left of photo */
.house-rank-badge {
    position: absolute;
    bottom: 0.6rem; left: 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    background: rgba(0,0,0,0.62);
    color: #fff;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    z-index: 2;
    letter-spacing: 0.02em;
}

/* Discount pill — bottom right of photo */
.house-discount-badge {
    position: absolute;
    bottom: 0.6rem; right: 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: #d63031;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    z-index: 2;
}
.house-discount-badge.below { background: #00b894; }

/* Card body */
.house-card-body {
    padding: 0.85rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

/* Price */
.house-listed-price {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.2;
}
body.dark-mode .house-listed-price { color: var(--text-primary); }
.house-market-price {
    font-size: 0.8rem;
    color: #888;
    text-decoration: line-through;
}

/* Specs line: 4 beds · 2 baths · 2,116 sq ft */
.house-specs {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.88rem;
    color: #333;
    font-weight: 500;
    flex-wrap: wrap;
    margin-top: 0.15rem;
}
body.dark-mode .house-specs { color: var(--text-secondary); }
.house-spec-divider { color: #bbb; margin: 0 0.2rem; }

/* Address */
.house-address { margin-top: 0.1rem; }
.house-address h3 {
    font-size: 0.9rem;
    font-weight: 500;
    color: #444;
    line-height: 1.35;
    margin: 0;
}
body.dark-mode .house-address h3 { color: var(--text-secondary); }
.house-city {
    font-size: 0.82rem;
    color: #888;
    margin-top: 0.05rem;
}

/* Discount / savings row */
.house-savings-row {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #00b894;
    font-weight: 600;
}

/* Type badge */
.house-type-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #888;
    background: #f4f4f4;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

/* View on Zillow link */
.house-zillow-btn {
    display: inline-block;
    margin-top: auto;
    padding-top: 0.6rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-bottom: 0rem;
    transition: background 0.15s;
}
.house-zillow-btn:hover { text-decoration: underline; }

@media (max-width: 680px) {
    .houses-grid { grid-template-columns: 1fr; }
    .header-content { padding: 0 1rem; height: 56px; }
    .nav-container { padding: 0 0.5rem; }
    .nav-tab { padding: 0.75rem 0.75rem; font-size: 0.82rem; }
    .brand h1 { font-size: 1.3rem; }
}

/* ── Houses filter bar ─────────────────────────────────────────────────────── */
.houses-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1.75rem;
    flex-wrap: wrap;
}

/* State pills */
.state-pills {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.state-pill {
    padding: 0.42rem 1.1rem;
    border: 2px solid var(--border);
    background: var(--bg-card, var(--bg-primary));
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s, box-shadow 0.18s;
    white-space: nowrap;
    line-height: 1.4;
}
.state-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(204,0,0,0.12);
}
.state-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(204,0,0,0.22);
}

/* Area dropdown */
.houses-area-select {
    padding: 0.44rem 0.9rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card, var(--bg-primary));
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    min-width: 170px;
    transition: border-color 0.18s, box-shadow 0.18s;
    height: 36px;
}
.houses-area-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(204,0,0,0.12);
}

/* Result count badge */
.houses-count {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    font-weight: 500;
    margin-left: auto;
    white-space: nowrap;
}

@media (max-width: 680px) {
    .houses-filter-row { gap: 0.6rem; }
    .houses-area-select { min-width: 140px; }
    .houses-count { margin-left: 0; width: 100%; }
}

/* Letter print output — only the generated letter should appear on the printed page */
@media print {
    body * {
        visibility: hidden;
    }
    #letter-preview, #letter-preview * {
        visibility: visible;
    }
    #letter-preview {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
    }
}
