:root {
    --primary-red: #d32f2f;
    --bg-gray: #f5f5f5;
    --text-dark: #333;
    --text-light: #666;
    --border-color: #eee;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-dark);
    line-height: 1.5;
}

.page-container {
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Welcome Page Styles */
.welcome-card {
    padding: 30px 20px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.main-title {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: var(--text-dark);
}

.instruction-text {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 30px;
    background: #fdf6f6;
    /* Light red tint */
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-red);
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 18px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.form-item {
    margin-bottom: 25px;
}

.form-item label {
    display: block;
    margin-bottom: 10px;
    font-weight: 500;
}

.input-underline {
    border: none;
    border-bottom: 1px solid #999;
    width: 60px;
    text-align: center;
    font-size: 16px;
    outline: none;
}

.input-underline:focus {
    border-color: var(--primary-red);
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    cursor: pointer;
    display: flex;
    align-items: center;
}

.radio-label input {
    margin-right: 5px;
    display: none;
    /* Custom radio look if needed, using simple for now */
}

.radio-label span {
    font-size: 16px;
}

/* Enhanced Radio Visualization for Form */
.radio-label input:checked+span {
    color: var(--primary-red);
    font-weight: bold;
}

.radio-label input:checked+span::before {
    content: "■";
    /* Simple text based check replacement */
}


.disclaimer {
    margin-top: 40px;
    font-size: 12px;
    color: #999;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.disclaimer h3 {
    font-size: 14px;
    margin-bottom: 5px;
    color: #666;
}

.primary-btn {
    display: block;
    width: 100%;
    padding: 15px;
    background-color: var(--primary-red);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    margin-top: 30px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.3);
}

.primary-btn:active {
    background-color: #b71c1c;
}

/* Assessment Page Styles */
.tabs-header {
    display: flex;
    background-color: #fff;
    padding: 10px 10px 0 10px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    overflow-x: auto;
    /* Allow scrolling if many tabs */
}

.tab-item {
    padding: 10px 15px;
    margin-right: 10px;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    white-space: nowrap;
    color: var(--text-dark);
}

.tab-item.active {
    background-color: var(--primary-red);
    color: white;
}

.assessment-body {
    flex: 1;
    display: flex;
    position: relative;
    min-height: 0;
}

/* Sidebar */
.sidebar {
    width: 60px;
    min-width: 60px;
    background-color: #f8f9fa;
    border-right: 1px solid #eee;
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    top: 60px;
    left: calc(50% - 300px);
    height: calc(100vh - 60px);
    z-index: 100;
}

/* Ensure sidebar stays within page bounds on smaller screens */
@media (max-width: 600px) {
    .sidebar {
        left: 0;
    }
}

.nav-item {
    font-size: 14px;
    font-weight: 500;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    margin-bottom: 15px;
    cursor: pointer;
    color: #999;
    transition: all 0.2s ease;
    background: transparent;
}

.nav-item:hover {
    color: #333;
    background-color: #eee;
}

.nav-item.active {
    color: #fff;
    background-color: #d32f2f;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.3);
}

/* Remove the old side-bar line */
.nav-item.active::before {
    display: none;
}

/* Content */
.content-area {
    flex: 1;
    padding: 15px;
    padding-left: 75px;
    overflow-y: auto;
    background: #fff;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: baseline;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: bold;
    margin-right: 10px;
}

.section-header span {
    font-size: 14px;
    color: #666;
}

.section-intro {
    font-weight: bold;
    margin-bottom: 20px;
    font-size: 16px;
}

.highlight-red {
    color: var(--primary-red);
    font-size: 18px;
}

.question-item {
    margin-bottom: 40px;
    scroll-margin-top: 20px;
    /* For scrollIntoView spacing */
}

.q-title {
    font-size: 16px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.q-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-row {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    color: #444;
}

/* Custom Radio Circle */
.option-row input {
    display: none;
}

.option-row .circle {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-red);
    border-radius: 50%;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Prevent shrinking */
    margin-top: 2px;
    /* Slight visual adjustment for top text alignment */
}

.option-row input:checked+.circle {
    background-color: #fff;
}

.option-row input:checked+.circle::after {
    content: "";
    width: 10px;
    height: 10px;
    background-color: var(--primary-red);
    border-radius: 50%;
}

/* Checkbox Square */
.checkbox-row .square-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-red);
    border-radius: 4px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* Prevent shrinking */
    margin-top: 2px;
    /* Top align adjustment */
}

.checkbox-row input:checked+.square-box {
    background-color: var(--primary-red);
}

