/**
 * ConTon - Styles
 * 
 * Apple 風格設計
 * - 簡約、現代、優雅
 * - 跟隨系統深色模式
 * - 響應式布局
 * 
 * 最後更新：2025-10-30
 * 版本：DEMO 1.0
 */

/* 全局設置 */
@import url('https://fonts.googleapis.com/css2?family=SF+Pro+Display:wght@300;400;500;600;700&family=SF+Pro+Text:wght@400;500;600&display=swap');

:root {
    /* Apple 風格顏色 - 深色主題（固定） */
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-card: rgba(28, 28, 30, 0.8);
    --text-primary: #f2f2f7;
    --text-secondary: #98989d;
    --accent-blue: #007aff;
    --accent-green: #34c759;
    --accent-orange: #ff9500;
    --accent-red: #ff3b30;

    /* 間距 */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* 圓角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* 陰影（深色模式） */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.8);

    /* 動畫 */
    --transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* 全局樣式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.status-bar,
.safe-area-bottom {
    height: env(safe-area-inset-top, 0);
}

.safe-area-bottom {
    height: env(safe-area-inset-bottom, 0);
}

.main-content {
    flex: 1;
    padding: var(--spacing-md);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* 頭部樣式 */
/* 頭部樣式 */
.app-header {
    margin-bottom: var(--spacing-lg);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 6px 10px;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    border: none;
    min-width: 0; /* Allow flex items to shrink */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0; /* Prevent actions from shrinking */
    min-width: 0; /* Allow flex items to shrink */
}

.lang-toggle-btn {
    min-width: 36px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0.0, 0.2, 1);
    padding: 0;
    flex-shrink: 0; /* Prevent language button from shrinking */
}

.lang-toggle-btn:hover {
    background: var(--bg-card);
    transform: scale(1.05);
}

.lang-toggle-btn:active {
    transform: scale(0.95);
}

.tab-panel-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.tab-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    align-items: stretch; /* Ensure all buttons have same height */
}

.tab-controls::before {
    content: '';
    position: absolute;
    top: 4px;
    /* Use CSS custom property for precise left position, fallback to calculated value */
    left: var(--active-tab-left, 4px);
    /* Use CSS custom property for precise width, fallback to calculated value */
    width: var(--active-tab-width, calc((100% - 20px) / 4));
    height: calc(100% - 8px);
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: left 0.4s cubic-bezier(0.4, 0.0, 0.2, 1), width 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: 0;
}

.tab-toggle {
    border: none;
    border-radius: var(--radius-lg);
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 8px 4px; /* Reduced horizontal padding for better fit */
    font-size: 12px; /* Slightly smaller font for better fit */
    /* text-transform: uppercase; */ /* Removed to show proper capitalization in English */
    cursor: pointer;
    transition: color 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    white-space: nowrap;
    position: relative;
    z-index: 1;
    text-align: center; /* Center align text */
    display: flex; /* Use flexbox for better alignment */
    align-items: center; /* Vertical center */
    justify-content: center; /* Horizontal center */
    min-width: 0; /* Allow text to shrink if needed */
    overflow: hidden; /* Hide overflow text */
    text-overflow: ellipsis; /* Show ellipsis if text is too long */
}

.tab-toggle.active {
    color: var(--text-primary);
}

.tab-panel-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    position: relative;
    min-height: 400px;
    overflow: hidden;
    touch-action: pan-y; /* 允许垂直滚动，但处理水平滑动 */
    -webkit-overflow-scrolling: touch;
}

.tab-panel {
    display: none;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    will-change: transform, opacity; /* 优化性能 */
}

.tab-panel.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
    position: relative;
    pointer-events: auto;
}

