* { box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Arial, sans-serif;
    background: linear-gradient(180deg, #fff8e1 0%, #f4f4f4 100%);
    color: #222;
    text-align: center;
    line-height: 1.4;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.main-header {
    background: linear-gradient(135deg, #ff1e1e, #ff8f00, #ffd54f);
    color: white;
    padding: 26px 20px;
    margin: 0;
    font-size: clamp(1.4rem, 4vw, 2.4rem);
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(255,255,255,0.6), 0 0 20px rgba(255,140,0,0.5);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    border-bottom: 3px solid #fff3cd;
    animation: titleGlow 1.6s infinite alternate;
    width: 100%;
}

@keyframes titleGlow {
    from { transform: scale(1); }
    to { transform: scale(1.01); }
}

.social-bar {
    padding: 14px 12px 8px;
    background: rgba(255,255,255,0.75);
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.btn-social {
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-size: clamp(0.95rem, 2.2vw, 1rem);
    line-height: 1.2;
}

.btn-social:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 18px rgba(0,0,0,0.2);
}

.wa { background: linear-gradient(135deg, #25d366, #1aa34a); }
.tg { background: linear-gradient(135deg, #0088cc, #005f99); }

.live-result-card,
.next-test-card,
.history-card,
.about-card {
    width: min(980px, calc(100% - 16px));
    margin: 18px auto;
    border-radius: 20px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.16);
}

.live-result-card {
    background: linear-gradient(135deg, #fff8e1, #ffffff);
    padding: 22px;
    border: 3px solid #ff9800;
}

.blink-orange { animation: border-blink 2s infinite; }
@keyframes border-blink { 50% { background-color: #fff3e0; } }

.live-title {
    background: linear-gradient(135deg, #e53935, #fb8c00);
    color: white;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: clamp(1.15rem, 2.6vw, 1.6rem);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.test-name-box {
    background: linear-gradient(135deg, #333, #555);
    color: white;
    padding: 14px;
    font-size: clamp(1rem, 2.2vw, 1.35rem);
    font-weight: 700;
    border-radius: 12px;
    margin: 14px 0;
    box-shadow: inset 0 0 12px rgba(255,255,255,0.12);
}

.clock-card {
    background: linear-gradient(135deg, #111, #2b2b2b);
    color: #FFD700;
    padding: 10px;
    margin: 10px 0;
    border-radius: 10px;
    font-weight: 700;
    font-size: clamp(0.9rem, 2vw, 1rem);
    border: 1px solid #FFD700;
    box-shadow: 0 4px 10px rgba(255,215,0,0.16);
}

.winner-display {
    font-size: clamp(1.1rem, 3vw, 1.8rem);
    font-weight: 700;
    margin: 18px 0 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.winner-label { font-size: 1.7rem; color: #333; }
.winner-number {
    font-size: 3.8rem;
    font-weight: 900;
    display: inline-block;
    background: linear-gradient(to bottom, #ff9800, #e64a19);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}

.next-test-card {
    background: linear-gradient(135deg, #e0f7fa, #f3feff);
    padding: 18px;
    border: 2px solid #00acc1;
}

.next-title {
    font-size: clamp(1rem, 2.4vw, 1.3rem);
    font-weight: 700;
    color: #006064;
    margin: 0 0 8px;
}

.countdown {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-weight: 800;
    color: #d84315;
    margin: 0;
}

.blink-effect { animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.08); } 100% { transform: scale(1); } }
.wait-blink {
    background: #ffe082;
    color: #d62828;
    font-weight: 700;
    animation: blink 1s infinite;
    padding: 5px;
    display: block;
    border-radius: 8px;
}
@keyframes blink { 50% { opacity: 0.4; } }

.table-container {
    width: min(980px, calc(100% - 16px));
    margin: 0 auto 18px;
    overflow-x: auto;
    padding: 0;
}

table {
    width: 100%;
    min-width: 0;
    margin: 0 auto;
    border-collapse: collapse;
    background: white;
    font-size: 0.95rem;
    table-layout: auto;
    box-shadow: 0 8px 22px rgba(0,0,0,0.16);
    border-radius: 12px;
    overflow: hidden;
}

th {
    background: linear-gradient(135deg, #222, #444);
    color: white;
    padding: 12px 10px;
    border: 1px solid #555;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 10px 8px;
    border: 1px solid #ddd;
    font-weight: 600;
    word-wrap: break-word;
    color: #333;
}

tbody tr:nth-child(even) {
    background: #fff8e1;
}

tbody tr:hover {
    background: #ffe082;
    transform: translateY(-1px);
    transition: 0.2s ease;
}

#table-body tr td { font-size: 0.95rem; }
#table-body tr td:last-child { font-weight: 800; color: #0b7a0b; }
#table-body tr td:last-child.wait-blink {
    color: #d62828;
    text-shadow: 0 0 6px rgba(214,40,40,0.35);
}

#table-body tr.current-test-row {
    background: linear-gradient(135deg, #fff3cd, #ffe082);
    box-shadow: inset 0 0 0 2px #ff9800;
}

#table-body tr.current-test-row td { color: #4a2c00; }
#table-body tr.current-test-row td:last-child {
    background: linear-gradient(135deg, #ff9800, #e64a19);
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(230,74,25,0.28);
}

.history-card {
    background: linear-gradient(135deg, #2c2c2c, #4d4d4d);
    color: white;
    padding: 20px;
}

.history-card h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 0;
}

.date-input {
    padding: 12px;
    width: min(90%, 320px);
    border-radius: 10px;
    border: 2px solid #ffb300;
    font-size: 1rem;
    margin-bottom: 12px;
    outline: none;
}

#history-table {
    margin-top: 10px;
    background: white;
    color: #222;
    border-radius: 10px;
    overflow: hidden;
}

#history-table th, #history-table td { color: #222; }
#history-table th { background: linear-gradient(135deg, #ff8f00, #f44336); }
#history-table tbody tr:nth-child(even) { background: #fff7e6; }

.about-card {
    background: linear-gradient(135deg, #fff8e1, #ffffff);
    color: #4a2c00;
    padding: 18px 20px;
    border: 2px solid #ff9800;
}

.about-card h3 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    color: #d84315;
}

.about-card p {
    margin: 0;
    line-height: 1.6;
    font-size: 0.96rem;
}

@media (max-width: 768px) {
    body { font-size: 15px; padding: 0 0 16px; }
    .main-header { font-size: 1.7rem; padding: 18px 12px; }
    .social-bar { padding: 12px 8px 6px; gap: 8px; }
    .btn-social { width: 100%; max-width: 220px; text-align: center; padding: 9px 14px; }
    .live-result-card,
    .next-test-card,
    .history-card,
    .about-card { margin: 12px 8px; padding: 14px; border-radius: 16px; }
    .live-title { font-size: 1.25rem; padding: 10px 12px; }
    .test-name-box { font-size: 1.05rem; padding: 10px; margin: 10px 0; }
    .clock-card { font-size: 0.95rem; padding: 8px; }
    .winner-display { flex-direction: column; gap: 4px; margin: 12px 0 4px; }
    .winner-label { font-size: 1.1rem; }
    .winner-number { font-size: 2.4rem; }
    .next-title { font-size: 1rem; }
    .countdown { font-size: 1.3rem; }
    .table-container { padding: 0 4px; margin-bottom: 12px; }
    table { font-size: 0.85rem; }
    th, td { padding: 7px 5px; }
    .date-input { width: 100%; padding: 10px; font-size: 0.95rem; }
    .about-card p { font-size: 0.9rem; }
}

@media (max-width: 480px) {
    body { font-size: 14px; }
    .main-header { font-size: 1.35rem; letter-spacing: 0.5px; padding: 16px 10px; }
    .social-bar { padding: 10px 6px 4px; }
    .live-result-card,
    .next-test-card,
    .history-card,
    .about-card { margin: 10px 6px; padding: 12px; }
    .btn-social { max-width: none; padding: 8px 12px; }
    .live-title { font-size: 1.1rem; }
    .test-name-box { font-size: 0.95rem; }
    .winner-number { font-size: 2rem; }
    .table-container {
        padding: 0 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-container table {
        display: table;
        min-width: 520px;
        border-collapse: collapse;
        border-spacing: 0;
    }
    .table-container thead {
        display: table-header-group;
    }
    .table-container tbody {
        display: table-row-group;
    }
    .table-container tr {
        display: table-row;
    }
    .table-container th,
    .table-container td {
        display: table-cell;
        text-align: center;
        padding: 8px 6px;
        font-size: 0.84rem;
    }
    .table-container td::before {
        content: none;
    }
    .about-card p { font-size: 0.88rem; }
}