/* Self-hosted Inter (latin subset) — no third-party font origin. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/inter-latin-400-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('fonts/inter-latin-500-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('fonts/inter-latin-600-normal.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/inter-latin-700-normal.woff2') format('woff2');
}

:root {
    /* Shared dark palette (mirrors /assets/css/theme.css) */
    --bg: #0b1220;
    --surface: #0f172a;
    --surface-2: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --cyan: #22d3ee;

    /* Follow the shared theme accent (neon cyan #1abfff) from /assets/css/theme.css */
    --primary: var(--accent);
    --primary-hover: var(--accent-hover);
    --bg-gradient-start: #0b1220;
    --bg-gradient-end: #0b1220;
    --surface-border: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --ad-bg: #1e293b;
    --ad-text: #94a3b8;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Ad Placeholders */
.ad-container {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.ad-placeholder {
    background-color: var(--ad-bg);
    color: var(--ad-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.ad-placeholder[data-ad-size="728x90"] {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-placeholder[data-ad-size="300x250"] {
    width: 300px;
    height: 250px;
}

/* Layout */
.header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.main-content {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;       /* centered single column, like the other pages */
    padding: 0 1rem;
}

.content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto;
}

/* Cards */
.unscrambler-card, .results-section {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

/* Forms */
.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

input[type="text"] {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--surface);
    color: var(--text-main);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 191, 255, 0.25);
}

.main-input input {
    font-size: 1.25rem;
    padding: 1rem;
    text-transform: lowercase;
}

/* Advanced Filters Grid */
.advanced-filters-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

/* Buttons */
.btn-primary {
    background-color: var(--accent);
    color: #0b1220;
    border: none;
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 191, 255, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Results Section */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    font-size: 1.25rem;
}

.sorting-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sorting-controls select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-family: inherit;
    outline: none;
    background: var(--surface);
    color: var(--text-main);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 1rem;
}

/* Results grouped by word length */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}
.result-group-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.85rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.result-group-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    background: rgba(26, 191, 255, 0.12);
    border: 1px solid rgba(26, 191, 255, 0.30);
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
}

.word-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    position: relative;
    transition: all 0.2s ease;
    cursor: default;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.word-tile:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
    border-color: var(--primary);
    color: var(--primary);
}

.word-points {
    font-size: 0.7rem;
    background: #FEF3C7;
    color: #D97706;
    padding: 2px 6px;
    border-radius: 12px;
    position: absolute;
    top: -8px;
    right: -8px;
    font-weight: 700;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Loading Spinner */
.hidden {
    display: none !important;
}

#loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--primary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(26, 191, 255, 0.2);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

footer {
    margin-top: auto;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
    }
    
    .ad-placeholder[data-ad-size="728x90"] {
        height: 50px;
        font-size: 0.7rem;
    }
    
    .ad-placeholder[data-ad-size="300x250"] {
        width: 100%;
        max-width: 300px;
    }
}

/* ---- Accessibility: skip link + visible focus ---- */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--primary);
    color: #fff;
    padding: 0.6rem 1rem;
    border-radius: 0 0 8px 0;
    z-index: 1001;
}
.skip-link:focus {
    left: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(26, 191, 255, 0.6);
    outline-offset: 2px;
}

/* ---- Footer legal links ---- */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.75rem;
}
.footer-links a,
.link-button {
    color: var(--primary);
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}
.footer-links a:hover,
.link-button:hover {
    color: var(--primary-hover);
}

/* ---- Consent banner (Google Consent Mode v2) ---- */
.consent-banner {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: 760px;
    margin: 0 auto;
    background: rgba(31, 41, 55, 0.97);
    color: #F9FAFB;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    padding: 1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    z-index: 1000;
}
.consent-text {
    flex: 1;
    min-width: 240px;
    font-size: 0.875rem;
    line-height: 1.45;
    margin: 0;
}
.consent-text a {
    color: #C7D2FE;
}
.consent-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}
.btn-consent {
    padding: 0.6rem 1.1rem;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn-accept {
    background: var(--primary);
    color: #fff;
}
.btn-accept:hover {
    background: var(--primary-hover);
}
.btn-reject {
    background: transparent;
    color: #F9FAFB;
    border-color: rgba(249, 250, 251, 0.5);
}
.btn-reject:hover {
    background: rgba(249, 250, 251, 0.12);
}

@media (max-width: 520px) {
    .consent-actions {
        width: 100%;
        margin-left: 0;
    }
    .btn-consent {
        flex: 1;
    }
}

/* ---- Legal / content pages (privacy.html, terms.html) ---- */
.legal-content {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 2.5rem;
    box-shadow: var(--shadow);
    max-width: 820px;
    width: 100%;
    margin: 0 auto;
}
.legal-content h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.legal-content .updated {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}
.legal-content h2 {
    font-size: 1.25rem;
    margin: 1.75rem 0 0.5rem;
}
.legal-content p,
.legal-content li {
    margin-bottom: 0.75rem;
    color: var(--text-main);
}
.legal-content ul {
    padding-left: 1.25rem;
}
.legal-content a {
    color: var(--primary);
}
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.back-link:hover {
    text-decoration: underline;
}

/* ---- SEO content + FAQ (index.html) ---- */
.seo-content {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}
.seo-content h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}
.seo-content #faq-heading {
    margin-top: 2rem;
}
.seo-content h3 {
    font-size: 1.1rem;
    margin: 1.25rem 0 0.5rem;
}
.seo-content p,
.seo-content li {
    color: var(--text-main);
    margin-bottom: 0.6rem;
}
.seo-content ul {
    padding-left: 1.25rem;
}
.seo-content code {
    background: rgba(26, 191, 255, 0.15);
    color: var(--text-main);
    padding: 0 0.3em;
    border-radius: 4px;
    font-size: 0.9em;
}
.faq details {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.6rem;
    background: var(--surface);
}
.faq summary {
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
}
.faq details[open] summary {
    margin-bottom: 0.5rem;
    color: var(--primary);
}
.faq p {
    margin: 0;
    color: var(--text-muted);
}

