:root {
    --color-1: #cf6e63;
    --color-2: #c01e1b;
    --color-3: #811214;
    --color-4: #4e100e;
    --color-5: #300303;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #fafafa;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    bottom: -100px;
    right: -100px;
    width: 600px;
    height: 600px;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400'><g transform='translate(200,200)'><circle cx='0' cy='0' r='60' fill='%23c01e1b' opacity='0.3'/><circle cx='0' cy='-80' r='35' fill='none' stroke='%23cf6e63' stroke-width='1.5' opacity='0.5'/><circle cx='69' cy='-40' r='35' fill='none' stroke='%23cf6e63' stroke-width='1.5' opacity='0.5'/><circle cx='69' cy='40' r='35' fill='none' stroke='%23cf6e63' stroke-width='1.5' opacity='0.5'/><circle cx='0' cy='80' r='35' fill='none' stroke='%23cf6e63' stroke-width='1.5' opacity='0.5'/><circle cx='-69' cy='40' r='35' fill='none' stroke='%23cf6e63' stroke-width='1.5' opacity='0.5'/><circle cx='-69' cy='-40' r='35' fill='none' stroke='%23cf6e63' stroke-width='1.5' opacity='0.5'/><circle cx='0' cy='-120' r='20' fill='%23c01e1b' opacity='0.3'/><circle cx='104' cy='-60' r='20' fill='%23c01e1b' opacity='0.3'/><circle cx='104' cy='60' r='20' fill='%23c01e1b' opacity='0.3'/><circle cx='0' cy='120' r='20' fill='%23c01e1b' opacity='0.3'/><circle cx='-104' cy='60' r='20' fill='%23c01e1b' opacity='0.3'/><circle cx='-104' cy='-60' r='20' fill='%23c01e1b' opacity='0.3'/></g></svg>") no-repeat;
    background-size: contain;
    pointer-events: none;
    z-index: 0;
    opacity: 0.02;
}

body > * {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    overflow: hidden;
}

header {
    background: white;
    padding: 40px 30px 30px;
    text-align: center;
    border-bottom: 2px solid var(--color-2);
}

header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-3);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

header p {
    font-size: 14px;
    color: #666;
    font-weight: 400;
}

.author-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.author-select {
    padding: 6px 12px;
    border: 1px solid var(--color-2);
    border-radius: 4px;
    font-size: 12px;
    background: white;
    color: var(--color-3);
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
}

.author-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(192, 30, 27, 0.2);
}

.author-input {
    padding: 8px 12px;
    border: 1px solid var(--color-2);
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-3);
    text-align: center;
    font-family: inherit;
    max-width: 300px;
    transition: all 0.2s ease;
}

.author-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(192, 30, 27, 0.2);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px 30px;
    background: white;
    border-bottom: 1px solid #e5e5e5;
    flex-wrap: wrap;
}

.no-print {
    display: inline-flex;
}

.theme-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--color-2);
    background: #fff;
    color: var(--color-3);
    font-size: 16px;
    font-weight: 700;
    display: grid;
    place-items: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
    z-index: 10;
}

.theme-toggle:hover {
    background: var(--color-2);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.theme-toggle:active {
    transform: scale(0.95);
}

button {
    padding: 10px 18px;
    border: 1px solid var(--color-2);
    background: white;
    color: var(--color-2);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background: var(--color-2);
    color: white;
    box-shadow: 0 2px 8px rgba(192, 30, 27, 0.15);
}

.btn-success {
    border-color: var(--color-3);
    color: var(--color-3);
}

.btn-success:hover {
    background: var(--color-3);
    color: white;
    box-shadow: 0 2px 8px rgba(129, 18, 20, 0.15);
}

.btn-secondary {
    border-color: #999;
    color: #999;
}

.btn-secondary:hover {
    background: #999;
    color: white;
    box-shadow: 0 2px 8px rgba(153, 153, 153, 0.15);
}

.site-info {
    background: #fafafa;
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 20px;
}

.site-info-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-3);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.site-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    margin-bottom: 5px;
}

.form-group input {
    padding: 8px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-2);
    box-shadow: 0 0 0 2px rgba(192, 30, 27, 0.1);
}

.content {
    padding: 30px;
}

.section {
    margin-bottom: 35px;
}

.section-title {
    background: transparent;
    color: var(--color-3);
    padding: 15px 0;
    border-bottom: 2px solid var(--color-2);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.3px;
}

