/* iOS 18 Style - Modern Glassmorphism Design */

/* CSS Variables - iOS 18 Design Tokens */
:root {
    /* iOS 18 System Colors */
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-indigo: #5856D6;
    --ios-orange: #FF9500;
    --ios-pink: #FF2D55;
    --ios-purple: #AF52DE;
    --ios-red: #FF3B30;
    --ios-teal: #5AC8FA;
    --ios-yellow: #FFCC00;
    
    /* iOS 18 Gray Scale */
    --ios-gray: #8E8E93;
    --ios-gray-2: #AEAEB2;
    --ios-gray-3: #C7C7CC;
    --ios-gray-4: #D1D1D6;
    --ios-gray-5: #E5E5EA;
    --ios-gray-6: #F2F2F7;
    
    /* Background & Surface */
    --ios-bg: #F2F2F7;
    --ios-surface: #FFFFFF;
    --ios-surface-secondary: rgba(255, 255, 255, 0.8);
    
    /* iOS 18 Radius - More Rounded */
    --ios-radius-xs: 8px;
    --ios-radius-sm: 12px;
    --ios-radius-md: 16px;
    --ios-radius-lg: 22px;
    --ios-radius-xl: 28px;
    --ios-radius-2xl: 36px;
    --ios-radius-full: 9999px;
    
    /* Glass Effect */
    --ios-blur: 30px;
    --ios-blur-heavy: 50px;
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    
    /* Shadows - iOS 18 Soft Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.16);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.08);
    
    /* Safe Area */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --ios-bg: #000000;
        --ios-surface: #1C1C1E;
        --ios-surface-secondary: rgba(28, 28, 30, 0.8);
        --glass-bg: rgba(28, 28, 30, 0.72);
        --glass-border: rgba(255, 255, 255, 0.1);
        --ios-gray-6: #2C2C2E;
    }
}

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

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    background: linear-gradient(180deg, #E8E8ED 0%, #F2F2F7 50%, #E8E8ED 100%);
    background-attachment: fixed;
    color: #000000;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.47;
    min-height: 100vh;
    padding: calc(16px + var(--safe-area-top)) 16px calc(24px + var(--safe-area-bottom));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iOS 18 Background Gradient Animation */
.ios-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(88, 86, 214, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(0, 122, 255, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 45, 85, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* ============================================
   Dynamic Island Style Toolbar
   ============================================ */
.toolbar {
    position: fixed;
    top: calc(12px + var(--safe-area-top));
    left: 16px;
    right: 16px;
    z-index: 1000;
    display: flex;
    justify-content: center;
}

.dynamic-island {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(var(--ios-blur-heavy));
    -webkit-backdrop-filter: blur(var(--ios-blur-heavy));
    border-radius: var(--ios-radius-full);
    padding: 8px 12px;
    min-width: 320px;
    max-width: 500px;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all var(--transition-spring);
}

.dynamic-island:hover {
    transform: scale(1.01);
}

/* 页面标题 */
.page-title {
    font-size: 17px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.3px;
    cursor: text;
    padding: 6px 12px;
    border-radius: var(--ios-radius-sm);
    border: 2px solid transparent;
    background: transparent;
    outline: none;
    min-width: 80px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    transition: all var(--transition-fast);
}

.page-title:hover {
    background: rgba(255, 255, 255, 0.1);
}

.page-title:focus {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

/* 导航按钮组 */
.nav-buttons {
    display: flex;
    align-items: center;
    gap: 2px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: #FFFFFF;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--ios-radius-full);
    transition: all var(--transition-fast);
    letter-spacing: -0.2px;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.nav-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

/* ============================================
   Main Board Container
   ============================================ */
#board {
    margin-top: 70px;
    padding-bottom: 40px;
}

/* Row Wrapper */
.row-wrapper {
    margin-bottom: 0;
}

.row-wrapper:not(:first-child) {
    margin-top: 16px;
}

/* Add Row Button Container */
.add-row-before {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

/* iOS 18 Style Add Button */
.add-row-btn,
.add-card-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--ios-blur));
    -webkit-backdrop-filter: blur(var(--ios-blur));
    border: 1px solid var(--glass-border);
    color: var(--ios-blue);
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--ios-radius-lg);
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.add-row-btn {
    padding: 14px 32px;
    font-size: 15px;
    gap: 6px;
}

.add-card-btn {
    width: 56px;
    height: 80px;
    min-width: 56px;
    font-size: 24px;
    border-radius: var(--ios-radius-md);
    margin-right: 8px;
}

.add-row-btn:hover,
.add-card-btn:hover {
    background: rgba(0, 122, 255, 0.12);
    border-color: rgba(0, 122, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.add-row-btn:active,
.add-card-btn:active {
    transform: scale(0.96);
}

/* ============================================
   iOS 18 Style Row / Card Group
   ============================================ */
.row {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--ios-blur));
    -webkit-backdrop-filter: blur(var(--ios-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--ios-radius-xl);
    padding: 16px;
    position: relative;
    min-height: 120px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.row:hover {
    box-shadow: var(--shadow-xl);
}

/* Row Header */
.row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    gap: 12px;
}

/* Row Title - iOS 18 Style */
.row-title {
    font-size: 18px;
    font-weight: 700;
    font-family: "SF Pro Display", -apple-system, sans-serif;
    letter-spacing: -0.4px;
    cursor: pointer;
    padding: 8px 12px;
    border: 2px solid transparent;
    border-radius: var(--ios-radius-sm);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all var(--transition-fast);
    background: transparent;
    color: #000000;
}

.row-title:hover {
    background: rgba(0, 0, 0, 0.04);
}

.row-title:focus {
    outline: none;
    border-color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.08);
}

/* Delete Row Button - iOS 18 Destructive Style */
.delete-row-btn {
    background: rgba(255, 59, 48, 0.12);
    border: none;
    color: var(--ios-red);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--ios-radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.delete-row-btn:hover {
    background: var(--ios-red);
    color: white;
}

.delete-row-btn:active {
    transform: scale(0.95);
}

/* Cards Container */
.cards-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    align-items: flex-start;
    min-height: 88px;
    overflow-x: auto;
    padding: 12px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.cards-container::-webkit-scrollbar {
    display: none;
}

/* ============================================
   iOS 18 Style Card
   ============================================ */
.card {
    background: #FFFFFF;
    border-radius: var(--ios-radius-lg);
    padding: 14px;
    min-width: 110px;
    max-width: 150px;
    width: 120px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-card);
    border: none;
    margin-left: 24px; /* 卡片间距 */
}

/* 第一张卡片不需要左边距 */
.card:first-of-type {
    margin-left: 0;
}

.card:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 8px 24px rgba(0, 0, 0, 0.12);
}

.card:active {
    transform: scale(0.97);
}

/* Card Connector - 卡片连接线 */
.card-connector-wrapper {
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
}

.card-connector {
    width: 20px;
    height: 4px;
    border-radius: 2px;
}

.card-connector.positive {
    background: linear-gradient(90deg, #34C759 0%, #30D158 100%);
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.4);
}

.card-connector.negative {
    background: linear-gradient(90deg, #FF3B30 0%, #FF453A 100%);
    box-shadow: 0 2px 6px rgba(255, 59, 48, 0.4);
}

/* 警告标识 - 故事不连贯 */
.card-connector-warning {
    font-size: 16px;
    line-height: 1;
    animation: warningPulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(255, 150, 0, 0.5));
}

@keyframes warningPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Polarity Symbols - iOS 18 Pill Style */
.card-polarity {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
}

.card-polarity.left {
    position: absolute;
    left: -16px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 4px;
}

.card-polarity.right {
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    flex-direction: column;
    gap: 4px;
}

.card-polarity.top {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
}

/* 基础极性符号样式 */
.polarity-symbol {
    cursor: pointer;
    padding: 4px 6px;
    border-radius: var(--ios-radius-full);
    transition: all var(--transition-fast);
    font-size: 11px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* 加号 - 绿色（积极情绪） */
.polarity-symbol.positive {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    color: white;
    border: none;
}

.polarity-symbol.positive:hover {
    background: linear-gradient(135deg, #2DB94E 0%, #28B84D 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.4);
}

/* 减号 - 红色（消极情绪） */
.polarity-symbol.negative {
    background: linear-gradient(135deg, #FF3B30 0%, #FF453A 100%);
    color: white;
    border: none;
}

.polarity-symbol.negative:hover {
    background: linear-gradient(135deg, #E5352B 0%, #E53935 100%);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.4);
}

/* 中间(顶部)极性符号 - 特别大 */
.card-polarity.top .polarity-symbol {
    width: 36px;
    height: 36px;
    font-size: 20px;
    font-weight: 800;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.card-polarity.top .polarity-symbol.positive {
    box-shadow: 0 4px 20px rgba(52, 199, 89, 0.5);
}

.card-polarity.top .polarity-symbol.negative {
    box-shadow: 0 4px 20px rgba(255, 59, 48, 0.5);
}

.polarity-symbol:active {
    transform: scale(0.9);
}

/* Card Small Title */
.card-small-title {
    font-size: 14px;
    font-weight: 600;
    font-family: "SF Pro Text", -apple-system, sans-serif;
    letter-spacing: -0.2px;
    text-align: center;
    word-break: break-word;
    line-height: 1.35;
    color: #000000;
    padding: 10px 0 4px;
}

/* Delete Card Button - iOS 18 Style */
.delete-card-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--ios-red) 0%, #FF6B6B 100%);
    border: 2px solid #FFFFFF;
    color: white;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
}

.card:hover .delete-card-btn {
    display: flex;
}

.delete-card-btn:hover {
    transform: scale(1.1);
}

.delete-card-btn:active {
    transform: scale(0.9);
}

/* ============================================
   iOS 18 Style Modal
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: calc(var(--safe-area-top) + 20px);
    padding-bottom: calc(var(--safe-area-bottom) + 20px);
}

.modal.show {
    display: flex;
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Content - iOS 18 Glass Card */
.modal-content.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--ios-blur-heavy));
    -webkit-backdrop-filter: blur(var(--ios-blur-heavy));
    padding: 24px;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: var(--ios-radius-2xl);
    border: 1px solid var(--glass-border);
    animation: modalSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.modal-header {
    margin-bottom: 20px;
}

/* Polarity Group in Modal */
.polarity-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: var(--ios-radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.polarity-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.polarity-label {
    font-size: 13px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.5);
}

.pol-btn {
    width: 56px;
    height: 56px;
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition-fast);
    font-family: inherit;
    border: none;
    color: white;
}

/* 加号 - 绿色 */
.pol-btn.positive {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    box-shadow: 0 4px 14px rgba(52, 199, 89, 0.35);
}

.pol-btn.positive:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.45);
}

