/* Design direction: dark creator-tool (Figma/CapCut meets pop culture) · palette: #0F0F0F surface, #1A1A1A card, #F5C518 accent (movie-poster yellow), #E8E8E8 text · type: Inter + JetBrains Mono */

/* ===== Reset ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===== Tokens ===== */
:root {
    --bg:          #0F0F0F;
    --surface:     #1A1A1A;
    --surface-2:   #222222;
    --border:      #2A2A2A;
    --border-2:    #333333;
    --text:        #E8E8E8;
    --text-2:      #888888;
    --text-3:      #555555;
    --accent:      #F5C518;
    --accent-dim:  rgba(245, 197, 24, 0.12);
    --accent-glow: rgba(245, 197, 24, 0.20);
    --danger:      #E05252;
    --success:     #4CAF7D;

    --radius-sm:   4px;
    --radius:      8px;
    --radius-lg:   12px;
    --radius-xl:   16px;

    /* 8pt grid */
    --sp-1: 8px;
    --sp-2: 16px;
    --sp-3: 24px;
    --sp-4: 32px;
    --sp-5: 40px;
    --sp-6: 48px;

    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;

    --nav-h: 56px;
    --transition: 150ms ease;
}

/* ===== Base ===== */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ===== Nav ===== */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: rgba(15, 15, 15, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    padding: 0 var(--sp-3);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9375rem;
    flex-shrink: 0;
    transition: color var(--transition);
}

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

.brand svg {
    color: var(--accent);
}

.brand-name {
    letter-spacing: -0.01em;
}

.brand-dot {
    color: var(--accent);
}

.nav-meta {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.nav-breadcrumb {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-2);
}

@media (min-width: 600px) {
    .nav-breadcrumb {
        display: flex;
    }
}

.nav-breadcrumb .slash {
    color: var(--text-3);
}

.nav-breadcrumb .current {
    color: var(--text);
    font-weight: 500;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-2);
    border: none;
    background: none;
    cursor: pointer;
    transition: color var(--transition), background var(--transition);
    white-space: nowrap;
    font-family: var(--font);
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-2);
}

.nav-link-accent {
    color: var(--accent);
    border: 1px solid rgba(245, 197, 24, 0.3);
    background: var(--accent-dim);
}

.nav-link-accent:hover {
    color: var(--accent);
    background: var(--accent-glow);
    border-color: rgba(245, 197, 24, 0.5);
}

/* ===== Main ===== */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--sp-3) var(--sp-6);
}

/* ===== Hero ===== */
.hero {
    padding: var(--sp-6) 0 var(--sp-5);
    max-width: 620px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-2);
    margin-bottom: var(--sp-2);
}

.eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: var(--text);
    margin-bottom: var(--sp-2);
}

.hero-title-accent {
    color: var(--accent);
}

.hero-sub {
    font-size: 1.0625rem;
    color: var(--text-2);
    line-height: 1.6;
    margin-bottom: var(--sp-3);
    max-width: 520px;
}

.trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-1);
}

.pill {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border-2);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-3);
    letter-spacing: 0.01em;
}

/* ===== Empty state ===== */
.empty-stage {
    margin-bottom: var(--sp-5);
}

.drop-zone {
    border: 1.5px dashed var(--border-2);
    border-radius: var(--radius-xl);
    padding: var(--sp-6) var(--sp-4);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    background: var(--surface);
    outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.drop-zone.dragging {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.drop-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-3);
    color: var(--text-2);
}

.drop-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--sp-1);
}

.drop-sub {
    font-size: 0.875rem;
    color: var(--text-2);
    max-width: 400px;
    margin: 0 auto var(--sp-3);
    line-height: 1.5;
}

/* ===== Workspace ===== */
.work-grid {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
}

@media (min-width: 900px) {
    .work-grid {
        flex-direction: row;
        align-items: flex-start;
    }

    .controls-col {
        flex: 0 0 300px;
        position: sticky;
        top: calc(var(--nav-h) + var(--sp-2));
    }

    .preview-col {
        flex: 1;
        min-width: 0;
    }
}

.controls-col {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

/* ===== Cards ===== */
.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-2) var(--sp-2);
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-1);
    margin-bottom: 0;
}

.label-eyebrow {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 4px;
}

.card-filename {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
    font-family: var(--mono);
}

.card-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: var(--sp-2);
    padding-bottom: var(--sp-1);
    border-bottom: 1px solid var(--border);
}

/* ===== Form fields ===== */
.field-group {
    margin-bottom: var(--sp-2);
}

.field-group:last-child {
    margin-bottom: 0;
}

.field-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 6px;
}

.field-value {
    font-size: 0.8125rem;
    color: var(--accent);
}

.mono {
    font-family: var(--mono);
}

.field-input,
.field-select {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.field-input::placeholder {
    color: var(--text-3);
}

.field-input:focus,
.field-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.field-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.field-row .field-label {
    margin-bottom: 0;
}

.color-swatch {
    width: 40px;
    height: 32px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
    padding: 0;
    overflow: hidden;
    transition: border-color var(--transition);
    -webkit-appearance: none;
    appearance: none;
}

.color-swatch:hover {
    border-color: var(--accent);
}

.color-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-swatch::-webkit-color-swatch {
    border: none;
    border-radius: calc(var(--radius-sm) - 1px);
}

/* ===== Slider ===== */
.slider-wrap {
    position: relative;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-2);
    outline: none;
    cursor: pointer;
    transition: background var(--transition);
}

