:root {
    --bg-main: #f4e4cf;      /* Sand */
    --bg-box: #fff7ea;       /* Light Sand */
    --bg-content: #fffaf1;   /* Very Light Sand */
    --accent: #a06d2e;       /* Brand */
    --accent-dark: #824f18;  /* Hover */
    --accent-soft: #e6c69a;
    --text-main: #2b2620;
    --text-muted: #6b5b4a;
    --border-soft: #e3d2b8;
    --shadow-soft: 0 6px 14px rgba(0, 0, 0, 0.12);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --transition-fast: 0.18s ease-out;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 32px 16px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background: radial-gradient(circle at top, #fff7ea 0, #f4e4cf 45%, #e0c9a6 100%);
    color: var(--text-main);
}

/* Zurück-Button */

.back-button {
    position: fixed;
    top: 16px;
    left: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: rgba(255, 247, 234, 0.94);
    color: var(--text-main);
    font-size: 13px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(4px);
    transition: background var(--transition-fast), transform var(--transition-fast),
        box-shadow var(--transition-fast);
    z-index: 10;
}

.back-button:hover {
    background: #fffaf1;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.back-icon {
    font-size: 16px;
    line-height: 1;
}

.back-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

/* Main Box */

.generator-box {
    background: var(--bg-box);
    width: 100%;
    max-width: 980px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 26px 26px 24px;
}

/* Header */

.generator-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.logo-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fffaf1;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.logo-text {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-main);
}

.generator-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Layout */

.generator-content {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr);
    gap: 20px;
}

.form-column {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Form */

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
}

.field-input {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    padding: 9px 11px;
    font-size: 14px;
    background: var(--bg-content);
    color: var(--text-main);
    outline: none;
    transition: border var(--transition-fast), box-shadow var(--transition-fast),
        background var(--transition-fast), transform var(--transition-fast);
}

.field-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(160, 109, 46, 0.4);
    background: #fffdf7;
    transform: translateY(-1px);
}

.textarea {
    resize: vertical;
    min-height: 80px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    line-height: 1.4;
}

.small-textarea {
    min-height: 56px;
}

/* Grid */

.field-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.1fr);
    gap: 10px;
}

.field-group {
    display: flex;
    flex-direction: column;
}

/* Metrics */

.metric-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.metric-label {
    font-weight: 600;
}

.metric-value {
    font-weight: 700;
    min-width: 24px;
}

.metric-hint {
    flex: 1;
    text-align: right;
}

/* Bars */

.bar-wrapper {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(226, 196, 148, 0.4);
    overflow: hidden;
    margin-top: 4px;
}

.bar {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, #16a34a, #4ade80);
    transition: width 0.18s ease-out, background 0.18s ease-out;
}

.bar--warn {
    background: linear-gradient(90deg, #f97316, #facc15);
}

.bar--error {
    background: linear-gradient(90deg, #dc2626, #f97373);
}

/* Optionen & Toggles */

.option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 7px 9px;
    border-radius: var(--radius-md);
    background: rgba(255, 250, 241, 0.96);
    border: 1px solid rgba(226, 196, 148, 0.85);
}

.option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.option input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
}

.add-brand-option {
    margin-top: 6px;
}

.toggle-row {
    display: inline-flex;
    border-radius: 999px;
    border: 1px solid rgba(226, 196, 148, 0.85);
    background: rgba(255, 250, 241, 0.96);
    padding: 3px;
    gap: 3px;
    width: fit-content;
}

.toggle-button {
    border-radius: 999px;
    border: none;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast),
        transform var(--transition-fast), box-shadow var(--transition-fast);
}

.toggle-button--active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fffaf1;
    box-shadow: 0 2px 6px rgba(130, 79, 24, 0.4);
    transform: translateY(-1px);
}

/* Buttons */

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.primary-button,
.secondary-button,
.ghost-button {
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    border: none;
    transition: background var(--transition-fast), transform var(--transition-fast),
        box-shadow var(--transition-fast), color var(--transition-fast),
        border-color var(--transition-fast);
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fffaf1;
    box-shadow: 0 4px 10px rgba(130, 79, 24, 0.4);
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 12px rgba(130, 79, 24, 0.46);
}

.secondary-button {
    background: var(--bg-content);
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    width: 100%;
    margin-top: 12px;
}

.secondary-button:hover {
    background: #fffdf7;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.ghost-button {
    background: transparent;
    color: var(--accent-dark);
    border: 1px dashed rgba(160, 109, 46, 0.55);
}

.ghost-button:hover {
    background: rgba(160, 109, 46, 0.08);
    transform: translateY(-1px);
}

/* Preview */

.preview-column {
    display: flex;
}

.preview-card {
    background: var(--bg-content);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-soft);
    padding: 14px 14px 16px;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.preview-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.device-pill {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(160, 109, 46, 0.08);
    border: 1px solid rgba(160, 109, 46, 0.4);
    color: var(--accent-dark);
}

/* SERP Look & Feel */

.preview-bg {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 12px 10px;
    border: 1px solid #e5e7eb;
}

.preview-inner {
    margin: 0 auto;
}

.serp {
    font-family: Arial, Helvetica, sans-serif;
    color: #202124;
}

.serp--desktop {
    max-width: 600px;
}

.serp--mobile {
    max-width: 360px;
}

.serp-url-line {
    margin-bottom: 4px;
}

.serp-breadcrumb {
    font-size: 12px;
    color: #4d5156;
}

.serp-title-link {
    display: inline-block;
    font-size: 18px;
    line-height: 1.3;
    color: #1a0dab;
    text-decoration: none;
    margin-bottom: 2px;
}

.serp-title-link:hover {
    text-decoration: underline;
}

.serp-description {
    font-size: 13px;
    line-height: 1.4;
    color: #4d5156;
    margin-top: 2px;
}

/* Help Box */

.help-box {
    margin-top: 6px;
    padding: 10px 11px;
    border-radius: var(--radius-md);
    background: rgba(255, 250, 241, 0.96);
    border: 1px solid rgba(226, 196, 148, 0.85);
}

.help-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: var(--text-main);
}

.help-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text-muted);
}

.help-list li + li {
    margin-top: 2px;
}

code {
    background: rgba(0, 0, 0, 0.04);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 11px;
}

/* Scrollbar */

textarea::-webkit-scrollbar {
    width: 6px;
}

textarea::-webkit-scrollbar-track {
    background: transparent;
}

textarea::-webkit-scrollbar-thumb {
    background: rgba(160, 109, 46, 0.35);
    border-radius: 999px;
}

/* Responsive */

@media (max-width: 880px) {
    body {
        padding: 64px 10px 16px;
    }

    .generator-box {
        padding: 20px 16px 16px;
    }

    .generator-content {
        grid-template-columns: minmax(0, 1fr);
    }

    .preview-card {
        max-width: 460px;
        margin: 0 auto;
    }

    .back-button {
        top: 10px;
        left: 10px;
    }
}

@media (max-width: 520px) {
    .field-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .logo-text {
        font-size: 15px;
    }

    .button-row {
        flex-direction: column;
        align-items: stretch;
    }

    .metric-hint {
        display: none;
    }
}