.tab-panel.exiting {
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.3s cubic-bezier(0.4, 0.0, 0.2, 1),
                transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Enhanced brick sliding animation for tab content */
.tab-panel.active:not(.initial-load) > * {
    animation: brickSlideIn 0.5s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

.tab-panel.exiting > * {
    animation: brickSlideOut 0.3s cubic-bezier(0.4, 0.0, 0.2, 1) forwards;
}

/* Stagger animation for child elements */
.tab-panel.active:not(.initial-load) > *:nth-child(1) { animation-delay: 0.05s; }
.tab-panel.active:not(.initial-load) > *:nth-child(2) { animation-delay: 0.1s; }
.tab-panel.active:not(.initial-load) > *:nth-child(3) { animation-delay: 0.15s; }
.tab-panel.active:not(.initial-load) > *:nth-child(4) { animation-delay: 0.2s; }
.tab-panel.active:not(.initial-load) > *:nth-child(5) { animation-delay: 0.25s; }
.tab-panel.active:not(.initial-load) > *:nth-child(n+6) { animation-delay: 0.3s; }

/* Initial load - no animation */
.tab-panel.active.initial-load > * {
    opacity: 1;
    animation: none;
}

/* Red Packet Tabs */
.red-packet-tabs {
    display: flex;
    gap: 8px;
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.red-packet-tab-btn {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.red-packet-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.red-packet-tab-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #ffffff;
}

.red-packet-panel {
    display: block;
}

.red-packet-panel[style*="display: none"] {
    display: none !important;
}

.red-packet-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
}

.red-packet-header {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.red-packet-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.red-packet-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--spacing-md);
}

/* Red Packet Amount and Count Grid - 响应式布局 */
.red-packet-amount-count-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

/* 移动端：确保输入框不会超出边缘 */
@media (max-width: 480px) {
    .red-packet-amount-count-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .red-packet-amount-count-grid .form-group {
        min-width: 0; /* 允许缩小 */
    }
    
    .red-packet-amount-count-grid .form-group input {
        width: 100%;
        box-sizing: border-box;
        padding: 10px 8px; /* 减小padding以适应小屏幕 */
    }
}

/* 超小屏幕：改为单列布局 */
@media (max-width: 360px) {
    .red-packet-amount-count-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

/* 移除最后一个form-group的margin-bottom */
.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.4px;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.form-group input,
.form-group select {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 12px var(--spacing-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-group input::-webkit-outer-spin-button,
.form-group input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-group input[type=number] {
    -moz-appearance: textfield;
}

.form-group select,
select.form-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 17px;
    font-family: inherit;
    padding: var(--spacing-md);
    width: 100%;
    transition: var(--transition);
    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 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--spacing-md) center;
    padding-right: calc(var(--spacing-md) + 20px);
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.red-packet-preview {
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: var(--spacing-md);
}

.preview-label {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 0.4px;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

.preview-content {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
}

.red-packet-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Distribution Toggle */
.red-packet-distribution-toggle {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 4px;
}

.distribution-toggle-btn {
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-lg) - 2px);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    height: 42px; /* Match input height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.distribution-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.distribution-toggle-btn.active {
    background: var(--accent-blue);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

/* Red Packet Sent List */
.red-packet-sent-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.red-packet-card {
    position: relative;
}

.red-packet-sent-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
}

.red-packet-sent-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateX(2px);
}

.red-packet-sent-item:active {
    transform: translateX(0);
    background: rgba(255, 255, 255, 0.06);
}

.red-packet-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.red-packet-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.red-packet-pagination button {
    padding: 8px 16px;
    min-width: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.red-packet-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.red-packet-pagination button:not(:disabled):hover {
    opacity: 0.8;
}

.red-packet-pagination #red-packet-page-info {
    color: var(--text-secondary);
    font-size: 14px;
    min-width: 60px;
    text-align: center;
}

.red-packet-actions .btn,
.red-packet-actions button {
    position: relative;
    overflow: hidden;
}

.red-packet-actions .btn::before,
.red-packet-actions button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: slidingBricks 3s infinite;
    z-index: 1;
    pointer-events: none;
}