.slider:hover {
    background: var(--border);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    cursor: pointer;
    box-shadow: 0 0 0 1px var(--accent);
    transition: transform var(--transition), box-shadow var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    cursor: pointer;
    box-shadow: 0 0 0 1px var(--accent);
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    color: #000;
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    letter-spacing: 0.01em;
    transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #ffd13a;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

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

.btn-primary:disabled {
    background: var(--border-2);
    color: var(--text-3);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    background: transparent;
    color: var(--text-2);
    font-family: var(--font);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition);
    white-space: nowrap;
}

.btn-ghost:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface-2);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8125rem;
}

.btn-full {
    width: 100%;
}

.actions-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-1);
}

.drop-btn {
    pointer-events: none;
}

/* ===== Preview ===== */
.preview-card {
    padding: var(--sp-2);
}

.preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-2);
}

.preview-dims {
    font-size: 0.8125rem;
    color: var(--text-3);
}

.preview-stage {
    background: #111;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.meme-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 280px;
}

#memeCanvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== Loading ===== */
.loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sp-1);
    background: rgba(15, 15, 15, 0.8);
    color: var(--text-2);
    font-size: 0.875rem;
    z-index: 10;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.hidden {
    display: none !important;
}

/* ===== Info strip ===== */
.info-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sp-2);
    margin-bottom: var(--sp-6);
    padding-top: var(--sp-2);
    border-top: 1px solid var(--border);
}

.info-strip article {
    padding: var(--sp-3);
}

.info-num {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: var(--sp-1);
    letter-spacing: 0.04em;
}

.info-strip h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.info-strip p {
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.55;
}

/* ===== Footer ===== */
.site-foot {
    border-top: 1px solid var(--border);
    padding: var(--sp-4) var(--sp-3);
}

.foot-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

@media (min-width: 640px) {
    .foot-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}

.foot-brand .brand-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
}

.foot-note {
    font-size: 0.8125rem;
    color: var(--text-2);
    margin-top: 4px;
}

.foot-note a {
    color: var(--accent);
    transition: opacity var(--transition);
}

.foot-note a:hover {
    opacity: 0.8;
}

.foot-legal {
    max-width: 380px;
}

.foot-legal p {
    font-size: 0.75rem;
    color: var(--text-3);
    line-height: 1.55;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: var(--sp-3);
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    color: var(--text);
    font-size: 0.875rem;
    padding: 10px 16px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms, transform 200ms;
    z-index: 200;
    max-width: calc(100vw - 32px);
    white-space: nowrap;
}

.toast svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.danger {
    border-color: rgba(224, 82, 82, 0.4);
    color: var(--danger);
}

.toast.success {
    border-color: rgba(76, 175, 125, 0.4);
    color: var(--success);
}

/* ===== FAB ===== */
.support-fab {
    position: fixed;
    bottom: var(--sp-3);
    right: var(--sp-3);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    z-index: 150;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: transform 180ms ease, box-shadow 180ms ease;
    color: #000;
    padding: 0;
}

.support-fab:hover {
    transform: scale(1.05) rotate(-3deg);
    box-shadow: 0 8px 28px var(--accent-glow);
}

.support-fab-arc {
    width: 64px;
    height: 32px;
    position: absolute;
    top: 0;
    left: 0;
}

.support-fab-text {
    font-size: 8px;
    font-family: var(--mono);
    font-weight: 600;
    fill: #000;
    letter-spacing: 0.04em;
}

.support-fab-icon {
    width: 22px;
    height: 22px;
    position: relative;
    z-index: 1;
    margin-top: 10px;
}

/* ===== Support Dialog ===== */
.support-dialog {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: var(--sp-2);
}

.support-dialog.open {
    display: flex;
}

.support-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    cursor: pointer;
}

.support-panel {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    z-index: 1;
}

.support-close {
    position: absolute;
    top: var(--sp-2);
    right: var(--sp-2);
    width: 32px;
    height: 32px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition), border-color var(--transition);
    z-index: 2;
}

.support-close svg {
    width: 14px;
    height: 14px;
}

.support-close:hover {
    color: var(--text);
    border-color: var(--border);
}

.support-body {
    padding: var(--sp-4) var(--sp-3) var(--sp-3);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--sp-2);
}

.support-badge {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--accent-dim);
    border: 1px solid rgba(245, 197, 24, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.support-badge svg {
    width: 24px;
    height: 24px;
}

.support-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
    margin: 0;
}

.support-sub {
    font-size: 0.9rem;
    color: var(--text-2);
    line-height: 1.55;
    max-width: 320px;
    margin: 0;
}

.support-amounts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-1);
    width: 100%;
}

.support-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--sp-2) var(--sp-1);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    background: var(--surface-2);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition), transform var(--transition);
    text-decoration: none;
}

.support-amount:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: translateY(-2px);
}

.support-amount-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.support-amount-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.01em;
}

.support-qr-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-1);
}

.support-qr-label {
    font-size: 0.8125rem;
    color: var(--text-3);
}

.support-qr {
    width: 160px;
    height: 160px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-2);
    background: #fff;
}

.support-qr img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.support-copy {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-family: var(--mono);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
    max-width: 100%;
}

.support-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.support-copy.copied {
    border-color: var(--success);
    color: var(--success);
}

.support-copy svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.support-hint {
    font-size: 0.75rem;
    color: var(--text-3);
}

.support-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-3);
    padding-top: var(--sp-1);
    border-top: 1px solid var(--border);
    width: 100%;
    justify-content: center;
}

.support-foot svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
}

.support-foot strong {
    color: var(--text);
    font-weight: 600;
}

/* ===== Mobile ===== */
@media (max-width: 599px) {
    main {
        padding: 0 var(--sp-2) var(--sp-5);
    }

    .hero {
        padding: var(--sp-4) 0 var(--sp-4);
    }

    .support-fab {
        bottom: var(--sp-2);
        right: var(--sp-2);
    }

    .toast {
        bottom: var(--sp-2);
    }
}
