:root {
    --bg-color: #f8fafd;
    --text-main: #2d3436;
    --text-sub: #636e72;
    --accent: #4a90e2;
    --accent-hover: #357abd;
    --white: #ffffff;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    --border: #dfe6e9;
    --menu-bg: #ffffff;
    --sidebar-width: 280px;
}

body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 100%;
    background: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 50;
    height: 60px;
    box-sizing: border-box;
}

.logo {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--accent);
    letter-spacing: 1px;
}

.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: 0.3s;
}

.side-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--menu-bg);
    z-index: 100;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.side-menu.active {
    right: 0;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.menu-overlay.active {
    display: block;
    opacity: 1;
}

.menu-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    box-sizing: border-box;
}

.menu-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-sub);
}

.menu-scroll {
    overflow-y: auto;
    flex: 1;
    padding: 20px;
}

.menu-section {
    margin-bottom: 25px;
}

.menu-label {
    font-size: 0.8rem;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.menu-link {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: transparent;
    border: none;
    border-radius: 12px;
    text-align: left;
    font-family: 'Sarabun';
    font-size: 0.95rem;
    color: var(--text-main);
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s;
    box-sizing: border-box;
}

.menu-link:hover {
    background: #f0f7ff;
    color: var(--accent);
}

.menu-link.home-link {
    background: #e3f2fd;
    color: var(--accent);
    font-weight: 600;
}

.menu-link .icon {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-link .icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.menu-section:last-child .menu-link {
    color: #0984e3;
    font-size: 0.9rem;
}

.menu-section:last-child .icon img {
    filter: grayscale(0.6);
    opacity: 0.8;
}

.view-section {
    padding: 20px;
    animation: fadeIn 0.3s;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 900px) {
    .app-container {
        display: grid;
        grid-template-columns: var(--sidebar-width) 1fr;
        grid-template-areas: "sidebar content";
    }

    .top-bar {
        display: none;
    }

    .side-menu {
        position: relative;
        right: 0 !important;
        top: 0;
        width: 100%;
        height: 100vh;
        grid-area: sidebar;
        box-shadow: none;
        border-right: 1px solid var(--border);
        z-index: 1;
    }

    .close-btn {
        display: none;
    }

    .menu-overlay, .menu-overlay.active {
        display: none !important;
    }

    .view-section {
        grid-area: content;
        padding: 40px;
        margin: 0;
        max-width: 100%;
    }

    .main-footer {
        grid-column: 2;
    }
}

.countdown-hero {
    background: linear-gradient(135deg, #6c5ce7, #a29bfe);
    border-radius: 20px;
    padding: 25px;
    color: white;
    text-align: center;
    box-shadow: 0 10px 30px rgba(108, 92, 231, 0.3);
    margin-bottom: 30px;
}

.hero-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.countdown-hero h2 {
    margin: 0 0 20px 0;
    font-size: 1.4rem;
}

.timer-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.timer-box {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(5px);
    border-radius: 10px;
    padding: 8px;
    min-width: 50px;
    display: flex;
    flex-direction: column;
}

.timer-box span {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
}

.timer-box small {
    font-size: 0.7rem;
    margin-top: 5px;
}

.sep {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: -15px;
}

.section-head {
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 4px solid var(--accent);
}

.event-card {
    background: var(--white);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-info {
    flex: 1;
}

.event-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.event-date {
    font-size: 0.85rem;
    color: var(--text-sub);
}

.event-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    margin-left: 10px;
}

.badge-future { background: #e3f2fd; color: #1976d2; }
.badge-today { background: #e8f5e9; color: #2e7d32; }
.badge-past { background: #f5f5f5; color: #9e9e9e; }

.main-footer {
    text-align: center;
    margin-top: auto;
    padding: 20px 0;
    font-size: 0.8rem;
}

.main-footer a { color: var(--text-sub); text-decoration: none; }

select, input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fdfdfd;
    font-family: 'Sarabun';
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: 0.3s;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    margin-top: 15px;
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.result-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-top: 20px;
    text-align: center;
}

.tool-title {
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0 0 20px 0;
    font-weight: bold;
}
.score-group h3 {
    color: var(--accent);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.grid-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.input-wrapper label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 5px;
    color: var(--text-sub);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.input-wrapper input {
    font-weight: bold;
    color: var(--accent);
    text-align: center;
}