* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.4;
    color: #333;
    background: linear-gradient(135deg, #ed1c24 0%, #ed1c24 33%, #ffffff 33%, #ffffff 66%, #241d4f 66%, #241d4f 100%);
    min-height: 100vh;
    padding: 80px 0 20px 0;
}

.thai-main-wrapper {
    margin-top: 0;
    width: 100%;
}

.thai-container {
    width: 100%;
    min-width: 100%;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.thai-status-bar {
    background: linear-gradient(90deg, #ed1c24 0%, #ffffff 50%, #241d4f 100%);
    color: #333;
    padding: 4px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    border-bottom: 1px solid #e2e8f0;
    min-height: 30px;
}

.thai-real-time-display {
    display: flex;
    gap: 15px;
    align-items: center;
}

.thai-time-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.thai-time-badge {
    background: #241d4f;
    color: white;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    font-weight: 600;
}

.thai-main-content {
    padding: 10px;
}

.thai-core-converters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.thai-converter-card {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px;
    background: #fafbfc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.thai-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.thai-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #241d4f;
}

.thai-accuracy-badge {
    background: #ed1c24;
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.thai-converter-form {
    display: grid;
    gap: 6px;
}

.thai-form-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.thai-form-label {
    min-width: 40px;
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
}

.thai-form-input {
    flex: 0 1 auto;
    padding: 6px 4px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    font-size: 12px;
    height: 30px;
    text-align: center;
}

.thai-year-input {
    width: 60px;
}

.thai-month-input {
    width: 45px;
}

.thai-day-input {
    width: 45px;
}

.thai-result-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    font-size: 12px;
    height: 30px;
    min-width: 140px;
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: inner-spin-button !important;
    opacity: 1;
    display: block;
    width: 12px;
    height: 12px;
    cursor: pointer;
    position: relative;
    background: transparent;
}

.thai-form-input:focus,
.thai-result-input:focus {
    outline: none;
    border-color: #ed1c24;
    box-shadow: 0 0 0 2px rgba(237, 28, 36, 0.2);
}

.thai-convert-btn {
    background: #241d4f;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    height: 30px;
    min-width: 50px;
    transition: all 0.3s;
}

.thai-convert-btn:hover {
    background: #ed1c24;
}

.thai-result-display {
    background: #f0f4f8;
    padding: 6px 8px;
    border-radius: 3px;
    margin-top: 6px;
    border-left: 3px solid #ed1c24;
}

.thai-result-text {
    font-size: 12px;
    font-weight: 600;
    color: #241d4f;
}

.thai-historical-section {
    margin: 15px 0;
}

.thai-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #241d4f;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.thai-historical-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.thai-historical-card {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px;
    background: #f7fafc;
}

.thai-historical-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.thai-historical-name {
    font-size: 14px;
    font-weight: 600;
    color: #241d4f;
}

.thai-historical-status {
    background: #fed7d7;
    color: #c53030;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.thai-historical-desc {
    font-size: 12px;
    color: #4a5568;
    margin-bottom: 8px;
    line-height: 1.4;
}

.thai-historical-form-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.thai-historical-label {
    min-width: 50px;
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
}

.thai-historical-input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    font-size: 12px;
    height: 30px;
    min-width: 80px;
    text-align: center;
}

.thai-historical-result {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    font-size: 12px;
    height: 30px;
    min-width: 80px;
}

.thai-historical-arrow {
    font-weight: bold;
    font-size: 14px;
    color: #241d4f;
    margin: 0 3px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 30px;
}

.thai-historical-btn {
    background: #241d4f;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    height: 30px;
    min-width: 50px;
    transition: all 0.3s;
}

.thai-historical-btn:hover {
    background: #ed1c24;
}

.thai-festivals-section {
    margin: 15px 0;
}

.thai-festivals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 8px;
}

.thai-festival-card {
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px;
    background: white;
}

.thai-festival-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.thai-festival-name {
    font-size: 13px;
    font-weight: 600;
    color: #241d4f;
}

