@import url('https://fonts.googleapis.com/css2?family=Chiron+GoRound+TC:wght@400;500;600;700&display=swap');

:root {
    --bg-base: #e8eaf0;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --tertiary: #7c3aed;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0284c7;

    /* Neomorphic Shadows */
    --shadow-raised: 6px 6px 14px rgba(0, 0, 0, 0.08), -6px -6px 14px rgba(255, 255, 255, 0.7);
    --shadow-raised-sm: 3px 3px 8px rgba(0, 0, 0, 0.06), -3px -3px 8px rgba(255, 255, 255, 0.65);
    --shadow-raised-lg: 10px 10px 24px rgba(0, 0, 0, 0.1), -10px -10px 24px rgba(255, 255, 255, 0.8);
    --shadow-inset: inset 4px 4px 8px rgba(0, 0, 0, 0.06), inset -4px -4px 8px rgba(255, 255, 255, 0.55);
    --shadow-inset-sm: inset 2px 2px 5px rgba(0, 0, 0, 0.05), inset -2px -2px 5px rgba(255, 255, 255, 0.5);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Chiron GoRound TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

/* 容器與版面 */
.container {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

.main-content {
    flex: 1;
    width: 100%;
    padding: 1.5rem 0 3rem 0;
}

/* 標題排版 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
}

h1 { font-size: 1.75rem; margin-bottom: 0.75rem; }
h2 { font-size: 1.35rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }

p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Neomorphic 卡片元件 */
.neo-card {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.neo-card-sm {
    padding: 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raised-sm);
}

.neo-card-lg {
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-raised-lg);
}

.neo-inset-card {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

/* Neomorphic 按鈕 */
.neo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--bg-base);
    color: var(--text-main);
    border: none;
    outline: none;
    border-radius: var(--radius-sm);
    padding: 0.65rem 1.25rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-raised-sm);
    transition: all 0.15s ease;
    user-select: none;
    text-decoration: none;
}

.neo-btn:hover {
    box-shadow: var(--shadow-raised);
    transform: translateY(-1px);
    color: var(--primary);
}

.neo-btn:active, .neo-btn.active {
    box-shadow: var(--shadow-inset-sm);
    transform: translateY(0);
    color: var(--primary-dark);
}

.neo-btn-primary {
    color: var(--primary);
    font-weight: 600;
}
.neo-btn-primary:hover {
    color: var(--primary-dark);
}

.neo-btn-accent {
    color: var(--tertiary);
    font-weight: 600;
}

.neo-btn-danger {
    color: var(--danger);
}
.neo-btn-danger:hover {
    color: #dc2626;
}

.neo-btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

.neo-btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

.neo-btn-block {
    display: flex;
    width: 100%;
}

.neo-btn-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    padding: 0;
}

/* Neomorphic 表單輸入框 */
.neo-input-group {
    margin-bottom: 1.25rem;
}

.neo-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.4rem;
}

.neo-label .required {
    color: var(--danger);
    margin-left: 0.2rem;
}

.neo-input, .neo-textarea, .neo-select {
    width: 100%;
    background-color: var(--bg-base);
    color: var(--text-main);
    border: none;
    outline: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    box-shadow: var(--shadow-inset);
    transition: box-shadow 0.2s ease;
}

