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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 10px;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.5rem;
    color: #232D4B;
    flex: 1;
    min-width: 200px;
}

.back-link {
    color: #E57200;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 12px;
    border: 1px solid #E57200;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.back-link:hover {
    background-color: #E57200;
    color: white;
}

.intro {
    text-align: center;
    margin-bottom: 30px;
    font-size: 1rem;
    color: #555;
    padding: 0 10px;
}

.navigation {
    margin-top: 20px;
}

.exercise-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.exercise-link {
    display: block;
    padding: 20px;
    background-color: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s;
    min-height: 80px;
}

.exercise-link:hover {
    background-color: #E57200;
    color: white;
    border-color: #E57200;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.exercise-link h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: inherit;
}

.exercise-link p {
    font-size: 0.95rem;
    color: inherit;
    opacity: 0.9;
}

.exercise-container {
    width: 100%;
}

.info-box,
.teaching-box,
.warning-box {
    padding: 14px 16px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.info-box {
    background-color: #e3f2fd;
    border-left: 4px solid #2196F3;
}

.teaching-box {
    background-color: #f8f9fa;
    border-left: 4px solid #232D4B;
}

.warning-box {
    background-color: #fff3e0;
    border-left: 4px solid #E57200;
}

.info-box p,
.teaching-box p,
.warning-box p {
    margin: 0 0 8px;
}

.info-box p:last-child,
.teaching-box p:last-child,
.warning-box p:last-child {
    margin-bottom: 0;
}

.vignette-card {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 20px;
}

.vignette-card h2,
.section-heading {
    color: #232D4B;
    margin-bottom: 10px;
}

.bio-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: center;
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.bio-card h2 {
    color: #232D4B;
    margin-bottom: 8px;
}

.portrait-panel {
    max-width: 220px;
    margin: 0 auto;
    text-align: center;
}

.portrait-panel img,
.portrait-panel svg {
    width: 100%;
    height: auto;
    display: block;
}

.portrait-panel img {
    border-radius: 6px;
    border: 1px solid #ddd;
    background: white;
}

.caption {
    margin-top: 6px;
    color: #666;
    font-size: 0.85rem;
}

.controls {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.control-group {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-group label {
    font-weight: 500;
    min-width: 170px;
    font-size: 0.95rem;
}

.control-group input[type="range"] {
    flex: 1;
    min-width: 200px;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #E57200;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #E57200;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.value-display {
    font-weight: 700;
    color: #E57200;
    min-width: 64px;
    text-align: right;
}

.stats-display {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    font-size: 0.95rem;
}

.stats-display p {
    margin: 5px 0;
}

.stats-display strong {
    color: #232D4B;
}

.choice-grid,
.concept-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin: 15px 0;
}

.choice-button,
.concept-card {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    padding: 14px;
    text-align: left;
}

.choice-button {
    cursor: pointer;
    font: inherit;
    transition: all 0.2s;
}

.choice-button:hover,
.choice-button.selected {
    border-color: #E57200;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.choice-button.selected {
    background-color: #fff8f0;
}

.choice-value {
    color: #E57200;
    font-weight: 700;
}

.emr-order {
    border: 1px solid #cfd7df;
    border-radius: 8px;
    background: white;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.emr-order-header {
    background: #eef3f8;
    border-bottom: 1px solid #cfd7df;
    color: #232D4B;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 10px 14px;
}

.emr-order-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    flex-wrap: wrap;
}

.emr-order-details {
    flex: 1;
    min-width: 260px;
}

.emr-order-title {
    color: #232D4B;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.emr-order-meta {
    color: #555;
    font-size: 0.92rem;
    margin: 2px 0;
}

.emr-order-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.emr-order-actions .btn {
    flex: 0 0 auto;
}

.concept-card h3 {
    color: #232D4B;
    margin-bottom: 8px;
}

.visual-panel {
    width: 100%;
    margin: 20px 0;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    overflow: hidden;
}

.lr-scale-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 20px 0;
}

.lr-scale-panel {
    margin: 0;
    padding: 12px;
}

.visual-panel svg {
    width: 100%;
    height: auto;
    display: block;
}

.full-width-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    min-height: 44px;
    min-width: 120px;
    flex: 1;
    max-width: 220px;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    background-color: #E57200;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #d16500;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #5a6268;
    transform: translateY(-1px);
}

.btn-blue {
    background-color: #2196F3;
    color: white;
}

.btn-blue:hover:not(:disabled) {
    background-color: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.btn-outline {
    background: white;
    color: #232D4B;
    border: 1px solid #232D4B;
}

.btn-outline:hover:not(:disabled) {
    background: #232D4B;
    color: white;
}

.hidden {
    display: none;
}

.inline-result-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.inline-result-row-left {
    justify-content: flex-start;
}

.inline-result {
    padding: 10px 12px;
    border-radius: 6px;
    background: #e3f2fd;
    border: 1px solid #2196F3;
    color: #232D4B;
    font-weight: 500;
}

.inline-list {
    margin: 10px 0 10px 22px;
}

.inline-list li {
    margin-bottom: 6px;
}

.formula-block {
    margin: 12px 0;
    padding: 12px;
    border-radius: 6px;
    background: white;
    border: 1px solid #ddd;
    font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
    overflow-x: auto;
    white-space: nowrap;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

.result-callout {
    border: 2px solid #E57200;
    border-radius: 8px;
    padding: 16px;
    margin: 15px 0;
    background: #fff8f0;
}

.result-callout h2 {
    color: #232D4B;
    margin-bottom: 8px;
}

.radiology-report {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 14px;
}

.radiology-report p {
    margin: 0 0 10px;
}

.radiology-report p:last-child {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    body {
        padding: 20px;
    }

    .container {
        max-width: 900px;
        padding: 30px;
    }

    .page-header h1 {
        font-size: 1.8rem;
    }

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

    .bio-card {
        grid-template-columns: 240px 1fr;
    }

    .lr-scale-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media print {
    body {
        background-color: white;
    }

    .buttons,
    .controls {
        display: none;
    }
}