.red-packet-feed {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.red-packet-feed-empty {
    font-size: 13px;
    color: var(--text-secondary);
}

.red-packet-item {
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.red-packet-item span {
    font-size: 13px;
    color: var(--text-primary);
}

.red-packet-item small {
    font-size: 11px;
    color: var(--text-secondary);
}

.red-packet-claim-card {
    /* margin-top removed to match other tab sections */
}

.red-packet-info {
    display: none;
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.red-packet-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.red-packet-info-item:last-child {
    border-bottom: none;
}

.red-packet-info-item span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.red-packet-info-item span:last-child {
    color: var(--text-primary);
    font-weight: 600;
}

/* Red packet claims list */
.red-packet-claims-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.red-packet-claim-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.red-packet-claim-item .claim-animal {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.red-packet-claim-item .claim-amount {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-green);
}

/* Red packet info modal styles - user-friendly design */
.red-packet-info-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.red-packet-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    font-size: 15px;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.red-packet-info-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.red-packet-info-item span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.red-packet-info-item span:last-child {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
    max-width: 60%;
}

.red-packet-status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.red-packet-status-badge.status-active {
    background: rgba(52, 199, 89, 0.2);
    color: var(--accent-green);
}

.red-packet-status-badge.status-completed {
    background: rgba(0, 122, 255, 0.2);
    color: var(--accent-blue);
}

.red-packet-status-badge.status-cancelled {
    background: rgba(255, 59, 48, 0.2);
    color: var(--accent-red);
}

.red-packet-status-badge.status-pending {
    background: rgba(255, 149, 0, 0.2);
    color: var(--accent-orange);
}

.red-packet-status-badge.status-archived {
    background: rgba(142, 142, 147, 0.2);
    color: var(--text-secondary);
}

/* Red packet sender address - clickable */
.red-packet-sender-address {
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.red-packet-sender-address:hover {
    opacity: 0.7;
}

/* Red packet claims list in modal - scrollable, unified style */
.red-packet-claims-list-modal {
    display: flex;
    flex-direction: column;
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-top: 1rem;
}

/* Custom scrollbar for claims list */
.red-packet-claims-list-modal::-webkit-scrollbar {
    width: 6px;
}

.red-packet-claims-list-modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.red-packet-claims-list-modal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.red-packet-claims-list-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Unified claims list container */
.red-packet-claims-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.red-packet-claim-item-modal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.875rem;
    background: transparent;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.red-packet-claim-item-modal:hover {
    background: rgba(255, 255, 255, 0.05);
}

.red-packet-claim-item-modal:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.625rem;
    margin-bottom: 0.25rem;
}

.red-packet-claim-item-modal .claim-animal-modal {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.red-packet-claim-item-modal .claim-amount-modal {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-green);
}

.tap-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    min-height: 220px;
}

.referral-card {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    position: relative;
}

/* 通用標籤頁覆蓋層樣式 */
.tab-overlay,
.referral-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.tab-overlay-content,
.referral-overlay-content {
    text-align: center;
    padding: var(--spacing-lg);
}

.tab-overlay-text,
.referral-overlay-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.referral-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.referral-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.referral-description {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.referral-current {
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.referral-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

.referral-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
}

.referral-code {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    transition: opacity 0.2s ease;
}

.referral-code[style*="cursor: pointer"]:hover {
    opacity: 0.8;
}

.referral-code[style*="cursor: pointer"]:active {
    opacity: 0.6;
}

.referral-bind {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.referral-bind-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--spacing-sm);
}

.referral-list {
    margin-top: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.referral-item {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.referral-item-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

.referral-date {
    font-size: 12px;
    color: var(--text-secondary);
}

.referral-note {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-secondary);
}

.referral-empty {
    font-size: 13px;
    color: var(--text-secondary);
}

.tap-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.tap-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.tap-button {
    margin-top: var(--spacing-xs);
}

.tap-address {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
}

.tap-address code {
    display: inline-block;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    font-family: var(--font-mono);
}

.tap-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tap-meter {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 6px;
}

.tap-meter-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #26c6ff, #5b8cff, #b43bff);
    transform-origin: left;
    transform: scaleX(1);
    transition: transform 0.3s ease;
}

.tap-meter-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.5px;
}

.tap-button {
    position: relative;
    overflow: hidden;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-xl);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tap-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: slidingBricks 2.5s infinite;
    z-index: 1;
}