.neo-input:focus, .neo-textarea:focus, .neo-select:focus {
    box-shadow: inset 5px 5px 10px rgba(0, 0, 0, 0.08), inset -5px -5px 10px rgba(255, 255, 255, 0.6), 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.neo-textarea {
    resize: vertical;
    min-height: 90px;
}

.neo-char-counter {
    display: flex;
    justify-content: flex-end;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.neo-char-counter.warning {
    color: var(--warning);
}
.neo-char-counter.danger {
    color: var(--danger);
    font-weight: 600;
}

/* 題目選項卡片 (單選/多選/Boolean) */
.neo-option-item {
    display: flex;
    align-items: center;
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised-sm);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.15rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.neo-option-item:hover {
    box-shadow: var(--shadow-raised);
}

.neo-option-item.selected {
    box-shadow: var(--shadow-inset);
    color: var(--primary);
    font-weight: 600;
}

.neo-option-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 0.85rem;
    box-shadow: var(--shadow-inset-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.neo-option-item.selected .neo-option-indicator {
    background-color: var(--primary);
    box-shadow: none;
}

.neo-option-indicator-inner {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #fff;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.neo-option-item.selected .neo-option-indicator-inner {
    opacity: 1;
}

/* 多選方塊 Indicator */
.neo-option-checkbox-indicator {
    border-radius: 6px;
}

/* Boolean 雙按鈕 Toggle */
.neo-boolean-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.neo-boolean-btn {
    text-align: center;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raised-sm);
    cursor: pointer;
    background-color: var(--bg-base);
    transition: all 0.15s ease;
}

.neo-boolean-btn:hover {
    box-shadow: var(--shadow-raised);
}

.neo-boolean-btn.selected {
    box-shadow: var(--shadow-inset);
    color: var(--primary);
}

/* 狀態 Badge 標籤 */
.neo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-inset-sm);
    background-color: var(--bg-base);
    color: var(--text-muted);
}

.neo-badge-primary { color: var(--primary); }
.neo-badge-success { color: var(--success); }
.neo-badge-warning { color: var(--warning); }
.neo-badge-danger { color: var(--danger); }
.neo-badge-tertiary { color: var(--tertiary); }

/* 回覆者識別標籤 (Tags) */
.neo-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised-sm);
    border-radius: 10px;
    padding: 0.25rem 0.65rem;
    font-size: 0.82rem;
    color: var(--tertiary);
    font-weight: 500;
}

.neo-tag-remove {
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.15s ease;
}
.neo-tag-remove:hover {
    color: var(--danger);
}

/* 頂部導航 Header */
.neo-header {
    background-color: var(--bg-base);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.neo-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.neo-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.neo-brand-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset-sm);
    color: var(--tertiary);
}

.neo-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 底部 Footer */
.neo-footer {
    background-color: var(--bg-base);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-light);
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    margin-top: auto;
}

/* Mock 工具列 (開發環境身分切換) */
.neo-mock-bar {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset-sm);
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px dashed rgba(99, 102, 241, 0.3);
}

.neo-mock-title {
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.neo-mock-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Alert 提示訊息 */
.neo-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset);
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
}

.neo-alert-info { color: var(--info); }
.neo-alert-success { color: var(--success); }
.neo-alert-warning { color: var(--warning); }
.neo-alert-danger { color: var(--danger); }

/* Modal 彈出視窗 */
.neo-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(232, 234, 240, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.neo-modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.neo-modal {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised-lg);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.neo-modal-backdrop.open .neo-modal {
    transform: scale(1);
}

.neo-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.neo-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Toast 提示 */
.neo-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 2000;
}

.neo-toast {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised-lg);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1.25rem;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: toastSlideIn 0.3s ease forwards;
}

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

/* 分享訊息預覽卡片 (LINE 訊息風格) */
.neo-share-preview {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.neo-share-bubble {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    max-width: 380px;
    margin: 0 auto;
}

.neo-share-bubble-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.neo-share-bubble-body {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    white-space: pre-wrap;
}

/* Tab 導航元件 */
.neo-tabs {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
}

.neo-tab-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background-color: var(--bg-base);
    color: var(--text-muted);
    border: none;
    outline: none;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-raised-sm);
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.15s ease;
    user-select: none;
}

.neo-tab-item:hover {
    box-shadow: var(--shadow-raised);
    transform: translateY(-1px);
    color: var(--primary);
}

.neo-tab-item:active, .neo-tab-item.active {
    box-shadow: var(--shadow-inset-sm);
    transform: translateY(0);
    color: var(--primary);
    font-weight: 600;
}

