:root {
    --bg-color: #f4f4f4;
    --line-color: #bbb;
    --dot-color: #ccc;
    --font-main: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --primary-color: #222;
    --preview-max-width: 960px;
    --accent-color: #222;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
    color: #333;
    margin: 0;
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- STEUERUNG --- */
.controls-container {
    position: sticky;
    top: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    padding: 10px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.kw-display {
    text-align: center;
    min-width: 100px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: transform 0.1s, background 0.2s;
}

button:active {
    transform: scale(0.95);
}

button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.btn-nav {
    background: #e0e0e0;
    color: #333;
}

.btn-nav:hover {
    background: #d0d0d0;
}

.btn-download {
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-download:hover {
    background: #444;
}

.btn-multi {
    background: #555;
}

.btn-multi:hover {
    background: #666;
}

.btn-settings {
    background: #e0e0e0;
    color: #333;
    font-size: 18px;
    padding: 8px 14px;
    border-radius: 50%;
    line-height: 1;
}

.btn-settings:hover {
    background: #d0d0d0;
}

/* --- SETTINGS PANEL --- */
.settings-panel {
    max-width: 600px;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 0;
    margin-bottom: 24px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}

.settings-panel.open {
    max-height: 400px;
    opacity: 1;
    padding: 24px 28px;
}

.settings-panel h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-row label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
}

.setting-row select {
    padding: 8px 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-main);
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s;
}

.setting-row select:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* --- VORSCHAU WRAPPER --- */
.preview-wrapper {
    width: min(100%, var(--preview-max-width));
    margin-bottom: 24px;
}

.sheet {
    width: 100%;
    aspect-ratio: 210 / 297;
    max-height: calc(100vh - 180px);
    background: white;
    padding: 5%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

/* Preview theme accents */
.sheet[data-theme="dark"] {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.sheet[data-theme="dark"] header {
    border-bottom-color: #3c3c3c;
}

.sheet[data-theme="dark"] .sheet-title,
.sheet[data-theme="dark"] .date-box {
    color: #333;
}

.sheet[data-theme="dark"] .day-header {
    border-bottom-color: #3c3c3c;
    color: #333;
}

.sheet[data-theme="dark"] .circle {
    border-color: #3c3c3c;
}

.sheet[data-theme="dark"] .prio-box {
    border-color: #3c3c3c;
}

.sheet[data-theme="dark"] .notes-block {
    border-color: #3c3c3c;
}

.sheet[data-theme="dark"] .notes-header {
    background: #3c3c3c;
}

.sheet[data-theme="blue"] header {
    border-bottom-color: #1e3c78;
}

.sheet[data-theme="blue"] .sheet-title,
.sheet[data-theme="blue"] .date-box {
    color: #1e3c78;
}

.sheet[data-theme="blue"] .day-header {
    border-bottom-color: #1e3c78;
    color: #1e3c78;
}

.sheet[data-theme="blue"] .circle {
    border-color: #1e3c78;
}

.sheet[data-theme="blue"] .prio-box {
    border-color: #1e3c78;
}

.sheet[data-theme="blue"] .notes-block {
    border-color: #1e3c78;
}

.sheet[data-theme="blue"] .notes-header {
    background: #1e3c78;
}

.sheet[data-theme="blue"] .line {
    border-bottom-color: #aabedd;
}

.sheet[data-theme="blue"] .dot-grid-area {
    background-image: radial-gradient(#b4c8e6 1.5px, transparent 1.5px);
}

.sheet[data-theme="green"] header {
    border-bottom-color: #1e5a32;
}

.sheet[data-theme="green"] .sheet-title,
.sheet[data-theme="green"] .date-box {
    color: #1e5a32;
}

.sheet[data-theme="green"] .day-header {
    border-bottom-color: #1e5a32;
    color: #1e5a32;
}

.sheet[data-theme="green"] .circle {
    border-color: #1e5a32;
}

.sheet[data-theme="green"] .prio-box {
    border-color: #1e5a32;
}

.sheet[data-theme="green"] .notes-block {
    border-color: #1e5a32;
}

.sheet[data-theme="green"] .notes-header {
    background: #1e5a32;
}

.sheet[data-theme="green"] .line {
    border-bottom-color: #aad2b4;
}

.sheet[data-theme="green"] .dot-grid-area {
    background-image: radial-gradient(#b4d7be 1.5px, transparent 1.5px);
}

/* --- SEO TEXT BLOCK --- */
.seo-content {
    max-width: 800px;
    margin-top: 50px;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    line-height: 1.6;
}

.seo-content h1 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.seo-content h2 {
    font-size: 1.3rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.seo-content h3 {
    font-size: 1.2rem;
    margin-top: 20px;
    margin-bottom: 10px;
}

.seo-content p {
    margin-bottom: 15px;
    color: #555;
}

.seo-content ul {
    margin-left: 20px;
    margin-bottom: 20px;
    color: #555;
}

.seo-content a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* --- SHEET STYLES --- */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 3px solid black;
    padding-bottom: 10px;
    margin-bottom: 15px;
    transition: border-color 0.3s;
}

.sheet-title {
    font-size: clamp(1.2rem, 2.3vw, 2.2rem);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    color: black;
    transition: color 0.3s;
}

.date-box {
    text-align: right;
    font-size: clamp(0.72rem, 1.1vw, 0.95rem);
    font-weight: 500;
    color: black;
    transition: color 0.3s;
}

.priorities {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.prio-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 8pt;
    font-weight: bold;
    height: 40px;
    text-align: center;
    margin-right: 5px;
    color: black;
}

.prio-box {
    flex: 1;
    border: 1px solid black;
    height: 40px;
    display: flex;
    align-items: center;
    padding-left: 10px;
    font-size: 9pt;
    color: #666;
    transition: border-color 0.3s;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6%;
    flex-grow: 1;
}

.column {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.day-block {
    margin-bottom: 5px;
    min-height: 12.5%;
}

.day-header {
    font-size: clamp(0.62rem, 1vw, 0.9rem);
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 2px solid black;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    color: black;
    transition: border-color 0.3s, color 0.3s;
}

.line {
    display: flex;
    align-items: center;
    height: clamp(10px, 1.8vw, 24px);
    border-bottom: 1px dotted var(--line-color);
    margin-bottom: 2px;
    transition: border-color 0.3s;
}

.circle {
    width: clamp(7px, 1.1vw, 12px);
    height: clamp(7px, 1.1vw, 12px);
    border: 1.5px solid black;
    border-radius: 50%;
    margin-right: 10px;
    transition: border-color 0.3s;
}

.notes-block {
    flex-grow: 1;
    border: 2px solid black;
    display: flex;
    flex-direction: column;
    min-height: 12.5%;
    transition: border-color 0.3s;
}

.notes-header {
    background: black;
    color: white;
    padding: 5px 10px;
    font-size: clamp(0.58rem, 0.9vw, 0.83rem);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    transition: background 0.3s;
}

.dot-grid-area {
    flex-grow: 1;
    margin: 5px;
    background-image: radial-gradient(var(--dot-color) 1.5px, transparent 1.5px);
    background-size: 5mm 5mm;
    transition: background-image 0.3s;
}

.footer-brand {
    position: absolute;
    bottom: 2.4%;
    right: 5%;
    font-size: clamp(0.45rem, 0.8vw, 0.67rem);
    color: #aaa;
    font-family: monospace;
}

/* --- SKIP LINK (Accessibility) --- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    z-index: 200;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 0;
}

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .controls-container {
        border-radius: 20px;
    }

    .sheet {
        max-height: none;
    }

    .seo-content {
        padding: 28px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    body {
        padding: 20px 12px;
    }

    .controls-container {
        width: 100%;
        gap: 8px;
        padding: 10px 12px;
        top: 8px;
        margin-bottom: 20px;
    }

    button {
        padding: 10px 14px;
    }

    .kw-display {
        min-width: auto;
    }

    .preview-wrapper {
        width: 100%;
    }

    .main-grid {
        gap: 4%;
    }

    .seo-content {
        margin-top: 28px;
        padding: 20px;
    }

    .btn-download, .btn-multi {
        font-size: 12px;
        padding: 8px 12px;
    }

    .settings-panel.open {
        padding: 16px 18px;
    }
}