.question-group {
    margin-bottom: 8px;
    padding: 15px;
    background: #fafafa;
    border-left: 2px solid var(--color-2);
    border-radius: 0;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.question-group:hover {
    background: #f3f1f1;
    border-left-color: var(--color-3);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.question-title {
    font-weight: 500;
    margin-bottom: 12px;
    color: #333;
    font-size: 13px;
    line-height: 1.5;
}

.radio-group {
    display: flex;
    gap: 18px;
    margin-top: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 6px;
}

input[type="radio"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--color-2);
}

.radio-option label {
    cursor: pointer;
    font-size: 13px;
    color: #555;
    font-weight: 400;
}

.summary {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-left: 3px solid var(--color-2);
    padding: 25px;
    margin-top: 40px;
}

.summary-title {
    font-weight: 700;
    color: var(--color-3);
    margin-bottom: 20px;
    font-size: 15px;
    letter-spacing: -0.3px;
}

.score-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.score-item {
    background: white;
    padding: 15px;
    border-radius: 0;
    text-align: center;
    border: 1px solid #e5e5e5;
}

.score-item h3 {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.score-item .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-2);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e5e5e5;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--color-2);
    width: 0%;
    transition: width 0.3s ease;
}

.footer {
    padding: 20px 30px;
    text-align: center;
    background: white;
    color: #999;
    font-size: 12px;
    border-top: 1px solid #e5e5e5;
    font-weight: 400;
}

.pdf-container {
    background: white;
}

.pdf-header {
    background: white;
    padding: 20px 30px 15px;
    text-align: center;
    border-bottom: 2px solid var(--color-2);
}

.question-group,
.summary,
.site-info,
.score-item {
    break-inside: avoid;
    page-break-inside: avoid;
}

.section-title {
    break-after: avoid;
    page-break-after: avoid;
}

@media (max-width: 768px) {
    .author-section {
        flex-direction: column;
    }

    .author-input {
        max-width: 100%;
        width: 100%;
    }

    .controls {
        flex-direction: column;
        gap: 6px;
    }

    button {
        width: 100%;
    }

    header h1 {
        font-size: 24px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .content {
        padding: 20px;
    }

    header {
        padding: 30px 20px 20px;
    }

    .score-display {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-info-grid {
        grid-template-columns: 1fr;
    }
}

body.dark {
    background: #1a0d0d;
    color: #f5eded;
}

body.dark::before {
    opacity: 0.03;
}

body.dark .container,
body.dark header,
body.dark .controls,
body.dark .footer,
body.dark .site-info,
body.dark .question-group,
body.dark .summary,
body.dark .score-item,
body.dark .pdf-container,
body.dark .pdf-header {
    background: #221010;
}

body.dark .controls,
body.dark header {
    border-color: var(--color-3);
}

body.dark .site-info,
body.dark .summary {
    border-color: #3a1a1a;
    border-left-color: var(--color-2);
}

body.dark .question-group {
    border-left-color: var(--color-1);
}

body.dark .question-group:hover {
    background: #2a1414;
    border-left-color: var(--color-2);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
}

body.dark header h1,
body.dark .section-title,
body.dark .summary-title,
body.dark .site-info-title,
body.dark .score-item .value {
    color: #f2d9d7;
}

body.dark header p,
body.dark .question-title,
body.dark .radio-option label,
body.dark .form-group label,
body.dark .score-item h3,
body.dark .footer {
    color: #d3b6b3;
}

body.dark .form-group input,
body.dark .author-input,
body.dark .author-select {
    background: #1a0d0d;
    border-color: #4a2323;
    color: #f2d9d7;
}

body.dark .form-group input::placeholder,
body.dark .author-input::placeholder {
    color: #a98f8c;
}

body.dark button {
    background: transparent;
    color: var(--color-1);
    border-color: var(--color-2);
}

body.dark .theme-toggle {
    background: #2a1414;
    color: #f2d9d7;
    border-color: var(--color-1);
}

body.dark .theme-toggle:hover {
    background: var(--color-2);
    color: #fff;
}

body.dark button:hover {
    background: var(--color-2);
    color: #fff5f4;
}

body.dark .btn-secondary {
    border-color: #7e5b5b;
    color: #d3b6b3;
}

body.dark .btn-secondary:hover {
    background: #7e5b5b;
    color: #fff;
}

body.dark .progress-bar {
    background: #3a1a1a;
}

@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
    }

    .controls {
        display: none;
    }

    .no-print {
        display: none !important;
    }

    header {
        border-bottom: none;
    }

    .author-section {
        display: none;
    }

    .site-info {
        background: white;
        border: 2px solid var(--color-2);
        margin-bottom: 20px;
    }

    .site-info-grid input {
        border: none;
        padding: 5px 0;
        font-weight: 500;
        color: var(--color-3);
    }

    .footer {
        margin-top: 30px;
    }
}
