:root {
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --accent-blue: #3498db;
    --accent-dark: #2980b9;
    --border-color: #dcdde1;
    --success-green: #2ecc71;
    --danger-red: #e74c3c;
    --op-orange: #d35400;
}
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}
body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    user-select: none;
    touch-action: manipulation;
}
header {
    background-color: #2c3e50;
    color: white;
    padding: 12px 20px;
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.logo { font-weight: bold; letter-spacing: 1px; font-size: 1.1rem; }
.logo span { font-weight: 300; opacity: 0.7; font-size: 0.9rem; }
.stats { font-weight: 600; font-family: monospace; }
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    max-width: 500px;
    margin: 0 auto;
}
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
h3 {
    margin: 0 0 12px 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
#click-btn {
    width: 100%;
    height: 90px;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 0 var(--accent-dark);
    transition: transform 0.05s, box-shadow 0.05s;
    display: block;
}
#click-btn:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--accent-dark);
}
.progress-container {
    background: #e9ecef;
    height: 10px;
    border-radius: 5px;
    margin: 12px 0 6px 0;
    overflow: hidden;
}
#quota-fill {
    height: 100%;
    background-color: var(--success-green);
    width: 0%;
    transition: width 0.3s ease;
}
#quota-text {
    margin: 0;
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-muted);
}
#game-canvas {
    width: 100%;
    height: 180px;
    background: #34495e;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
}
#target {
    width: 46px;
    height: 46px;
    background: var(--danger-red);
    border-radius: 50%;
    position: absolute;
    display: none;
    z-index: 50;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.6);
}
#game-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    z-index: 40;
    pointer-events: none;
}
.secondary-btn {
    width: 100%;
    padding: 12px;
    background: #ecf0f1;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 600;
    color: var(--text-main);
}
#shop-items button {
    width: 100%;
    text-align: left;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
}
#shop-items button small {
    color: var(--text-muted);
    margin-top: 4px;
}
.warning-btn {
    width: 100%;
    padding: 16px;
    background: var(--danger-red) !important;
    color: white !important;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    margin-top: 10px;
}
#feed-container {
    height: 110px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    padding: 10px;
    background: #fdfdfd;
    border: 1px solid #f0f0f0;
    border-radius: 4px;
}
#feed-container p { margin: 4px 0; border-bottom: 1px solid #f9f9f9; }
.log-op {
    color: #e67e22 !important;
    font-weight: bold;
    border-left: 2px solid #e67e22;
    padding-left: 5px;
    margin: 5px 0;
}
.hidden { display: none !important; }
.glitch-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    pointer-events: none;
    background: white;
    animation: glitch-fx 0.15s steps(2) infinite;
}
@keyframes glitch-fx {
    0% { filter: invert(1) hue-rotate(90deg); transform: translate(4px, -2px) scale(1.05); }
    33% { filter: invert(0) contrast(2); transform: translate(-4px, 2px); }
    66% { filter: sepia(1) saturate(5); transform: translate(2px, 4px) skewX(10deg); }
    100% { filter: invert(1) grayscale(1); transform: translate(0); }
}
.divider {
    border: 0;
    border-top: 1px dashed var(--border-color);
    margin: 20px 0;
}
#dl-bar {
    height: 100%;
    background-color: var(--accent-blue);
    width: 0%;
}
.achievements-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}
.achievement {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #fafafa;
    transition: transform 0.2s;
}
.achievement.unlocked {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: #4caf50;
}
.achievement.locked {
    opacity: 0.6;
    filter: grayscale(0.8);
}
.achievement-icon {
    font-size: 1.8rem;
    margin-right: 12px;
    min-width: 40px;
    text-align: center;
}
.achievement-info {
    flex: 1;
}
.achievement-name {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 2px;
}
.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.achievement-reward {
    font-size: 0.7rem;
    color: #27ae60;
    font-weight: bold;
}
.achievement-locked {
    font-size: 0.7rem;
    color: #e74c3c;
    font-style: italic;
}
#achievement-count {
    float: right;
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: bold;
}
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-left: 4px solid #27ae60;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 300px;
}
.achievement-notification.show {
    transform: translateX(0);
}
.notif-icon {
    font-size: 2rem;
    margin-right: 15px;
}
.notif-content {
    flex: 1;
}
.notif-title {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 3px;
}
.notif-desc {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}
.notif-reward {
    font-size: 0.9rem;
    color: #27ae60;
    font-weight: bold;
}
.auto-income {
    text-align: center;
    font-size: 0.9rem;
    color: #27ae60;
    margin: 8px 0 0 0;
    font-weight: bold;
}
.shop-item {
    width: 100%;
    text-align: left;
    padding: 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}
