:root {
    /* Base font size multiplier - adjust this to scale all fonts */
    --font-scale: 1.5;

    /* Font sizes */
    --font-xs: calc(0.85rem * var(--font-scale));
    --font-sm: calc(1rem * var(--font-scale));
    --font-base: calc(1.1rem * var(--font-scale));
    --font-md: calc(1.2rem * var(--font-scale));
    --font-lg: calc(1.4rem * var(--font-scale));
    --font-xl: calc(2.5rem * var(--font-scale));
    --font-2xl: calc(3rem * var(--font-scale));
}

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

body {
    font-family: 'Courier New', monospace;
    background: #1a1a1a;
    min-height: 100vh;
    padding: 20px;
    color: #ffffff;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1,h2,h3,h4,h5,h6 { font-weight: normal; }

h1 {
    font-size: var(--font-2xl);
    color: #ffffff;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    display: flex;
    align-items: center;
    gap: 0;
}

.logo-inline {
    width: var(--font-2xl);
    height: var(--font-2xl);
    margin: 0 -.1em;
    display: inline-block;
    vertical-align: baseline;
}

h2, h3 {
    font-family: 'Courier New', monospace;
}

.subtitle {
    font-size: var(--font-md);
    color: #999;
    text-align: center;
}

.nav-links {
    margin-top: 20px;
}

.nav-links a {
    color: #ffffff;
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid #444;
    background: #222;
    transition: all 0.2s ease;
    font-size: var(--font-base);
    display: inline-block;
}

.nav-links a:hover {
    background: #333;
    border-color: #666;
}

.search-section {
    position: sticky;
    top: 0;
    background: #1a1a1a;
    padding: 20px 0 20px;
    margin-bottom: 20px;
    z-index: 100;
    border-bottom: 1px solid #333;
}

form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    gap: 12px;
    position: relative;
}

.input-wrapper {
    flex: 1;
    position: relative;
}

.autocomplete-hint {
    position: absolute;
    top: 1px;
    left: 1px;
    padding: 14px 18px;
    font-size: var(--font-md);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: #555;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1;
}

.autocomplete-dropdown {
    background: #222;
    border: 1px solid #444;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 18px;
    cursor: pointer;
    color: #ccc;
    border-bottom: 1px solid #333;
    font-size: var(--font-base);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #333;
    color: #fff;
}

input[type="text"] {
    width: 100%;
    padding: 14px 18px;
    font-size: var(--font-md);
    border: 1px solid #444;
    background: transparent;
    color: #ffffff;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    outline: none;
    position: relative;
    z-index: 2;
}

.input-wrapper {
    background: #1a1a1a;
}

input[type="text"]::placeholder {
    color: #666;
}

input[type="text"]:focus {
    border-color: #666;
    background: transparent;
}

button {
    padding: 14px 28px;
    font-size: var(--font-md);
    font-weight: 600;
    background: #ffffff;
    color: #000;
    border: 1px solid #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

button:hover {
    background: #000;
    color: #ffffff;
}

.legend {
    margin-top: 30px;
    margin-bottom: 30px;
    padding: 20px 0;
    font-size: var(--font-sm);
    color: #999;
}

.legend-title {
    font-weight: 100;
    margin-bottom: 10px;
    color: #fff;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border: 1px solid #666;
}

.results {
    padding: 0;
    display: none;
}

.results.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.rhyme-section {
    margin-top: 30px;
}

.rhyme-section:last-child {
    margin-bottom: 0;
}

.rhyme-section h3 {
    color: #ffffff;
    font-size: var(--font-lg);
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

.two-column-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

#result {
    font-size: var(--font-base);
    word-wrap: break-word;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.rhyme-word {
    padding: 10px 16px;
    border: 1px solid;
    border-bottom-width: 1px;
    transition: all 0.2s ease;
    font-weight: 400;
    font-size: var(--font-base);
    flex: 1 1 auto;
    text-align: center;
    min-width: fit-content;
}

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

/* Popularity color tiers - subtle grayscale */
.popularity-very-high {
    background: #ffffff;
    color: #000;
    border-color: #ffffff;
    font-weight: 600;
}

.popularity-high {
    background: #e0e0e0;
    color: #000;
    border-color: #e0e0e0;
    font-weight: 500;
}

.popularity-medium {
    background: #999;
    color: #fff;
    border-color: #999;
}

.popularity-low {
    background: #666;
    color: #fff;
    border-color: #666;
}

.popularity-very-low {
    background: transparent;
    color: #ccc;
    border-color: #666;
}

.popularity-rare {
    background: transparent;
    color: #888;
    border-color: #444;
}

.empty-state {
    text-align: center;
    color: #999;
    font-style: italic;
}

.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #333;
    border-top: 1px solid #444;
    padding: 15px 20px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.5);
}

.install-prompt.show {
    display: flex;
}

.install-prompt-text {
    flex: 1;
    font-size: var(--font-base);
    color: #ccc;
}

.install-prompt-buttons {
    display: flex;
    gap: 10px;
}

.install-prompt button {
    padding: 10px 20px;
    font-size: var(--font-sm);
    white-space: nowrap;
}

.install-prompt .dismiss {
    background: transparent;
    border: 1px solid #666;
    color: #999;
}

.install-prompt .dismiss:hover {
    background: #444;
    color: #fff;
}

form label {
    margin: 0;
}

@media (max-width: 768px) {
    h1 {
        font-size: var(--font-xl);
    }

    .results {
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

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

    /* On mobile, show near rhymes before front rhymes */
    .near-rhymes-section {
        order: -1;
    }

    .install-prompt {
        flex-direction: column;
        align-items: stretch;
    }

    .install-prompt-buttons {
        flex-direction: column;
    }

    .install-prompt button {
        width: 100%;
    }

    /* On mobile, hide autocomplete - keyboard has its own autocomplete */
    .autocomplete-dropdown {
        display: none !important;
    }

    .autocomplete-hint {
        display: none;
    }
}