:root {
    --bg: #0b0b0f;
    --panel: #121218;
    --card: #16161d;
    --accent: #7c5cff;
    --accent-secondary: #00d4ff;
    --border: #23232c;
    --text: #ffffff;
    --text-dim: #888891;
    --radius: 12px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Home Page Header & Hero */
header {
    padding: 100px 20px 60px;
    text-align: center;
    background: radial-gradient(circle at top, #1a1a24 0%, #0b0b0f 70%);
}

.logo {
    font-size: 42px;
    font-weight: 900;
    text-decoration: none;
    color: #fff;
    letter-spacing: -2px;
    display: inline-block;
    margin-bottom: 20px;
}

.tagline {
    color: var(--text-dim);
    font-size: 20px;
    margin-bottom: 40px;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 720px;
    margin: 0 auto 28px auto;
}

.fontastic-search {
    display: flex;
    align-items: center;
    background: #16161d;
    border: 1px solid #2a2a33;
    border-radius: 999px;
    height: 52px;
    padding: 0 20px;
    width: 100%;
    transition: all 0.2s ease;
}

.fontastic-search:hover,
.fontastic-search:focus-within {
    border-color: #7c5cff;
}

.fontastic-search input {
    background: transparent;
    border: none;
    outline: none;
    width: 100%;
    color: white;
    font-size: 16px;
    font-family: 'Inter', -apple-system, sans-serif;
}

.fontastic-search .search-icon {
    opacity: 0.7;
    margin-right: 10px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.fontastic-search:hover .search-icon,
.fontastic-search:focus-within .search-icon {
    color: #7c5cff;
    opacity: 1;
}

/* Font Grid */
#font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
    padding-top: 60px;
    padding-bottom: 60px;
}

.font-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    text-align: center;
}

.font-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: #1c1c24;
}


.font-preview {
    font-size: 28px;
    margin-bottom: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: #fff;
    font-weight: 500;
}

.font-name {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-dim);
    font-weight: 600;
}

/* Editor Page Layout */
.editor-page .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: #121218;
    border-bottom: 1px solid var(--border);
}

.editor-top-bar {
    background: #121218;
    border-bottom: 1px solid var(--border);
    padding: 12px 40px;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.top-bar-actions {
    display: flex;
    gap: 12px;
}

.editor-container {
    display: flex;
    height: calc(100vh - 146px);
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
    background: #121218;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar.left-panel {
    border-right: 1px solid var(--border);
}

.sidebar.right-panel {
    border-left: 1px solid var(--border);
}

.canvas-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0b0b0f;
    overflow: hidden;
    padding: 40px;
}

.canvas-area.bg-checkerboard {
    background: repeating-conic-gradient(#1c1c24 0% 25%, #121218 0% 50%) 50% / 40px 40px;
}

.canvas-area.bg-white {
    background: #ffffff;
}

.canvas-area.bg-black {
    background: #000000;
}

#editorCanvas {
    max-width: 100%;
    max-height: 100%;
    /* Keep canvas literally transparent so it exports properly */
    background: transparent;
    border-radius: 8px;
}

/* UI Elements */
.control-group {
    background: #1b1b24;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 8px;
}