.tap-button-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4), rgba(80, 170, 255, 0));
    opacity: 0.6;
    pointer-events: none;
    animation: tapGlow 3s ease-in-out infinite;
    z-index: 2;
}

.tap-button span {
    position: relative;
    z-index: 3;
}

.tap-button.active {
    transform: scale(0.96);
    box-shadow: 0 0 20px rgba(40, 150, 255, 0.6);
}

.tap-feedback {
    min-height: 32px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.2px;
    margin-top: var(--spacing-xs);
    position: relative;
    color: #dbe9ff;
    padding: 8px 12px;
    white-space: pre-wrap;
    word-break: break-word;
    transition: none;
}

.tap-feedback.visible {
    background: rgba(46, 125, 50, 0.16);
    border-radius: var(--radius-md);
    border: 1px solid rgba(46, 125, 50, 0.8);
    color: #e8f5e9;
    box-shadow: 0 0 12px rgba(46, 125, 50, 0.35);
}

.tap-spark {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    animation: tapFlash 0.7s ease-out forwards;
}

.tap-spark:nth-child(odd) {
    background: #5ff1ff;
}

@keyframes tapGlow {
    0% {
        transform: scale(0.7);
        opacity: 0.4;
    }
    50% {
        transform: scale(1);
        opacity: 0.65;
    }
    100% {
        transform: scale(0.7);
        opacity: 0.4;
    }
}

@keyframes tapSpark {
    0% {
        transform: translateY(0);
        opacity: 0;
    }
    30% {
        opacity: 1;
    }
    100% {
        transform: translateY(-10px);
        opacity: 0;
    }
}

@keyframes tapFlash {
    0% {
        opacity: 0;
        transform: scale(0.4);
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(15px, -20px) scale(0.6);
    }
}

.logo-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.app-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
}

.app-title {
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.5px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: var(--transition);
    min-width: 0; /* Allow text to truncate */
    flex-shrink: 1; /* Allow badge to shrink */
    max-width: 120px; /* Limit max width on mobile */
}

.user-badge:hover {
    background: rgba(255, 255, 255, 0.12);
}

.user-avatar {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin-right: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px; /* Limit name width on mobile */
}

.role-pill {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(5, 7, 18, 0.9);
    color: rgba(255, 255, 255, 0.8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.role-pill--outline {
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
}

.role-pill--primary {
    background: linear-gradient(135deg, #7b3cff, #4058ff);
    border-color: transparent;
    color: #ffffff;
}

.role-pill--warning {
    background: linear-gradient(135deg, #ffb63c, #ff8a00);
    border-color: transparent;
    color: #1b1305;
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-xs);
    min-width: 140px;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.user-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.user-menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.user-menu-item:active {
    background: rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* 玻璃卡片效果 */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

.accent-card {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.05) 0%, rgba(0, 122, 255, 0.02) 100%);
    border-color: rgba(0, 122, 255, 0.1);
}

/* 錢包卡片 */
.wallet-section {
    margin-bottom: var(--spacing-sm);
}

.wallet-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.card-content {
    flex: 1;
    min-width: 0;
}

.card-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.wallet-address {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.wallet-address:hover {
    opacity: 0.8;
}

.wallet-address:active {
    opacity: 0.6;
}

.wifi-status-icon {
    flex-shrink: 0;
    transition: color 0.3s ease;
    cursor: default;
    width: 28px;
    height: 28px;
}

.wifi-status-icon.wifi-connected {
    color: #10b981; /* Green for connected */
}

.wifi-status-icon.wifi-disconnected {
    color: #ef4444; /* Red for disconnected */
}

.icon-button {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    cursor: pointer;
    color: #ffffff;
    transition: var(--transition);
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.18);
}

.icon-button:active {
    transform: scale(0.95);
}

/* 餘額卡片 */
.balance-section {
    margin-bottom: var(--spacing-sm);
}

.balance-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.balance-icon-section {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.1), rgba(0, 122, 255, 0.05));
    border-radius: var(--radius-lg);
}

.balance-logo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.balance-info {
    flex: 1;
}

.balance-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.balance-main {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-xs);
}

