:root {
    --bg-main: #f4e4cf;      /* Sand */
    --bg-box: #fff7ea;       /* Light Sand */
    --bg-card: #fffaf3;
    --accent: #a06d2e;       /* Brand */
    --accent-dark: #824f18;  /* Hover */
    --border-soft: #e2c9a5;
    --text-main: #2f2415;
    --text-soft: #6a5a3b;
    --error: #b3261e;
    --success: #256029;
    --shadow-soft: 0 8px 20px rgba(0,0,0,0.15);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 24px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top left, #fff7ea 0, #f4e4cf 38%, #e2c9a5 100%);
    color: var(--text-main);
}

/* Back Button */

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-bottom: 12px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.8);
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.back-button:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}

.back-icon {
    font-size: 16px;
    line-height: 1;
}

.back-label {
    font-weight: 500;
}

/* Main Container */

.generator-box {
    max-width: 1120px;
    margin: 0 auto;
    background: var(--bg-box);
    border-radius: 22px;
    padding: 22px 22px 26px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.6);
}

/* Header */

.generator-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding-bottom: 12px;
}

.logo-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.03em;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.logo-text {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-main);
}

.generator-subtitle {
    margin: 0;
    font-size: 13px;
    color: var(--text-soft);
}

/* Layout */

.generator-content {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 18px;
    margin-top: 4px;
}

.form-column,
.preview-column {
    min-width: 0;
}

/* Fields & Form */

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 4px;
}

.field-input {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    padding: 9px 11px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background: #fffdf8;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.field-input::placeholder {
    color: rgba(0,0,0,0.33);
}

.field-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(162, 109, 46, 0.12);
    background: #ffffff;
}

.textarea {
    resize: vertical;
    min-height: 140px;
    margin-top: 4px;
}

/* Layout-Subgruppen */

.field-row {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 14px;
    margin-top: 12px;
}

.field-group {
    background: rgba(255,255,255,0.85);
    border-radius: 14px;
    padding: 10px 11px 11px;
    border: 1px solid rgba(0,0,0,0.04);
}

/* Options & Toggles */

.option-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.option {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: var(--text-soft);
    cursor: pointer;
}

.option input[type="checkbox"],
.option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--accent);
}

.option-label {
    line-height: 1.4;
}

/* Buttons */

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.primary-button,
.secondary-button,
.ghost-button {
    border-radius: 999px;
    padding: 9px 14px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease, color 0.15s ease;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.22);
}

.secondary-button {
    background: #2f2a25;
    color: #fdf4e4;
}

.secondary-button:hover {
    background: #1f1a16;
}

.ghost-button {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(0,0,0,0.18);
    background-color: rgba(255,255,255,0.6);
}

.ghost-button:hover {
    background-color: rgba(255,255,255,0.9);
}

/* Help Box */

.help-box {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.9);
    border: 1px dashed rgba(0,0,0,0.12);
}

.help-title {
    font-size: 13px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--text-main);
}

.help-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--text-soft);
}

.help-list li {
    margin-bottom: 3px;
}

/* Preview Card */

.preview-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 14px 14px 16px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 6px 14px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 24px;
}

.preview-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

/* Pattern Display Styling reused */

.canonical-preview-box {
    border-radius: 10px;
    background: #1c1309;
    color: #f5e0bf;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.canonical-url-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    color: rgba(255,244,220,0.8);
}

.canonical-url-value {
    font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    word-break: break-all;
}

/* Matches List */

.matches-list {
    min-height: 60px;
    border-radius: 10px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 8px 9px;
    font-size: 12px;
    overflow-y: auto;
    max-height: 180px;
}

.match-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    margin: 2px 4px 2px 0;
    border-radius: 999px;
    background: rgba(162, 109, 46, 0.09);
    border: 1px solid rgba(162, 109, 46, 0.2);
    font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    white-space: nowrap;
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
}

.match-pill-index {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-soft);
}

.match-pill-text {
    font-size: 11px;
    color: var(--text-main);
}

/* Highlight Preview */

.highlight-preview {
    border-radius: 10px;
    background: #111010;
    color: #f8f5ef;
    border: 1px solid #333;
    padding: 10px 11px;
    min-height: 80px;
    max-height: 220px;
    overflow-y: auto;
    font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
    white-space: pre-wrap;
}

.highlight-preview mark {
    background: #f1c453;
    color: #111;
    padding: 0 1px;
    border-radius: 3px;
}

/* Meta Bar */

.meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.meta-item {
    flex: 1 1 0;
    min-width: 0;
    background: rgba(255,255,255,0.85);
    border-radius: 999px;
    padding: 5px 9px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    border: 1px solid rgba(0,0,0,0.06);
}

.meta-label {
    color: var(--text-soft);
}

.meta-value {
    font-weight: 600;
    color: var(--text-main);
}

.meta-value--ok {
    color: var(--success);
}

.meta-value--error {
    color: var(--error);
}

/* Hints */

.hint-text {
    margin: 6px 0 0;
    font-size: 11px;
    color: var(--text-soft);
}

.hint-text--bottom {
    margin-top: 8px;
}

.hint-text--error {
    color: var(--error);
}

/* Responsive */

@media (max-width: 900px) {
    .generator-content {
        grid-template-columns: minmax(0, 1fr);
    }

    .preview-card {
        position: static;
    }
}

@media (max-width: 720px) {
    body {
        padding: 12px;
    }

    .generator-box {
        padding: 16px 14px 18px;
    }

    .field-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .button-row {
        flex-direction: column;
    }
}
