* {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

:root {
    --primary-color: #3b82f6;
    --bg-color: #f2f4f7;
    --border-color: #d0d6df;
    --grid-bg: #ffffff;
    --accent-color: #ef4444;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-color);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* --- Top Bar & Buttons --- */
.top-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px;
    background: #e5e9ef;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
}

.top-bar button {
    padding: 8px;
    font-size: 18px;
    border-radius: 8px;
    border: 1px solid #c5cbd6;
    background: #fff;
    cursor: pointer;
    min-width: 42px;
    height: 40px;
    outline: none;
    transition: background 0.2s;
}

.top-bar button:active {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
    background-color: #f0f7ff;
}

.datetime-display {
    flex: 1;
    max-width: 180px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    padding: 8px 4px;
    background: #fff;
    border-radius: 10px;
    border: 2px solid var(--primary-color);
    -webkit-tap-highlight-color: transparent;
}

.lunar-info {
    margin-top: 8px;
    font-size: 14px;
    color: var(--accent-color);
    font-weight: bold;
    line-height: 1.25;
    white-space: pre-line;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-left: 1px;
    text-align: left;
}

/* --- Bottom Controls --- */
.bottom-controls {
    position: fixed;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    /* Hidden by default */
    gap: 16px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.85);
    padding: 12px 24px;
    border-radius: 40px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Fallback: show automatically if standalone mode is detected via CSS */
@media (display-mode: standalone) {
    .bottom-controls {
        display: flex !important;
    }
}

.bottom-controls button {
    flex: 1;
    min-width: 130px;
    justify-content: center;
    padding: 14px 24px;
    border-radius: 25px;
    border: none;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.bottom-controls button:active {
    transform: scale(0.95);
    background: #2563eb;
}

/* --- History Modal --- */