:root {
    --color-primary-red: #e74c3c;     /* 主要紅色 */
    --color-secondary-red: #c0392b;   /* 深紅色 */
    --color-gray-blue: #34495e;       /* 灰藍色 */
    --color-dark-gray-blue: #2c3e50;  /* 深灰藍色 */
    --color-light-gray-blue: #5d6d7e; /* 淺灰藍色 */
    --color-white: #ffffff;           /* 純白色 */
    --color-light-gray: #ecf0f1;      /* 淺灰色 */
    --color-dark: #1a1a1a;           /* 深色 */
    --font-main: 'Microsoft YaHei', sans-serif;
    --font-brush: 'KaiTi', 'STKaiti', serif;
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, var(--color-dark-gray-blue) 0%, var(--color-gray-blue) 50%, var(--color-dark-gray-blue) 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    color: var(--color-white);
}

.container {
    width: 100%;
    max-width: 1000px;
    background-color: var(--color-gray-blue);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
    border: 2px solid var(--color-primary-red);
}

/* 進度條樣式 */
.progress-container {
    background: linear-gradient(90deg, var(--color-primary-red) 0%, var(--color-secondary-red) 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
}

.progress-scroll {
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><path d="M5,10 Q25,5 50,10 T95,10" stroke="%23333" stroke-width="2" fill="none"/></svg>') no-repeat center;
    background-size: contain;
    height: 40px;
    margin: 10px 0;
}

.progress-text {
    font-family: var(--font-brush);
    font-size: 18px;
    color: var(--color-white);
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* 主要內容區域 */
.main-content {
    padding: 40px;
    min-height: 500px;
    color: var(--color-white);
}

/* 標題樣式 */
.page-title {
    font-family: var(--font-brush);
    font-size: 32px;
    color: var(--color-white);
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 按鈕樣式 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary-red) 0%, var(--color-secondary-red) 100%);
    color: var(--color-white);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
    background: linear-gradient(135deg, var(--color-secondary-red) 0%, var(--color-primary-red) 100%);
}