.control-group h3 {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.field {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.field:last-child {
    margin-bottom: 0;
}

.field label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 600;
}

.checkbox-wrapper {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.checkbox-wrapper label {
    margin-bottom: 0;
    font-size: 13px;
    text-transform: none;
    letter-spacing: normal;
    color: #fff;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

input[type="text"],
textarea,
select.modern-select,
input[type="range"],
input[type="color"] {
    width: 100%;
}

textarea {
    background: #121218;
    border: 1px solid #2c2c36;
    padding: 12px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--accent);
}

select.modern-select {
    height: 40px;
    background: #121218;
    border: 1px solid #2c2c36;
    padding: 0 12px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    appearance: none;
    cursor: pointer;
}

select.modern-select[size] {
    height: auto;
    padding: 8px;
    border-radius: 8px;
    overflow-y: auto;
}

select.modern-select[size] option {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 2px;
    cursor: pointer;
}

select.modern-select[size] option:hover {
    background: #1b1b24;
}

select.modern-select[size] option:checked {
    background: linear-gradient(90deg, #7c5cff, #00d4ff);
    color: #fff;
    font-weight: 600;
}

select.modern-select:focus {
    outline: none;
    border-color: var(--accent);
}

.hint {
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
}

input[type="text"] {
    height: 40px;
    background: #121218;
    border: 1px solid #2c2c36;
    padding: 0 12px;
    border-radius: 8px;
    color: #ffffff;
    font-size: 15px;
    transition: var(--transition);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

/* Custom Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    height: 40px;
}

input[type="range"]:focus {
    outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: #2c2c36;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: #7c5cff;
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(124, 92, 255, 0.4);
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Custom Color Picker */
input[type="color"] {
    -webkit-appearance: none;
    appearance: none;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid #2c2c36;
    border-radius: 8px;
}

/* Download Button */
.premium-btn {
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(90deg, #7c5cff, #00d4ff);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    margin-top: auto;
}

.premium-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 15px rgba(124, 92, 255, 0.4);
}

.premium-btn:active {
    transform: scale(0.98);
}

/* Info Pages (Privacy, Terms, About, Guides) */
.info-page {
    background: #0b0b0f;
    color: var(--text);
    line-height: 1.6;
}

.info-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px;
}

.info-content-panel {
    background: #121218;
    border: 1px solid #23232c;
    border-radius: 12px;
    padding: 40px;
}

.info-content-panel h1 {
    font-size: 36px;
    margin-bottom: 24px;
    color: #ffffff;
    font-weight: 700;
}

.info-content-panel h2 {
    font-size: 24px;
    margin-top: 40px;
    margin-bottom: 16px;
    color: #ffffff;
    font-weight: 600;
}

.info-content-panel h3 {
    font-size: 20px;
    margin-top: 24px;
    margin-bottom: 12px;
    color: #eaeaea;
    font-weight: 600;
}

.info-content-panel p {
    margin-bottom: 16px;
    color: #bbbbbb;
    font-size: 16px;
}

.info-content-panel ul,
.info-content-panel ol {
    margin-bottom: 24px;
    padding-left: 20px;
    color: #bbbbbb;
}

.info-content-panel li {
    margin-bottom: 8px;
}

.info-content-panel a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

.info-content-panel a:hover {
    color: var(--accent-secondary);
}

/* Contact Page specific */
.contact-header {
    text-align: center;
    margin-bottom: 50px;
}

.contact-header h1 {
    font-size: 40px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.contact-header p {
    font-size: 18px;
    color: #bbbbbb;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

.contact-card {
    background: #16161d;
    border: 1px solid #23232c;
    border-radius: 12px;
    padding: 32px;
    transition: var(--transition);
}

.contact-card:hover {
    border-color: #7c5cff;
}

.contact-card h2 {
    font-size: 22px;
    color: #ffffff;
    margin-bottom: 16px;
    font-weight: 600;
}

.contact-card p,
.contact-card .email-link {
    color: #bbbbbb;
    font-size: 16px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.contact-card .email-link {
    display: inline-block;
    color: #7c5cff;
    font-weight: 600;
    text-decoration: none;
    font-size: 18px;
}

.contact-card .email-link:hover {
    color: #00d4ff;
}

.contact-card .note {
    font-size: 14px;
    color: #888888;
    margin-top: 10px;
    margin-bottom: 0;
}

.contact-form .form-group {
    margin-bottom: 20px;
}

.contact-form label {
    display: block;
    color: #eaeaea;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    background: #121218;
    border: 1px solid #23232c;
    border-radius: 8px;
    color: #ffffff;
    padding: 14px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: #7c5cff;
    box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.2);
}

.form-message {
    margin-top: 20px;
    padding: 16px;
    background: rgba(124, 92, 255, 0.1);
    border: 1px solid rgba(124, 92, 255, 0.3);
    border-radius: 8px;
    color: #00d4ff;
    font-weight: 500;
    display: none;
    text-align: center;
}

footer {
    padding: 60px 40px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-links {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--accent);
}

/* Responsive */
@media (min-width: 1025px) {
    #font-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 1024px) {
    #font-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    #font-grid {
        grid-template-columns: repeat(2, 1fr);
        padding-left: 20px;
        padding-right: 20px;
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .editor-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}