.balance-value {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.balance-unit {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
}

.countdown {
    font-size: 13px;
    color: var(--accent-orange);
    margin-top: var(--spacing-xs);
    font-weight: 500;
    display: none;
}

.countdown.active {
    display: block;
}

/* 領取按鈕 */
.claim-section {
    margin-bottom: var(--spacing-sm);
}

.claim-btn {
    width: 100%;
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
    min-height: 100px;
    position: relative;
    overflow: hidden;
}

.claim-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: slidingBricks 3s infinite;
    z-index: 1;
}

.claim-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.claim-btn:disabled::before {
    animation: none;
}

.claim-btn:active:not(:disabled) {
    transform: scale(0.98);
}

@keyframes slidingBricks {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Tab switching brick animation */
@keyframes brickSlideIn {
    0% {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes brickSlideOut {
    0% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
    }
}

@keyframes brickSlideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.claim-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.claim-text {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-xs);
}

.primary-button {
    background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
    color: white;
    position: relative;
    overflow: hidden;
}

.primary-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: slidingBricks 3s infinite;
    z-index: 1;
    pointer-events: none;
}

.primary-button > * {
    position: relative;
    z-index: 2;
}

.primary-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #0051d5 0%, #003d99 100%);
    box-shadow: var(--shadow-lg);
}

.primary-button:disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-secondary) !important;
    color: var(--text-secondary) !important;
    pointer-events: none;
}

.secondary-button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.secondary-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* 領取記錄 */
.history-section {
    margin-bottom: var(--spacing-sm);
}

.section-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.section-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.claim-history {
    min-height: 120px;
    padding: var(--spacing-md);
}

.claim-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.claim-history-item:last-child {
    border-bottom: none;
}

.history-item-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.history-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.history-time {
    color: var(--text-secondary);
    font-size: 13px;
}

.history-placeholder {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    padding: var(--spacing-lg);
}

/* 模態彈窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: var(--spacing-md);
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    /* 限制最大高度為視窗的 90% */
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    animation: slideUp 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    /* 讓 header 和 body 垂直排列 */
    z-index: 1001;
    pointer-events: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    /* 防止 header 被壓縮 */
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    z-index: 1001;
    position: relative;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.close-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    /* 允許垂直滾動 */
    overflow-x: hidden;
    /* 隱藏水平滾動 */
    flex: 1;
    /* 佔據剩餘空間 */
    -webkit-overflow-scrolling: touch;
    /* iOS 平滑滾動 */
}

/* 自定義滾動條樣式（WebKit 瀏覽器） */
/* URL Modal 專用樣式 */
.url-modal-content {
    width: 90vw;
    max-width: 900px;
    height: 85vh;
    max-height: 800px;
}

