:root {
    --brand-blue: #0071e3;
    --neutral-light-bg: #f5f5f7;
    --card-surface-bg: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-neutral: #d2d2d7;
    --alert-red: #ff3b30;
    --star-gold: #ff9f0a;
}

body {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--neutral-light-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;

    font-size: 16px;
    line-height: 1.45;
    letter-spacing: -0.01em;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Conditional: Only applied by modern browsers that support SF Pro */
html.applesf body {
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.app-container {
    width: 100%;
    max-width: 680px;
    background: var(--card-surface-bg);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.hidden {
    display: none !important;
}

/* Header */
.studio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-neutral);
    padding-bottom: 16px;
    margin-bottom: 24px;
}
.user-greeting {
    font-weight: 600;
    font-size: 14px;
}
.quota-badge {
    background: var(--neutral-light-bg);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.quota-badge .auth-trigger-btn {
    margin-left: 8px;
    padding: 2px 10px;
    font-size: 12px;
}
.auth-trigger-btn {
    background: none;
    border: 1px solid var(--brand-blue);
    color: var(--brand-blue);
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.auth-trigger-btn:hover {
    background: var(--brand-blue);
    color: white;
}

h1 {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    text-align: center;
}
.subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* Prefix menu */
.menu-container {
    margin-bottom: 20px;
}
.menu-toggle-btn {
    width: 100%;
    background: var(--neutral-light-bg);
    border: 1px solid var(--border-neutral);
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--text-primary);
}
.menu-arrow {
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}
.menu-arrow.open {
    transform: rotate(180deg);
}
.prefix-menu-drawer {
    background: #fafafa;
    border: 1px solid var(--border-neutral);
    border-top: none;
    padding: 20px;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    margin-top: -4px;
}
.section-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.prefix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
    gap: 8px;
}
.letter-pill {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-surface-bg);
    border: 1px solid var(--border-neutral);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}
.letter-pill:hover {
    background: var(--neutral-light-bg);
}
.letter-pill.selected {
    background: var(--brand-blue);
    color: white;
    border-color: var(--brand-blue);
    font-weight: 600;
}

/* Length filter */
.length-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}
.length-label {
    font-size: 13px;
    color: var(--text-secondary);
}
.length-input {
    width: 72px;
    height: 40px;
    padding: 0 10px;
    font-size: 15px;
    background: var(--neutral-light-bg);
    border: 1px solid var(--border-neutral);
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
}
.length-input:focus {
    border-color: var(--brand-blue);
}

/* Search bar */
.search-box-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 32px;
}
.search-input {
    width: 100%;
    height: 52px;
    padding: 0 120px 0 16px;
    font-size: 16px;
    background: var(--neutral-light-bg);
    border: 1px solid transparent;
    border-radius: 12px;
    outline: none;
    box-sizing: border-box;
}
.search-input:focus {
    background: #ffffff;
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}
.search-button {
    position: absolute;
    right: 8px;
    height: 36px;
    padding: 0 20px;
    background: var(--brand-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.search-button:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Shared button */
.primary-btn {
    height: 44px;
    background: var(--brand-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}
.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Results */
.results-panel {
    border-top: 1px solid var(--border-neutral);
    padding-top: 24px;
    display: none;
    position: relative;
}
.results-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.results-title {
    font-size: 17px;
    font-weight: 600;
}
.results-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.results-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.data-row {
    background: var(--neutral-light-bg);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

/* Upsell: inline card by default, overlay when the first results are covered */
.results-body {
    position: relative;
}
.results-body.covered {
    min-height: 220px;
}
.results-body.covered .results-content-wrapper {
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
}
.upsell-container {
    margin-top: 12px;
    padding: 24px 20px;
    text-align: center;
    background: var(--neutral-light-bg);
    border-radius: 12px;
}
.results-body.covered .upsell-container {
    position: absolute;
    inset: 0;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.65);
    border-radius: 10px;
}
.upsell-content h3 {
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 8px 0;
}
.upsell-content p {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 440px;
    margin: 0 auto 20px auto;
    line-height: 1.4;
}
.upsell-btn {
    width: auto;
    padding: 0 32px;
}

/* Next page button */
.load-more-btn {
    display: block;
    width: 100%;
    height: 44px;
    margin-top: 16px;
    background: none;
    border: 1px solid var(--brand-blue);
    color: var(--brand-blue);
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.load-more-btn:hover:not(:disabled) {
    background: var(--brand-blue);
    color: white;
}
.load-more-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

/* Star button on a paid result row */
.star-btn {
    background: none;
    border: none;
    padding: 0 4px;
    font-size: 18px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
}
.star-btn[aria-pressed="true"] {
    color: var(--star-gold);
}
.star-btn:hover:not(:disabled) {
    color: var(--star-gold);
}
.star-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}
.star-btn:focus-visible,
.starred-close:focus-visible,
.starred-remove:focus-visible {
    outline: 2px solid var(--brand-blue);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Reminder shown under paid results */
.results-notice {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--neutral-light-bg);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 12px;
}

/* Starred domains sidebar */
.starred-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 100vw);
    box-sizing: border-box;
    padding: 24px 20px;
    overflow-y: auto;
    background: var(--card-surface-bg);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 100;
}
.starred-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.starred-header h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0;
}
.starred-close,
.starred-remove {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
}
.starred-close:hover,
.starred-remove:hover {
    color: var(--text-primary);
}
.starred-empty {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}
.starred-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.starred-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--neutral-light-bg);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    word-break: break-all;
}