.checkbox-row input:checked+.square-box::after {
    content: "✓";
    color: white;
    font-size: 14px;
    line-height: 1;
    /* Fix vertical alignment of checkmark */
}


/* NRS Slider Styling */
#nrs-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 15px;
    border-radius: 10px;
    background: #f8dbdb;
    /* Light red track */
    outline: none;
}

#nrs-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #b71c1c;
    /* Dark red thumb */
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

#nrs-slider::-moz-range-thumb {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #b71c1c;
    cursor: pointer;
    border: 3px solid #fff;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}



/* Scrollbar hiding for cleaner look */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .page-container {
        max-width: 100%;
        margin: 0;
    }

    .welcome-card {
        padding: 20px 15px;
    }

    .main-title {
        font-size: 20px;
        margin-bottom: 15px;
    }

    .instruction-text {
        font-size: 13px;
        padding: 12px;
    }

    .tabs-header {
        padding: 8px 8px 0 8px;
        font-size: 12px;
    }

    .tab-item {
        padding: 8px 10px;
        margin-right: 5px;
        font-size: 12px;
    }

    .sidebar {
        width: 50px;
        min-width: 50px;
        padding-top: 15px;
        height: calc(100vh - 50px);
    }

    .nav-item {
        width: 32px;
        height: 32px;
        font-size: 12px;
        margin-bottom: 12px;
    }

    .content-area {
        padding: 10px;
        padding-left: 60px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    .section-header span {
        font-size: 12px;
    }

    .q-title {
        font-size: 15px;
    }

    .option-row {
        font-size: 15px;
        align-items: flex-start;
    }

    .option-row .circle,
    .checkbox-row .square-box {
        margin-top: 4px;
        flex-shrink: 0;
    }

    .primary-btn {
        font-size: 16px;
        padding: 12px;
        margin-top: 20px;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
    }

    .form-item {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .welcome-card {
        padding: 15px 10px;
    }

    .main-title {
        font-size: 18px;
    }

    .tabs-header {
        padding: 5px 5px 0 5px;
        font-size: 11px;
    }

    .tab-item {
        padding: 6px 8px;
        margin-right: 3px;
        font-size: 11px;
    }

    .sidebar {
        width: 45px;
        min-width: 45px;
        height: calc(100vh - 40px);
    }

    .nav-item {
        width: 28px;
        height: 28px;
        font-size: 11px;
        margin-bottom: 10px;
    }

    .content-area {
        padding: 8px;
        padding-left: 55px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 15px;
    }

    .section-header h2 {
        font-size: 15px;
        margin-right: 0;
        margin-bottom: 5px;
    }

    .q-title {
        font-size: 14px;
    }

    .option-row {
        font-size: 14px;
    }

    .option-row .circle,
    .checkbox-row .square-box {
        width: 18px;
        height: 18px;
        margin-right: 10px;
    }

    .primary-btn {
        font-size: 15px;
        padding: 10px;
    }

    .input-underline {
        width: 50px;
        font-size: 14px;
    }
}

/* Section Header Layout - Switch & Skip Buttons */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.header-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.header-left h2 {
    font-size: 18px;
    font-weight: bold;
    margin-right: 10px;
    margin-bottom: 5px;
}

.header-left span {
    font-size: 14px;
    color: #666;
}

/* Switch Button */
.switch-btn {
    background: linear-gradient(135deg, #ff7043, #d32f2f);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(211, 47, 47, 0.3);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.switch-btn:hover {
    background: linear-gradient(135deg, #ff8a65, #e53935);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(211, 47, 47, 0.4);
}

.switch-btn:active {
    transform: translateY(0);
}

/* Skip Button */
.skip-btn {
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.skip-btn:hover {
    background: #eee;
    color: #333;
    border-color: #ccc;
}

.skip-btn:active {
    background: #ddd;
}

/* Secondary Button (上一页) */
.secondary-btn {
    display: block;
    padding: 15px;
    background-color: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.secondary-btn:hover {
    background-color: #eee;
    color: #333;
    border-color: #ccc;
}

.secondary-btn:active {
    background-color: #ddd;
}

/* Navigation Buttons Container */
.nav-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.nav-buttons .primary-btn,
.nav-buttons .secondary-btn {
    flex: 1;
    margin-top: 0;
}

/* Report Page Styles */
.report-container {
    padding: 20px;
    max-width: 100%;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.report-header {
    text-align: center;
    padding: 20px 0;
    border-bottom: 2px solid #d32f2f;
    margin-bottom: 20px;
}

.report-header h1 {
    font-size: 22px;
    color: #d32f2f;
    margin-bottom: 8px;
}

.report-subtitle {
    font-size: 14px;
    color: #666;
}

.report-body {
    flex: 1;
    padding: 10px 0;
}

.report-item {
    display: flex;
    flex-direction: column;
    padding: 15px;
    margin-bottom: 12px;
    background: #fdf6f6;
    border-radius: 12px;
    border-left: 4px solid #d32f2f;
}

.report-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.report-item-label {
    font-size: 15px;
    font-weight: bold;
    color: #333;
    flex-shrink: 0;
}

.report-item-score {
    font-size: 18px;
    font-weight: bold;
    color: #d32f2f;
    flex-shrink: 0;
}

.report-item-diagnosis {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.report-item-skipped {
    background: #f9f9f9;
    border-left-color: #ccc;
}

.report-item-skipped .report-item-label {
    color: #999;
}

.report-item-skipped .report-item-score {
    color: #999;
    font-size: 14px;
    font-weight: normal;
}

.report-footer {
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.disclaimer-text {
    font-size: 12px;
    color: #999;
    line-height: 1.5;
}

/* Mobile Optimization for Report and Buttons */
@media (max-width: 480px) {
    .report-header h1 {
        font-size: 20px;
    }

    .report-item {
        padding: 12px;
    }

    .report-item-label {
        font-size: 14px;
    }

    .report-item-score {
        font-size: 16px;
    }

    .report-item-diagnosis {
        font-size: 13px;
    }

    .switch-btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    .skip-btn {
        padding: 6px 16px;
        font-size: 13px;
    }
}

/* EASI Calculator Styles */
.easi-calculator {
    background: linear-gradient(180deg, #fff 0%, #fafafa 100%);
    border-radius: 16px;
    padding: 24px 20px;
    margin: 24px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.easi-header {
    text-align: center;
    margin-bottom: 20px;
}

.easi-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.easi-header h2 {
    color: var(--primary-red);
    font-size: 20px;
    margin-bottom: 6px;
    font-weight: 600;
}

.easi-subtitle {
    color: var(--text-light);
    font-size: 14px;
}

.easi-instructions {
    background: linear-gradient(135deg, #fff8e1 0%, #fff3e0 100%);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border: 1px solid #ffe0b2;
}

.instruction-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.instruction-text {
    font-size: 13px;
    line-height: 1.6;
}

.instruction-text ul {
    margin: 8px 0 0 16px;
    padding: 0;
}

.instruction-text li {
    margin-bottom: 4px;
}

.easi-region {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.easi-region:hover {
    border-color: #ffcdd2;
    box-shadow: 0 4px 16px rgba(211, 47, 47, 0.1);
}

.region-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #fce4ec;
}

.region-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ffebee 0%, #fce4ec 100%);
    border-radius: 10px;
}

.region-info {
    display: flex;
    flex-direction: column;
}

.region-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-dark);
}

.region-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
}

.severity-group {
    margin-bottom: 14px;
}

.severity-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 10px;
}

.severity-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.severity-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-label {
    font-size: 13px;
    color: var(--text-dark);
}

.item-label small {
    color: var(--text-light);
    font-size: 11px;
}

.easi-select {
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text-dark);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.easi-select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.1);
}

.area-group {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.area-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.area-select {
    width: 100%;
}

.easi-calc-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

.easi-calc-btn:hover {
    background: linear-gradient(135deg, #e53935 0%, #d32f2f 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(211, 47, 47, 0.4);
}

.easi-calc-btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 18px;
}

.easi-result {
    background: linear-gradient(135deg, #fff 0%, #fdf6f6 100%);
    border: 2px solid var(--primary-red);
    border-radius: 16px;
    padding: 24px 20px;
    margin-top: 20px;
    text-align: center;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 16px;
}

.result-icon {
    font-size: 24px;
}

.result-header h3 {
    font-size: 18px;
    color: var(--text-dark);
    margin: 0;
}

.easi-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
}

.easi-score-label {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.easi-score-value {
    font-size: 48px;
    font-weight: bold;
    color: var(--primary-red);
    line-height: 1;
}

.score-max {
    font-size: 16px;
    color: var(--text-light);
    margin-top: 4px;
}

.easi-severity {
    font-size: 18px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 30px;
    margin: 16px auto;
    display: inline-block;
}

.easi-breakdown {
    text-align: left;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.breakdown-title {
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-dark);
}

.easi-note {
    margin-top: 16px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    text-align: center;
}

.easi-note small {
    color: var(--text-light);
    font-size: 12px;
}