/* 减号 - 红色 */
.pol-btn.negative {
    background: linear-gradient(135deg, #FF3B30 0%, #FF453A 100%);
    box-shadow: 0 4px 14px rgba(255, 59, 48, 0.35);
}

.pol-btn.negative:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.45);
}

.pol-btn:active {
    transform: scale(0.92);
}

/* Input Stack - iOS 18 Style */
.input-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.input-stack input,
.input-stack textarea {
    width: 100%;
    padding: 16px;
    border: none;
    font-size: 17px;
    font-family: inherit;
    background: rgba(0, 0, 0, 0.03);
    color: #000000;
    border-radius: var(--ios-radius-md);
    transition: all var(--transition-fast);
    resize: none;
}

.input-stack input:focus,
.input-stack textarea:focus {
    outline: none;
    background: rgba(0, 122, 255, 0.08);
    box-shadow: inset 0 0 0 2px var(--ios-blue);
}

.input-stack input::placeholder,
.input-stack textarea::placeholder {
    color: var(--ios-gray);
}

#bigTitleInput {
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.4px;
}

#contentInput {
    min-height: 100px;
    line-height: 1.5;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* iOS 18 Style Buttons */
.ios-btn {
    padding: 14px 28px;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--ios-radius-md);
    transition: all var(--transition-fast);
    letter-spacing: -0.3px;
}