.thai-festival-date {
    background: #e6fffa;
    color: #234e52;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.thai-festival-desc {
    font-size: 11px;
    color: #4a5568;
    line-height: 1.4;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 450px) {
    .thai-core-converters {
        grid-template-columns: 1fr;
    }
    
    .thai-historical-cards {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .thai-historical-card {
        width: 100%;
        max-width: 100%;
        padding: 6px;
        margin: 0;
        overflow: hidden;
    }
    
    .thai-historical-form-group {
        display: flex;
        align-items: center;
        gap: 3px;
        width: 100%;
        max-width: 100%;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    
    .thai-historical-label {
        min-width: 40px;
        font-size: 10px;
        flex-shrink: 0;
    }
    
    .thai-historical-input {
        min-width: 70px;
        padding: 4px 6px;
        font-size: 10px;
        height: 26px;
        flex: 1;
        max-width: 80px;
    }
    
    .thai-historical-result {
        min-width: 70px;
        padding: 4px 6px;
        font-size: 10px;
        height: 26px;
        flex: 1;
        max-width: 80px;
    }
    
    .thai-historical-arrow {
        font-size: 11px;
        margin: 0 2px;
        height: 26px;
        flex-shrink: 0;
    }
    
    .thai-historical-btn {
        min-width: 45px;
        padding: 4px 6px;
        font-size: 10px;
        height: 26px;
        flex-shrink: 0;
    }
    
    .thai-form-group {
        flex-wrap: nowrap;
        gap: 3px;
    }
    
    .thai-form-label {
        min-width: 35px;
        font-size: 10px;
    }
    
    .thai-year-input {
        width: 50px;
    }
    
    .thai-month-input {
        width: 45px;
    }
    
    .thai-day-input {
        width: 45px;
    }
    
    .thai-form-input {
        padding: 4px 3px;
        font-size: 10px;
        height: 26px;
    }
    
    .thai-result-input {
        min-width: 110px;
        padding: 4px 6px;
        font-size: 10px;
        height: 26px;
        flex: 1;
    }
    
    .thai-convert-btn {
        min-width: 45px;
        padding: 4px 6px;
        font-size: 10px;
        height: 26px;
        flex-shrink: 0;
    }
    
    .thai-festivals-grid {
        grid-template-columns: 1fr;
    }
    
    .thai-main-content {
        padding: 6px;
    }
    
    .thai-converter-card,
    .thai-festival-card {
        padding: 6px;
    }
    
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        width: 10px;
        height: 10px;
    }
}

@media (min-width: 451px) and (max-width: 768px) {
    .thai-core-converters {
        grid-template-columns: 1fr;
    }
    
    .thai-historical-cards {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .thai-historical-card {
        padding: 8px;
    }
    
    .thai-historical-form-group {
        gap: 4px;
    }
    
    .thai-historical-label {
        min-width: 45px;
        font-size: 11px;
    }
    
    .thai-historical-input {
        min-width: 70px;
        padding: 5px 6px;
        font-size: 11px;
        height: 28px;
    }
    
    .thai-historical-result {
        min-width: 70px;
        padding: 5px 6px;
        font-size: 11px;
        height: 28px;
    }
    
    .thai-historical-arrow {
        font-size: 12px;
        margin: 0 2px;
        height: 28px;
    }
    
    .thai-historical-btn {
        min-width: 45px;
        padding: 5px 8px;
        font-size: 11px;
        height: 28px;
    }
    
    .thai-form-group {
        gap: 3px;
    }
    
    .thai-form-label {
        min-width: 35px;
        font-size: 11px;
    }
    
    .thai-year-input {
        width: 50px;
    }
    
    .thai-month-input {
        width: 45px;
    }
    
    .thai-day-input {
        width: 45px;
    }
    
    .thai-form-input {
        padding: 4px 2px;
        font-size: 11px;
        height: 28px;
    }
    
    .thai-result-input {
        min-width: 120px;
        padding: 4px 6px;
        font-size: 11px;
        height: 28px;
    }
    
    .thai-convert-btn {
        min-width: 45px;
        padding: 4px 8px;
        font-size: 11px;
        height: 28px;
    }
    
    .thai-festivals-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
    
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        width: 11px;
        height: 11px;
    }
}

@media (min-width: 769px) and (max-width: 820px) {
    .thai-core-converters {
        grid-template-columns: 1fr 1fr;
    }
    
    .thai-historical-cards {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .thai-historical-card {
        padding: 8px;
    }
    
    .thai-historical-form-group {
        gap: 5px;
    }
    
    .thai-historical-label {
        min-width: 48px;
        font-size: 11px;
    }
    
    .thai-historical-input {
        min-width: 75px;
        padding: 5px 7px;
        font-size: 11px;
        height: 29px;
    }
    
    .thai-historical-result {
        min-width: 75px;
        padding: 5px 7px;
        font-size: 11px;
        height: 29px;
    }
    
    .thai-historical-arrow {
        font-size: 13px;
        margin: 0 2px;
        height: 29px;
    }
    
    .thai-historical-btn {
        min-width: 48px;
        padding: 5px 9px;
        font-size: 11px;
        height: 29px;
    }
    
    .thai-form-group {
        gap: 4px;
    }
    
    .thai-form-label {
        min-width: 38px;
        font-size: 11px;
    }
    
    .thai-year-input {
        width: 55px;
    }
    
    .thai-month-input {
        width: 45px;
    }
    
    .thai-day-input {
        width: 45px;
    }
    
    .thai-form-input {
        padding: 5px 3px;
        font-size: 11px;
        height: 29px;
    }
    
    .thai-result-input {
        min-width: 130px;
        padding: 5px 7px;
        font-size: 11px;
        height: 29px;
    }
    
    .thai-convert-btn {
        min-width: 48px;
        padding: 5px 9px;
        font-size: 11px;
        height: 29px;
    }
    
    .thai-festivals-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    }
    
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        width: 11px;
        height: 11px;
    }
}

