:root {
    --bg: #f7efe5;
    --bg-accent: #efe0d1;
    --panel: rgba(255, 250, 245, 0.9);
    --panel-strong: #fff8f1;
    --border: rgba(109, 74, 50, 0.16);
    --text: #26160f;
    --muted: #6a5648;
    --accent: #c65b30;
    --accent-dark: #8e2f12;
    --shadow: 0 18px 48px rgba(87, 45, 19, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 196, 146, 0.45), transparent 30%),
        radial-gradient(circle at top right, rgba(250, 146, 126, 0.22), transparent 28%),
        linear-gradient(180deg, #fbf4eb 0%, var(--bg) 46%, var(--bg-accent) 100%);
    padding: 28px 20px 40px;
}

body.halloween {
    --bg: #0f1218;
    --bg-accent: #18111f;
    --panel: rgba(23, 26, 35, 0.92);
    --panel-strong: #1b1f29;
    --border: rgba(255, 128, 42, 0.2);
    --text: #f7eee9;
    --muted: #baa8a0;
    --accent: #ff7c2f;
    --accent-dark: #bf4207;
    --shadow: 0 24px 54px rgba(0, 0, 0, 0.36);
    background:
        radial-gradient(circle at top left, rgba(255, 122, 43, 0.15), transparent 28%),
        radial-gradient(circle at top right, rgba(138, 74, 255, 0.12), transparent 30%),
        linear-gradient(180deg, #13151d 0%, #0c0e14 55%, #17101b 100%);
}

a {
    color: inherit;
}

.hero,
.app-shell {
    width: min(1240px, 100%);
    margin: 0 auto;
}

.hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 24px;
}

.hero-copy {
    max-width: 760px;
}

.eyebrow {
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--accent);
}

h1 {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    line-height: 0.95;
}

.hero-text {
    margin: 14px 0 0;
    max-width: 58ch;
    font-size: 1.03rem;
    line-height: 1.6;
    color: var(--muted);
}

.toggle-bar {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    font-size: 0.95rem;
    white-space: nowrap;
}

#halloween-toggle {
    appearance: none;
    position: relative;
    width: 50px;
    height: 30px;
    margin: 0;
    background: rgba(109, 74, 50, 0.2);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease;
}

#halloween-toggle::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

#halloween-toggle:checked {
    background: var(--accent);
}

#halloween-toggle:checked::before {
    transform: translateX(20px);
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.status-card,
.panel {
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.status-card {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.status-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 800;
    color: var(--accent);
}

.status-card strong {
    font-size: 1.12rem;
}

.status-card small {
    color: var(--muted);
    line-height: 1.45;
}

.container {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 18px;
    align-items: start;
}

.panel {
    padding: 20px;
}

.panel-heading {
    margin-bottom: 18px;
}

.panel-heading h2 {
    margin: 0 0 6px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.35rem;
}

.panel-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

.panel-controls {
    background: var(--panel-strong);
}

.dropper {
    width: 100%;
    min-height: 360px;
    border: 2px dashed var(--border);
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.14)),
        radial-gradient(circle at top, rgba(255, 255, 255, 0.6), transparent 40%);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.output-dropper {
    cursor: default;
}

.dropper.active {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.dropper p {
    margin: 0;
    padding: 0 24px;
    text-align: center;
    color: var(--muted);
    line-height: 1.5;
}

.dropper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#paste-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1;
}

#paste-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--text);
}

.key-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: end;
}

.key-card {
    margin-top: 4px;
    margin-bottom: 14px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(198, 91, 48, 0.28);
    background:
        linear-gradient(180deg, rgba(198, 91, 48, 0.08), rgba(198, 91, 48, 0.03)),
        rgba(255, 255, 255, 0.52);
}

.key-card-copy {
    margin-bottom: 12px;
}

.key-card-copy h3 {
    margin: 6px 0 0;
    font-size: 1.08rem;
    font-family: "Space Grotesk", sans-serif;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-wide {
    min-width: 0;
}

label {
    font-weight: 700;
    font-size: 0.92rem;
}

select,
input[type="password"],
input[type="text"] {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--border);
    padding: 13px 14px;
    font: inherit;
    color: var(--text);
    background: rgba(255, 255, 255, 0.72);
}

body.halloween select,
body.halloween input[type="password"],
body.halloween input[type="text"] {
    background: rgba(255, 255, 255, 0.04);
}

.helper-copy {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

#generate-btn,
.secondary-btn,
.ghost-btn,
.download-link {
    border: none;
    border-radius: 14px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

#generate-btn {
    width: 100%;
    margin-top: 18px;
    padding: 15px 18px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 14px 24px rgba(198, 91, 48, 0.26);
}

.secondary-btn,
.ghost-btn {
    padding: 13px 16px;
}

.secondary-btn {
    background: rgba(198, 91, 48, 0.12);
    color: var(--accent-dark);
}

.ghost-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}

#generate-btn:hover:not(:disabled),
.secondary-btn:hover,
.ghost-btn:hover,
.download-link:hover {
    transform: translateY(-1px);
}

#generate-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.download-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-top: 14px;
    padding: 13px 16px;
    background: rgba(198, 91, 48, 0.1);
    color: var(--accent-dark);
    text-decoration: none;
}

.hidden {
    display: none !important;
}

#loader {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: 8px solid rgba(0, 0, 0, 0.08);
    border-top-color: var(--accent);
    animation: spin 1.1s linear infinite;
}

#fullscreen-view {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.84);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#fullscreen-image {
    max-width: 92vw;
    max-height: 92vh;
    object-fit: contain;
}

#close-fullscreen {
    position: absolute;
    top: 20px;
    right: 28px;
    font-size: 2.6rem;
    color: #fff;
    cursor: pointer;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 1080px) {
    .container {
        grid-template-columns: 1fr;
    }

    .status-strip {
        grid-template-columns: 1fr;
    }

    .hero {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 640px) {
    body {
        padding: 18px 14px 28px;
    }

    .panel,
    .status-card {
        border-radius: 20px;
    }

    .dropper {
        min-height: 300px;
    }

    .key-row,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .secondary-btn,
    .ghost-btn {
        width: 100%;
    }
}