.shop-item small {
    color: var(--text-muted);
    margin-top: 4px;
}
.primary-btn {
    width: 100%;
    padding: 16px;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.primary-btn:active {
    background-color: var(--accent-dark);
}
#achievements-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
}
.achievement {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #fafafa;
    transition: transform 0.2s;
}
.achievement.unlocked {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: #4caf50;
}
.achievement.locked {
    opacity: 0.6;
    filter: grayscale(0.8);
    background: #f5f5f5;
}
.achievement-icon {
    font-size: 1.8rem;
    margin-right: 12px;
    min-width: 40px;
    text-align: center;
}
.achievement-info {
    flex: 1;
    min-width: 0;
}
.achievement-name {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.achievement-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.achievement-reward {
    font-size: 0.7rem;
    color: #27ae60;
    font-weight: bold;
}
.achievement-locked {
    font-size: 0.7rem;
    color: #e74c3c;
    font-style: italic;
}
#achievement-count {
    float: right;
    font-size: 0.8rem;
    color: var(--accent-blue);
    font-weight: bold;
}
.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-left: 4px solid #27ae60;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    z-index: 10000;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    max-width: 300px;
}
.achievement-notification.show {
    transform: translateX(0);
}
.notif-icon {
    font-size: 2rem;
    margin-right: 15px;
}
.notif-content {
    flex: 1;
}
.notif-title {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 3px;
}
.notif-desc {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}
.notif-reward {
    font-size: 0.9rem;
    color: #27ae60;
    font-weight: bold;
}
.auto-income {
    text-align: center;
    font-size: 0.9rem;
    color: #27ae60;
    margin: 8px 0 0 0;
    font-weight: bold;
}
#dl-bar {
    height: 100%;
    background-color: var(--accent-blue);
    width: 0%;
    transition: width 0.3s;
    border-radius: 5px;
}
.glitch-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    background: white;
    animation: glitch-fx 0.15s steps(2) infinite;
    opacity: 0.8;
}
@keyframes glitch-fx {
    0% { filter: invert(1) hue-rotate(90deg); transform: translate(4px, -2px) scale(1.05); }
    33% { filter: invert(0) contrast(2); transform: translate(-4px, 2px); }
    66% { filter: sepia(1) saturate(5); transform: translate(2px, 4px) skewX(10deg); }
    100% { filter: invert(1) grayscale(1); transform: translate(0); }
}
@media (max-width: 480px) {
    .main-layout {
        padding: 10px;
        gap: 12px;
    }
    .card {
        padding: 12px;
    }
    #achievements-grid {
        grid-template-columns: 1fr;
        max-height: 150px;
    }
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mail-modal {
    background: var(--bg-card);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.mail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #2c3e50;
    color: white;
    border-radius: 12px 12px 0 0;
}
.mail-header h3 {
    margin: 0;
    color: white;
    font-size: 1rem;
}
.close-mail {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.close-mail:hover {
    background: rgba(255,255,255,0.1);
}
.mail-container {
    display: flex;
    flex: 1;
    min-height: 500px;
    overflow: hidden;
}
.mail-sidebar {
    width: 200px;
    background: #f8f9fa;
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
}
.mail-folders {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 20px;
}
.mail-folder {
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.mail-folder:hover {
    background: #e9ecef;
}
.mail-folder.active {
    background: var(--accent-blue);
    color: white;
    font-weight: bold;
}
.mail-compose-btn {
    margin-top: auto;
    padding: 12px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}
.mail-compose-btn:hover {
    background: var(--accent-dark);
}
.mail-content {
    flex: 1;
    display: flex;
}
.mail-list {
    width: 300px;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    background: white;
}
.mail-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    transition: background 0.2s;
}
.mail-item:hover {
    background: #f8f9fa;
}
.mail-item.unread {
    background: #f0f7ff;
    font-weight: bold;
}
.mail-sender {
    font-weight: bold;
    min-width: 120px;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mail-subject {
    flex: 1;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mail-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 50px;
    text-align: right;
}
.mail-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-blue);
    border-radius: 50%;
    margin-left: 5px;
}
.empty-folder {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}
.mail-viewer {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
}
.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
}
.message-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.message-subject {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-main);
}
.message-from-to {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.message-body {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--accent-blue);
}
.message-reply {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
}
.message-reply textarea {
    width: 100%;
    height: 100px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 10px;
}
.reply-btn {
    padding: 8px 20px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}