.ios-btn.primary {
    background: linear-gradient(135deg, var(--ios-blue) 0%, #4799FF 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
}

.ios-btn.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.45);
}

.ios-btn.primary:active {
    transform: scale(0.97);
}

.ios-btn.secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--ios-blue);
}

.ios-btn.secondary:hover {
    background: rgba(0, 0, 0, 0.08);
}

.ios-btn.danger {
    background: linear-gradient(135deg, var(--ios-red) 0%, #FF6B6B 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(255, 59, 48, 0.35);
}

.ios-btn.danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 59, 48, 0.45);
}

.ios-btn.full {
    width: 100%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--ios-blue);
}

.ios-btn.full:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ============================================
   Confirm Modal - iOS 18 Alert Style
   ============================================ */
.confirm-box.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--ios-blur-heavy));
    -webkit-backdrop-filter: blur(var(--ios-blur-heavy));
    padding: 24px;
    border-radius: var(--ios-radius-2xl);
    border: 1px solid var(--glass-border);
    text-align: center;
    max-width: 280px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-box p {
    margin-bottom: 20px;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.4;
    color: #000000;
}

.confirm-row {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* ============================================
   Theme Modal - iOS 18 Action Sheet Style
   ============================================ */
.theme-sheet.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--ios-blur-heavy));
    -webkit-backdrop-filter: blur(var(--ios-blur-heavy));
    padding: 20px;
    border-radius: var(--ios-radius-2xl);
    border: 1px solid var(--glass-border);
    width: 100%;
    max-width: 340px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    animation: modalSlideUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-sheet .handle {
    width: 36px;
    height: 5px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--ios-radius-full);
    margin: 0 auto 16px;
}