.url-modal-body {
    padding: 0;
    height: calc(100% - 60px); /* 減去 header 高度 */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.url-modal-body iframe {
    flex: 1;
    min-height: 0;
}

@media (max-width: 768px) {
    .url-modal-content {
        width: 95vw;
        height: 90vh;
    }
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 表單樣式 */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    font-size: 17px;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
}

.form-input:focus,
select.form-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: white;
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.form-input.invalid {
    border-color: #ff3b30;
    background: #ffebee;
    color: #000000 !important;
    /* 確保文字顏色深色，容易閱讀 */
}

.form-input.invalid:focus {
    border-color: #ff3b30;
    background: #ffffff;
    color: #000000 !important;
    /* 確保焦點時文字也是深色 */
}

.validation-message {
    margin-top: var(--spacing-xs);
    font-size: 12px;
    color: #ff3b30;
    line-height: 1.4;
    min-height: 16px;
}

.form-hint {
    margin-top: var(--spacing-xs);
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.form-error {
    margin-top: var(--spacing-xs);
    font-size: 12px;
    color: var(--accent-red);
    line-height: 1.4;
}

.form-textarea {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 96px;
    resize: vertical;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: white;
}

.restore-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    max-height: 70vh;
    overflow-y: auto;
}

.restore-section {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.restore-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.restore-status {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-line;
    word-break: break-all;
    overflow-wrap: anywhere;
}

.restore-party-id {
    display: block;
    margin-top: var(--spacing-xs);
    font-family: monospace;
    color: var(--text-primary);
}

.restore-status.success {
    border-color: rgba(76, 175, 80, 0.4);
    background: rgba(76, 175, 80, 0.12);
    color: #2e7d32;
}

.restore-status.warning {
    border-color: rgba(255, 193, 7, 0.4);
    background: rgba(255, 193, 7, 0.12);
    color: #8a6d3b;
}

.restore-status.error {
    border-color: rgba(244, 67, 54, 0.4);
    background: rgba(244, 67, 54, 0.1);
    color: #c62828;
}

.restore-status.neutral {
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.restore-divider {
    height: 1px;
    background: var(--border-color);
    opacity: 0.6;
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xl);
}

.btn {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    border: none;
    outline: none;
}

/* Toast 通知 */
.toast {
    position: fixed;
    bottom: calc(var(--spacing-lg) + env(safe-area-inset-bottom, 0));
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    max-width: calc(100% - var(--spacing-xl));
    text-align: center;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.attention {
    animation: attentionPulse 0.6s ease-in-out 3;
}

@keyframes attentionPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(0, 128, 255, 0);
    }

    50% {
        transform: scale(1.02);
        box-shadow: 0 0 12px rgba(0, 128, 255, 0.35);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(0, 128, 255, 0);
    }
}

.toast.success {
    background: rgba(76, 175, 80, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.toast.error {
    background: rgba(244, 67, 54, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.toast.warning {
    background: rgba(255, 152, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 152, 0, 0.3);
}
.toast.info {
    background: rgba(46, 125, 50, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #e8f5e9;
    text-align: left;
    border: 1px solid rgba(46, 125, 50, 0.3);
}

.small-modal {
    max-width: 360px;
    width: 90%;
}

.modal .small-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* 響應式調整 */
@media (max-width: 480px) {
    .header-top {
        gap: 4px;
        padding: 6px 8px;
    }
    
    .header-actions {
        gap: 3px;
    }
    
    .user-badge {
        padding: 4px 6px;
        max-width: 100px;
    }
    
    .user-name {
        font-size: 12px;
        max-width: 80px;
    }
    
    .user-avatar {
        width: 20px;
        height: 20px;
        min-width: 20px;
        margin-right: 4px;
    }
    
    .lang-toggle-btn {
        min-width: 32px;
        width: 32px;
        height: 32px;
        font-size: 11px;
    }
    
    .icon-button {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }
    
    /* 移动端：调整红包卡片padding，确保内容不超出边缘 */
    .red-packet-card {
        padding: var(--spacing-md);
    }
}

@media (max-width: 360px) {
    .app-title {
        font-size: 20px;
    }

    .balance-value {
        font-size: 28px;
    }

    .form-actions {
        grid-template-columns: 1fr;
    }
    
    .user-badge {
        max-width: 80px;
    }
    
    .user-name {
        max-width: 60px;
        font-size: 11px;
    }
    
    .user-avatar {
        width: 18px;
        height: 18px;
        min-width: 18px;
        margin-right: 3px;
    }
}

/* 深色模式樣式（已設為默認，永遠使用深色模式） */
    .glass-card {
        background: rgba(28, 28, 30, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .icon-button {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .form-input {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
    }

    .form-input:focus {
        background: var(--bg-secondary);
    }

    .secondary-button {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .modal-backdrop {
        background: rgba(0, 0, 0, 0.6);
    }

    .user-badge {
        background: rgba(255, 255, 255, 0.1);
}

/* 驗證輸入框樣式 */
.verify-input {
    font-family: monospace;
    font-size: 14px;
}

.verify-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

#verification-error {
    animation: shake 0.3s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* 私鑰顯示區域 */
#mnemonic-display {
    user-select: all;
    -webkit-user-select: all;
    -moz-user-select: all;
    -ms-user-select: all;
    cursor: text;
    white-space: pre-wrap;
}

#mnemonic-display:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}