@media (min-width: 821px) and (max-width: 1024px) {
    .thai-core-converters {
        grid-template-columns: 1fr 1fr;
    }
    
    .thai-historical-cards {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .thai-historical-card {
        padding: 8px;
    }
    
    .thai-historical-form-group {
        gap: 6px;
    }
    
    .thai-historical-label {
        min-width: 50px;
        font-size: 12px;
    }
    
    .thai-historical-input {
        min-width: 78px;
        padding: 6px 8px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-historical-result {
        min-width: 78px;
        padding: 6px 8px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-historical-arrow {
        font-size: 14px;
        margin: 0 3px;
        height: 30px;
    }
    
    .thai-historical-btn {
        min-width: 50px;
        padding: 6px 10px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-form-group {
        gap: 4px;
    }
    
    .thai-form-label {
        min-width: 40px;
        font-size: 12px;
    }
    
    .thai-year-input {
        width: 58px;
    }
    
    .thai-month-input {
        width: 45px;
    }
    
    .thai-day-input {
        width: 45px;
    }
    
    .thai-form-input {
        padding: 6px 4px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-result-input {
        min-width: 135px;
        padding: 6px 8px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-convert-btn {
        min-width: 50px;
        padding: 6px 10px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-festivals-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
    
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        width: 12px;
        height: 12px;
    }
}

@media (min-width: 1025px) {
    .thai-core-converters {
        grid-template-columns: 1fr 1fr;
    }
    
    .thai-historical-cards {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .thai-historical-card {
        padding: 8px;
    }
    
    .thai-historical-form-group {
        gap: 6px;
    }
    
    .thai-historical-label {
        min-width: 50px;
        font-size: 12px;
    }
    
    .thai-historical-input {
        min-width: 80px;
        padding: 6px 8px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-historical-result {
        min-width: 80px;
        padding: 6px 8px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-historical-arrow {
        font-size: 14px;
        margin: 0 3px;
        height: 30px;
    }
    
    .thai-historical-btn {
        min-width: 50px;
        padding: 6px 10px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-form-group {
        gap: 4px;
    }
    
    .thai-form-label {
        min-width: 40px;
        font-size: 12px;
    }
    
    .thai-year-input {
        width: 60px;
    }
    
    .thai-month-input {
        width: 45px;
    }
    
    .thai-day-input {
        width: 45px;
    }
    
    .thai-form-input {
        padding: 6px 4px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-result-input {
        min-width: 140px;
        padding: 6px 8px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-convert-btn {
        min-width: 50px;
        padding: 6px 10px;
        font-size: 12px;
        height: 30px;
    }
    
    .thai-festivals-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    input[type="number"]::-webkit-outer-spin-button,
    input[type="number"]::-webkit-inner-spin-button {
        width: 12px;
        height: 12px;
    }
}