.btn-secondary {
    background: var(--color-gray);
    color: var(--color-white);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-secondary:hover {
    background: #666;
    transform: translateY(-1px);
}

.btn-green {
    background: linear-gradient(135deg, var(--color-green) 0%, #45a049 100%);
    color: var(--color-white);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.btn-blue {
    background: linear-gradient(135deg, var(--color-blue) 0%, #1976d2 100%);
    color: var(--color-white);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* 輸入框樣式 */
.input-group {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--color-white);
}

.input-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--color-earth-yellow);
    box-shadow: 0 0 10px rgba(229, 168, 77, 0.2);
}

/* 卡片樣式 */
.card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-selected {
    border: 3px solid var(--color-earth-yellow);
    background: linear-gradient(135deg, #fff9e6 0%, white 100%);
}

/* 兩欄佈局 */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

/* 選項樣式 */
.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.option-item {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.option-item:hover {
    border-color: var(--color-earth-yellow);
    background: #fff9e6;
}

.option-item.selected {
    border-color: var(--color-earth-yellow);
    background: linear-gradient(135deg, var(--color-earth-yellow) 0%, #d4941e 100%);
    color: white;
}

.option-icon {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

/* 幫助按鈕 */
.help-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-earth-yellow);
    color: white;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 載入動畫 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 響應式設計 */
@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .two-column {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .option-grid {
        grid-template-columns: 1fr;
    }
}

/* 隱藏類別 */
.hidden {
    display: none;
}

/* 淡入動畫 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 增強的交互效果 */
.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 進度條動畫 */
.progress-scroll {
    animation: scrollUnfold 0.8s ease-out;
}

@keyframes scrollUnfold {
    from { 
        transform: scaleX(0);
        opacity: 0;
    }
    to { 
        transform: scaleX(1);
        opacity: 1;
    }
}

/* 卡片選中動畫 */
.card-selected {
    animation: cardSelect 0.3s ease;
}

@keyframes cardSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* 選項項目動畫 */
.option-item {
    position: relative;
    overflow: hidden;
}

.option-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(229, 168, 77, 0.2), transparent);
    transition: left 0.5s ease;
}

.option-item:hover::before {
    left: 100%;
}

.option-item.selected {
    animation: optionSelect 0.4s ease;
}

@keyframes optionSelect {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* 輸入框聚焦動畫 */
.input-field:focus {
    animation: inputFocus 0.3s ease;
}

@keyframes inputFocus {
    0% { box-shadow: 0 0 0 rgba(229, 168, 77, 0); }
    100% { box-shadow: 0 0 10px rgba(229, 168, 77, 0.2); }
}

/* 成功/錯誤消息動畫 */
.error-message, .success-message {
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

/* 載入動畫增強 */
.loading {
    animation: spin 1s linear infinite, pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 懸停效果增強 */
.card:hover {
    animation: cardHover 0.3s ease;
}

@keyframes cardHover {
    0% { transform: translateY(0); }
    100% { transform: translateY(-3px); }
}

/* 按鈕懸停波紋效果 */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* 響應式設計優化 */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .main-content {
        padding: 30px;
    }
    
    .page-title {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        margin: 0;
        border-radius: 15px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    }
    
    .main-content {
        padding: 20px;
    }
    
    .two-column {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .page-title {
        font-size: 24px;
        margin-bottom: 20px;
    }
    
    .option-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .option-item {
        padding: 12px;
        font-size: 14px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    
    .progress-container {
        padding: 15px;
    }
    
    .progress-text {
        font-size: 16px;
    }
    
    .help-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 15px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .card {
        padding: 15px;
    }
    
    .option-item {
        padding: 10px;
        font-size: 13px;
    }
    
    .option-icon {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .input-field {
        padding: 10px 12px;
        font-size: 14px;
    }
}

/* 高對比度模式支持 */
@media (prefers-contrast: high) {
    .btn-primary {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .card {
        border: 2px solid #000;
    }
    
    .option-item {
        border: 2px solid #000;
    }
    
    .option-item.selected {
        background: #000;
        color: #fff;
    }
}

/* 減少動畫模式支持 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .btn::before {
        display: none;
    }
    
    .option-item::before {
        display: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --color-light-beige: #2c2c2c;
        --color-ink-black: #ffffff;
        --color-gray: #cccccc;
        --color-light-gray: #3c3c3c;
    }
    
    body {
        background: linear-gradient(135deg, #2c2c2c 0%, #1c1c1c 100%);
    }
    
    .container {
        background-color: #333;
        color: #fff;
    }
    
    .card {
        background: #444;
        color: #fff;
    }
    
    .input-field {
        background: #555;
        color: #fff;
        border-color: #666;
    }
    
    .input-field:focus {
        border-color: var(--color-earth-yellow);
    }
}

/* 觸控設備優化 */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .option-item {
        min-height: 44px;
        padding: 12px;
    }
    
    .help-btn {
        width: 44px;
        height: 44px;
    }
    
    .input-field {
        min-height: 44px;
    }
}

/* 打印樣式 */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .btn, .help-btn {
        display: none;
    }
    
    .progress-container {
        background: white;
        color: black;
        border-bottom: 1px solid #000;
    }
}

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

/* 焦點指示器 */
.btn:focus,
.input-field:focus,
.option-item:focus,
.help-btn:focus {
    outline: 3px solid var(--color-earth-yellow);
    outline-offset: 2px;
}

/* 跳過連結 */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-earth-yellow);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* 語言切換器樣式 */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.lang-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 15px;
    background: transparent;
    color: var(--color-dark-text);
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: var(--color-earth-yellow);
    color: var(--color-white);
    transform: translateY(-1px);
}

.lang-btn.active {
    background: var(--color-earth-yellow);
    color: var(--color-white);
    box-shadow: 0 2px 8px rgba(229, 168, 77, 0.3);
}

/* 移動端語言切換器調整 */
@media (max-width: 768px) {
    .language-switcher {
        top: 10px;
        right: 10px;
        padding: 3px;
    }
    
    .lang-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}