.neo-tab-item.active:hover {
    box-shadow: var(--shadow-inset-sm);
    transform: none;
}

/* 統計指標卡片網格 */
.neo-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.neo-stat-card {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised-sm);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.neo-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-raised);
}

.neo-stat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.neo-stat-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset-sm);
}

.neo-stat-value {
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

.neo-stat-sub {
    font-size: 0.78rem;
    color: var(--text-light);
}

/* 分析進度長條圖 (Progress / Distribution) */
.neo-progress-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1rem;
}

.neo-progress-item {
    background-color: var(--bg-base);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raised-sm);
    transition: all 0.15s ease;
}

.neo-progress-item.highest {
    box-shadow: var(--shadow-raised);
    border-left: 3px solid var(--primary);
}

.neo-progress-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.45rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.neo-progress-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.neo-progress-pct {
    font-weight: 700;
    color: var(--primary);
}

.neo-progress-track {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset-sm);
    border-radius: var(--radius-full);
    height: 10px;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.neo-progress-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.neo-progress-fill.highest {
    background: linear-gradient(90deg, var(--tertiary), var(--primary));
}

.neo-progress-fill.positive {
    background: linear-gradient(90deg, #34d399, var(--success));
}

.neo-progress-fill.negative {
    background: linear-gradient(90deg, #f87171, var(--danger));
}

/* Boolean 雙向比例對比卡 */
.neo-bool-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.neo-bool-stat-card {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised-sm);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.neo-bool-stat-card.pos {
    border-top: 3px solid var(--success);
}

.neo-bool-stat-card.neg {
    border-top: 3px solid var(--danger);
}

.neo-bool-title {
    font-size: 0.95rem;
    font-weight: 600;
}

.neo-bool-val {
    font-size: 1.5rem;
    font-weight: 700;
}

.neo-bool-val.pos { color: var(--success); }
.neo-bool-val.neg { color: var(--danger); }

/* 簡答題文字回覆氣泡清單 */
.neo-text-answers-stream {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 420px;
    overflow-y: auto;
    padding: 0.5rem 0.25rem;
    margin-top: 1rem;
}

.neo-text-answer-card {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised-sm);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.neo-text-answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.neo-text-answer-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
}

.neo-text-answer-body {
    font-size: 0.92rem;
    color: var(--text-main);
    white-space: pre-wrap;
    background-color: var(--bg-base);
    box-shadow: var(--shadow-inset-sm);
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    line-height: 1.5;
}

/* 資料表格 (Table View) */
.neo-table-card {
    background-color: var(--bg-base);
    box-shadow: var(--shadow-raised);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.neo-table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.neo-table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-inset-sm);
    padding: 0.25rem;
    background-color: var(--bg-base);
}

.neo-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
    min-width: 600px;
}

.neo-table th {
    background-color: var(--bg-base);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.85rem 1rem;
    text-align: left;
    white-space: nowrap;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
}

.neo-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    vertical-align: middle;
    color: var(--text-main);
}

.neo-table tr:last-child td {
    border-bottom: none;
}

.neo-table tr:hover td {
    background-color: rgba(99, 102, 241, 0.03);
}

.neo-table-user-cell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    white-space: nowrap;
}

.neo-table-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-raised-sm);
    overflow: hidden;
    flex-shrink: 0;
}

.neo-table-pill {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    box-shadow: var(--shadow-inset-sm);
    background-color: var(--bg-base);
    color: var(--primary);
    font-weight: 500;
    margin: 0.15rem 0.15rem 0.15rem 0;
}

/* 響應式調整 */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }
    .neo-card {
        padding: 1.25rem;
        border-radius: var(--radius-sm);
    }
    .neo-modal {
        padding: 1.25rem;
        border-radius: var(--radius-md);
    }
    .neo-boolean-group {
        grid-template-columns: 1fr;
    }
    .neo-toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
}