.reply-btn:hover {
    background: var(--accent-dark);
}
.compose-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.compose-header h4 {
    margin: 0;
    color: var(--text-main);
}
.compose-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.form-group label {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--text-main);
}
.form-group input,
.form-group textarea {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
.compose-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.cancel-btn,
.send-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}
.cancel-btn {
    background: #e9ecef;
    color: var(--text-main);
}
.send-btn {
    background: var(--accent-blue);
    color: white;
}
.cancel-btn:hover {
    background: #dee2e6;
}
.send-btn:hover {
    background: var(--accent-dark);
}
#mail-icon {
    position: relative;
    font-size: 1.2rem;
}
.mail-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}
@media (max-width: 768px) {
    .mail-container {
        flex-direction: column;
    }
    .mail-sidebar {
        width: 100%;
        flex-direction: row;
        padding: 10px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    .mail-folders {
        flex-direction: row;
        flex-wrap: wrap;
        margin-bottom: 0;
        margin-right: 10px;
    }
    .mail-folder {
        padding: 8px 12px;
    }
    .mail-compose-btn {
        margin-top: 0;
        padding: 8px 12px;
    }
    .mail-content {
        flex-direction: column;
    }
    .mail-list {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}
.mail-button {
    width: 100%;
    padding: 12px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.2s;
    touch-action: manipulation;
}
.mail-button:active {
    background: var(--accent-dark);
    transform: translateY(1px);
}
.mail-icon {
    font-size: 1.3rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.2s;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}
.mail-icon:active {
    background: rgba(255,255,255,0.1);
}
.mail-icon.has-unread {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}
.mail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mail-modal {
    background: var(--bg-card);
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow: hidden;
    touch-action: pan-y;
}
.mail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #2c3e50;
    color: white;
    flex-shrink: 0;
}
.mail-header h3 {
    margin: 0;
    color: white;
    font-size: 1rem;
}
.close-mail {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    touch-action: manipulation;
}
.close-mail:active {
    background: rgba(255,255,255,0.2);
}
.mail-container {
    display: flex;
    flex: 1;
    min-height: 400px;
    overflow: hidden;
    flex-direction: column;
}
.mail-sidebar {
    background: #f8f9fa;
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.mail-folders {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}
.mail-folder {
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    white-space: nowrap;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.mail-folder:active {
    background: #e9ecef;
}
.mail-folder.active {
    background: var(--accent-blue);
    color: white;
    font-weight: bold;
}
.mail-compose-btn {
    padding: 10px 15px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
    white-space: nowrap;
    touch-action: manipulation;
}
.mail-compose-btn:active {
    background: var(--accent-dark);
}
.mail-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mail-list {
    border-bottom: 1px solid var(--border-color);
    overflow-y: auto;
    background: white;
    max-height: 40vh;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch;
}
.mail-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    transition: background 0.2s;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}
.mail-item:active {
    background: #f8f9fa;
}
.mail-item.unread {
    background: #f0f7ff;
    font-weight: bold;
}
.mail-sender {
    font-weight: bold;
    min-width: 100px;
    max-width: 120px;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mail-subject {
    flex: 1;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.mail-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 45px;
    text-align: right;
}
.mail-unread-dot {
    width: 10px;
    height: 10px;
    background: var(--accent-blue);
    border-radius: 50%;
    flex-shrink: 0;
}
.mail-attachment {
    font-size: 0.9rem;
    color: #7f8c8d;
    flex-shrink: 0;
}
.empty-folder {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}
.mail-viewer {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
    -webkit-overflow-scrolling: touch;
}
.no-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}
.message-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.message-subject {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--text-main);
    word-break: break-word;
}
.message-from-to {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.message-attachment {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--accent-blue);
    gap: 15px;
    flex-wrap: wrap;
}
.attachment-icon {
    font-size: 1.5rem;
}
.attachment-info {
    flex: 1;
    min-width: 150px;
}
.attachment-name {
    font-weight: bold;
    margin-bottom: 5px;
}
.attachment-size {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.attachment-download {
    padding: 8px 15px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    touch-action: manipulation;
}
.attachment-download:active {
    background: var(--accent-dark);
}
.message-body {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid var(--accent-blue);
    word-break: break-word;
}
.message-reply {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed var(--border-color);
}
.message-reply textarea {
    width: 100%;
    height: 100px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    margin-bottom: 10px;
    box-sizing: border-box;
}
.reply-btn {
    padding: 10px 20px;
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    touch-action: manipulation;
}
.reply-btn:active {
    background: var(--accent-dark);
}
.compose-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.compose-header h4 {
    margin: 0;
    color: var(--text-main);
}
.compose-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.form-group label {
    font-weight: bold;
    font-size: 0.85rem;
    color: var(--text-main);
}
.form-group input,
.form-group textarea {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
    width: 100%;
    -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
.compose-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.cancel-btn,
.send-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    flex: 1;
    touch-action: manipulation;
}
.cancel-btn {
    background: #e9ecef;
    color: var(--text-main);
}
.send-btn {
    background: var(--accent-blue);
    color: white;
}
.cancel-btn:active {
    background: #dee2e6;
}
.send-btn:active {
    background: var(--accent-dark);
}
.mail-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    font-size: 0.7rem;
    padding: 3px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: bold;
}
@media (max-width: 768px) {
    .mail-modal {
        max-height: 95vh;
        margin: 5px;
    }
    .mail-container {
        min-height: 300px;
    }
    .mail-sidebar {
        padding: 10px;
    }
    .mail-folder {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .mail-compose-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    .mail-list {
        max-height: 30vh;
    }
    .mail-item {
        padding: 12px;
    }
    .mail-sender {
        min-width: 80px;
        max-width: 100px;
        font-size: 0.8rem;
    }
    .mail-subject {
        font-size: 0.8rem;
    }
    .mail-viewer {
        padding: 15px;
    }
    .message-subject {
        font-size: 1rem;
    }
    .message-body {
        font-size: 0.85rem;
        padding: 12px;
    }
    .compose-actions {
        flex-direction: column;
    }
}
@media (max-width: 480px) {
    .mail-header {
        padding: 12px 15px;
    }
    .mail-header h3 {
        font-size: 0.9rem;
    }
    .close-mail {
        width: 35px;
        height: 35px;
        font-size: 1.5rem;
    }
    .mail-folders {
        justify-content: center;
    }
    .mail-item {
        flex-wrap: wrap;
    }
    .mail-sender {
        min-width: 100%;
        max-width: 100%;
        margin-bottom: 5px;
    }
    .mail-time {
        margin-left: auto;
    }
    .form-group input,
    .form-group textarea {
        padding: 10px;
    }
}
button, .mail-item, .mail-folder, .mail-icon {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}
button:active, .mail-button:active {
    transform: translateY(2px);
    transition: transform 0.1s;
}
.mail-list, .mail-viewer, #feed-container, #achievements-grid {
    -webkit-overflow-scrolling: touch;
    overflow-scrolling: touch;
}
@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    .main-layout {
        padding: 10px;
        gap: 12px;
    }
    .card {
        padding: 12px;
    }
    #click-btn {
        height: 70px;
        font-size: 1rem;
    }
    h3 {
        font-size: 0.8rem;
    }
    .secondary-btn, .primary-btn, .warning-btn {
        padding: 14px;
        font-size: 0.9rem;
    }
    #feed-container {
        height: 90px;
        font-size: 0.75rem;
    }
    .auto-income {
        font-size: 0.8rem;
    }
    .mail-modal {
        border-radius: 8px;
    }
    .mail-header {
        padding: 10px;
    }
    .mail-content {
        min-height: 250px;
    }
    .mail-list {
        max-height: 25vh;
    }
    .message-body {
        font-size: 0.8rem;
        padding: 10px;
    }
}
@media (max-width: 480px) and (orientation: portrait) {
    .mail-container {
        flex-direction: column;
    }
    .mail-sidebar {
        order: 1;
    }
    .mail-list {
        order: 2;
        max-height: 20vh;
    }
    .mail-viewer {
        order: 3;
    }
}
@media (max-height: 500px) and (orientation: landscape) {
    .mail-modal {
        max-height: 85vh;
    }
    .mail-list {
        max-height: 25vh;
    }
    .mail-viewer {
        max-height: 40vh;
    }
}
@media (min-height: 800px) {
    .mail-modal {
        max-height: 80vh;
    }
    .mail-list {
        max-height: 30vh;
    }
}
.sync-button {
    width: 100%;
    padding: 18px;
    background: #27ae60 !important;
    color: white !important;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    display: block;
}
.sync-button:hover {
    background: #219653 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 83, 0.3);
}
.sync-button:active {
    background: #1e8449 !important;
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 2px 6px rgba(33, 150, 83, 0.2);
}
@media (hover: none) and (pointer: coarse) {
    .sync-button:active {
        background: #1e8449 !important;
        transform: scale(0.97);
        transition: transform 0.1s;
    }
}
@keyframes button-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(39, 174, 96, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
    }
}
.sync-button.pulse {
    animation: button-pulse 2s infinite;
}
.sync-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}
.sync-button:active::after {
    animation: button-ripple 0.6s ease-out;
}
@keyframes button-ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}
.sync-text {
    color: #e67e22;
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
@keyframes sync-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.sync-wrapper {
    animation: sync-fade-in 0.5s ease-out;
}
@media (max-width: 480px) {
    .sync-button {
        padding: 16px;
        font-size: 1rem;
    }
    .sync-text {
        font-size: 1rem;
        margin-bottom: 12px;
    }
}
@media (prefers-color-scheme: dark) {
    .sync-button {
        background: #27ae60 !important;
    }
    .sync-button:hover {
        background: #219653 !important;
    }
    .sync-button:active {
        background: #1e8449 !important;
    }
}