:root {
    --bg: #0d0d14;
    --surface: #14142a;
    --elevated: #1e1e38;
    --border: #2a2a48;
    --accent: #6c63ff;
    --accent-hover: #5b53e8;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #4e5a70;
    --radius: 12px;
    --shadow: 0 4px 20px rgba(0,0,0,0.5);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    flex: 1;
    width: 100%;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #f1f5f9 30%, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Document Pages (Privacy/Terms) */
.doc-page {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
}

.doc-page h1 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.doc-page .meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    display: block;
}

.doc-page h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 1.5rem 0 1rem;
}

.doc-page p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.doc-page ul {
    color: var(--text-secondary);
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.doc-page li {
    margin-bottom: 0.5rem;
}

/* Upload Area */
.upload-area {
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.upload-area:hover, .upload-area.dragover {
    border-color: var(--accent);
    background: var(--elevated);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-content svg {
    color: var(--text-muted);
}

.primary-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover {
    background: var(--accent-hover);
}

.image-preview {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    display: block;
    margin: 0 auto;
    box-shadow: var(--shadow);
}

/* Results */
.results-section {
    margin-top: 3rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

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

#colorCount {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.color-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.color-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.color-swatch {
    height: 80px;
    width: 100%;
}

.color-details {
    padding: 10px;
    text-align: center;
}

.color-hex {
    font-family: monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.color-freq {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--accent);
}

.footer-links {
    display: flex;
    gap: 1rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9999;
    box-shadow: var(--shadow);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Info Section */
.info-section {
    margin-top: 4rem;
}
.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
}
.info-card h2 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}
.info-card h3 {
    color: var(--text-primary);
    margin: 1.5rem 0 0.5rem;
    font-size: 1.1rem;
}
.info-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}
.info-card a {
    color: var(--accent);
    text-decoration: none;
}
.info-card a:hover {
    text-decoration: underline;
}
.shortcuts-list {
    list-style: none;
    margin-top: 0.5rem;
}
.shortcuts-list li {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
kbd {
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    box-shadow: 0 2px 0 var(--border);
}