.theme-sheet h3 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 700;
    font-family: "SF Pro Display", -apple-system, sans-serif;
    letter-spacing: -0.4px;
    color: #000000;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.theme-option {
    cursor: pointer;
    padding: 10px;
    border-radius: var(--ios-radius-lg);
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    background: rgba(0, 0, 0, 0.02);
}

.theme-option:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.02);
}

.theme-option.active {
    border-color: var(--ios-blue);
    background: rgba(0, 122, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

.theme-preview {
    width: 100%;
    height: 54px;
    border-radius: var(--ios-radius-sm);
    margin-bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.theme-option span {
    font-size: 12px;
    font-weight: 600;
    color: #000000;
    display: block;
    text-align: center;
}

/* Theme Preview Gradients */
.wood-preview {
    background: linear-gradient(180deg, #DEB887 0%, #DEB887 33%, #0000FF 33%, #0000FF 66%, #FFFFFF 66%, #FFFFFF 100%);
}

.blue-preview {
    background: linear-gradient(180deg, #0000FF 0%, #0000FF 33%, #4169E1 33%, #4169E1 66%, #FFFFFF 66%, #FFFFFF 100%);
}

.dark-preview {
    background: linear-gradient(180deg, #1A1A1A 0%, #1A1A1A 33%, #3D3D3D 33%, #3D3D3D 66%, #5A5A5A 66%, #5A5A5A 100%);
}

.light-preview {
    background: linear-gradient(180deg, #FFFF8D 0%, #FFFF8D 33%, #FFEB3B 33%, #FFEB3B 66%, #FFFFFF 66%, #FFFFFF 100%);
}

.pink-preview {
    background: linear-gradient(180deg, #FFE4E1 0%, #FFE4E1 33%, #DB7093 33%, #DB7093 66%, #FFFFFF 66%, #FFFFFF 100%);
}

.green-preview {
    background: linear-gradient(180deg, #90EE90 0%, #90EE90 33%, #228B22 33%, #228B22 66%, #FFFFFF 66%, #FFFFFF 100%);
}

/* ============================================
   Sortable Styles
   ============================================ */
.sortable-ghost {
    opacity: 0.4;
}

.sortable-drag {
    opacity: 0.95;
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
}

.card.sortable-ghost {
    background: rgba(0, 122, 255, 0.15);
}

/* ============================================
   Responsive Design - iOS 18 Adaptive
   ============================================ */

/* Extra Small Devices */
@media screen and (max-width: 374px) {
    body {
        padding: calc(12px + var(--safe-area-top)) 12px calc(20px + var(--safe-area-bottom));
    }
    
    .dynamic-island {
        padding: 4px 6px;
    }
    
    .nav-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .row {
        padding: 14px;
        border-radius: var(--ios-radius-xl);
    }
    
    .row-title {
        font-size: 16px;
    }
    
    .card {
        min-width: 95px;
        max-width: 120px;
        width: 100px;
        padding: 12px;
    }
    
    .add-card-btn {
        width: 48px;
        height: 70px;
        min-width: 48px;
    }
    
    .modal-content.glass {
        padding: 20px;
    }
    
    .ios-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* Small to Medium Devices */
@media screen and (min-width: 375px) and (max-width: 767px) {
    body {
        padding: calc(14px + var(--safe-area-top)) 16px calc(20px + var(--safe-area-bottom));
    }
    
    #board {
        margin-top: 75px;
    }
    
    .card {
        min-width: 100px;
        max-width: 130px;
        width: 110px;
    }
}

/* Tablet and Desktop */
@media screen and (min-width: 768px) {
    body {
        padding: calc(24px + var(--safe-area-top)) 32px calc(32px + var(--safe-area-bottom));
        max-width: 1100px;
        margin: 0 auto;
    }
    
    #board {
        margin-top: 85px;
    }
    
    .row {
        padding: 20px;
    }
    
    .cards-container {
        flex-wrap: wrap;
        overflow-x: visible;
    }
    
    .card {
        min-width: 125px;
        max-width: 165px;
        width: 140px;
    }
    
    .modal-content.glass {
        padding: 28px;
    }
    
    .theme-sheet.glass {
        max-width: 380px;
    }
}

/* Landscape Mode */
@media screen and (orientation: landscape) and (max-height: 500px) {
    body {
        padding: calc(8px + var(--safe-area-top)) 16px calc(12px + var(--safe-area-bottom));
    }
    
    #board {
        margin-top: 55px;
    }
    
    .row {
        padding: 12px;
        min-height: 100px;
    }
    
    .modal-content.glass {
        max-height: 80vh;
        padding: 20px;
    }
}

/* ============================================
   Accessibility & Focus States
   ============================================ */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--ios-blue);
    outline-offset: 2px;
}

/* Safe Area Support for iPhone X+ */
@supports (padding: max(0px)) {
    body {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}