:root {
    --bg-color: #ffffff;
    --text-color: #000000;
    --accent-color: #0000ff;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f0f0;
    color: #333;
    line-height: 1.6;
}

body.sc-font-smooth {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ccc;
}

header h1 {
    margin: 0 0 10px 0;
}

header p {
    margin: 0;
    color: #666;
}

main {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    align-items: flex-start;
}

#controls {
    flex: 1;
    min-width: 250px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#controls h2 {
    margin-top: 1.5em;
    margin-bottom: 0.75em;
    font-size: 1.1rem;
}

#controls h2:first-of-type {
    margin-top: 0;
}

#preset-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preset-btn {
    padding: 12px 16px;
    font-size: 16px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fdfdfd;
    text-align: left;
    transition: all 0.2s ease-in-out;
}

.preset-btn:hover {
    background: #f4f4f4;
    border-color: #ccc;
}

.preset-btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.preset-btn.active {
    background: #eef4ff;
    border-color: #0066cc;
    color: #0066cc;
    font-weight: bold;
}

.toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}

.toggle input {
    width: 18px;
    height: 18px;
    accent-color: #0066cc;
}

.fatigue-panel {
    background: #f8f9fa;
    padding: 14px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.fatigue-bar {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    appearance: none;
    border: none;
    background: #e9ecef;
    overflow: hidden;
}

.fatigue-bar::-webkit-progress-bar {
    background: #e9ecef;
    border-radius: 6px;
}

.fatigue-bar::-webkit-progress-value {
    border-radius: 6px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.fatigue-bar::-moz-progress-bar {
    border-radius: 6px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.fatigue-bar.low::-webkit-progress-value { background: #28a745; }
.fatigue-bar.low::-moz-progress-bar { background: #28a745; }

.fatigue-bar.optimal::-webkit-progress-value { background: #17a2b8; }
.fatigue-bar.optimal::-moz-progress-bar { background: #17a2b8; }

.fatigue-bar.elevated::-webkit-progress-value { background: #ffc107; }
.fatigue-bar.elevated::-moz-progress-bar { background: #ffc107; }

.fatigue-bar.high::-webkit-progress-value { background: #dc3545; }
.fatigue-bar.high::-moz-progress-bar { background: #dc3545; }

#fatigue-label {
    margin-top: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.fatigue-desc {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: #666;
}

#preview {
    flex: 2;
    min-width: 300px;
}

#preview h2 {
    margin-top: 0;
}

.preview-card {
    background-color: var(--bg-color);
    color: var(--text-color);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.preview-card h3 {
    margin-top: 0;
}

.preview-card p {
    margin-bottom: 1.5em;
}

.preview-card a {
    color: var(--accent-color);
    text-decoration: underline;
    transition: color 0.3s ease;
}

.preview-card a:hover {
    opacity: 0.8;
}

#export {
    flex: 100%;
    min-width: 300px;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#export h2 {
    margin-top: 0;
}

.export-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.export-controls button {
    padding: 12px 16px;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fdfdfd;
    transition: background 0.2s ease-in-out;
}

.export-controls button:hover {
    background: #f4f4f4;
}

.export-controls button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

#export-output {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    resize: vertical;
}

.sc-reading-ruler {
    position: fixed;
    left: 0;
    right: 0;
    height: 2.5em;
    pointer-events: none;
    z-index: 2147483647;
    background: rgba(128, 128, 128, 0.12);
    mix-blend-mode: difference;
    display: block;
    border-top: 1px solid rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(0, 0, 0, 0.7);
}

:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
