@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Cinzel+Decorative:wght@700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cinzel', serif;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 48, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.2) 0%, transparent 50%),
        linear-gradient(135deg, #2c1810 0%, #1a0f0a 25%, #3d2817 50%, #2c1810 75%, #1a0f0a 100%);
    min-height: 100vh;
    color: #d4af37;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 25% 25%, #8B4513 1px, transparent 1px),
        radial-gradient(circle at 75% 75%, #654321 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.1;
    z-index: -1;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
}

header::before {
    content: '⚔️';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 3rem;
    opacity: 0.3;
}

header h1 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 3rem;
    margin-bottom: 15px;
    color: #ffd700;
    text-shadow: 
        0 0 10px rgba(255, 215, 0, 0.5),
        2px 2px 4px rgba(0,0,0,0.8),
        0 0 20px rgba(255, 215, 0, 0.3);
    letter-spacing: 2px;
    position: relative;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
}

.header-decoration {
    font-size: 1.5rem;
    margin: 10px 0;
    opacity: 0.7;
    letter-spacing: 10px;
}

.logo-container {
    margin: 20px 0;
}

.logo {
    height: 60px;
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.3));
    transition: all 0.3s ease;
    cursor: pointer;
}

.logo:hover {
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.5));
    transform: scale(1.05);
}

header p {
    font-size: 1.2rem;
    color: #cd853f;
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    margin: 20px 0;
}

.search-section {
    background: 
        linear-gradient(145deg, rgba(139, 69, 19, 0.9), rgba(101, 67, 33, 0.9));
    border: 3px solid #8B4513;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 
        inset 0 2px 4px rgba(255, 215, 0, 0.1),
        0 15px 35px rgba(0,0,0,0.4),
        0 5px 15px rgba(0,0,0,0.2);
    margin-bottom: 40px;
    position: relative;
    backdrop-filter: blur(10px);
}

.search-section::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ffd700, #cd853f, #ffd700);
    border-radius: 22px;
    z-index: -1;
    opacity: 0.3;
}

.section-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.3rem;
    color: #ffd700;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.section-title .icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.search-box {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.captcha-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.captcha-label {
    color: #ffd700;
    font-size: 0.9rem;
    font-weight: 600;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    text-align: center;
}

.captcha-input {
    padding: 18px 25px;
    background: rgba(26, 15, 10, 0.8);
    border: 2px solid #8B4513;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: 'Cinzel', serif;
    color: #ffd700;
    text-align: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.captcha-input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 
        0 0 0 3px rgba(255, 215, 0, 0.2),
        inset 0 2px 4px rgba(0,0,0,0.3),
        0 0 15px rgba(255, 215, 0, 0.3);
    background: rgba(26, 15, 10, 0.9);
}

#characterInput {
    flex: 1;
    min-width: 300px;
    padding: 18px 25px;
    background: rgba(26, 15, 10, 0.8);
    border: 2px solid #8B4513;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: 'Cinzel', serif;
    color: #ffd700;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

#characterInput::placeholder {
    color: #cd853f;
    opacity: 0.8;
}

#characterInput:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 
        0 0 0 3px rgba(255, 215, 0, 0.2),
        inset 0 2px 4px rgba(0,0,0,0.3),
        0 0 15px rgba(255, 215, 0, 0.3);
    background: rgba(26, 15, 10, 0.9);
}

#searchBtn {
    padding: 18px 35px;
    background: linear-gradient(145deg, #8B4513, #654321);
    color: #ffd700;
    border: 2px solid #8B4513;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-icon {
    font-size: 1.2rem;
}

#searchBtn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.2), transparent);
    transition: left 0.5s;
}

#searchBtn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 25px rgba(139, 69, 19, 0.4),
        inset 0 1px 0 rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
}

#searchBtn:hover::before {
    left: 100%;
}

#searchBtn:active {
    transform: translateY(-1px);
}

.results-section {
    min-height: 250px;
}

.loading {
    display: none;
    text-align: center;
    color: #ffd700;
    padding: 50px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 215, 0, 0.2);
    border-top: 4px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 25px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 10px;
    background: rgba(26, 15, 10, 0.3);
    border-radius: 15px;
    border: 1px solid rgba(139, 69, 19, 0.3);
    min-height: 400px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 10px 15px;
    background: linear-gradient(145deg, #8B4513, #654321);
    color: #ffd700;
    border: 2px solid #8B4513;
    border-radius: 10px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 40px;
}

.pagination button:hover {
    border-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.pagination button.active {
    background: linear-gradient(145deg, #ffd700, #daa520);
    color: #2c1810;
    border-color: #ffd700;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.pagination-info {
    color: #cd853f;
    font-size: 0.9rem;
    margin: 0 15px;
}

.stats-section {
    margin-bottom: 30px;
}

.stats-card {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.9), rgba(101, 67, 33, 0.9));
    border: 2px solid #8B4513;
    border-radius: 18px;
    padding: 25px;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(10px);
}

.stats-title {
    text-align: center;
    font-size: 1.4rem;
    color: #ffd700;
    font-weight: 600;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(26, 15, 10, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(139, 69, 19, 0.3);
}

.stat-label {
    color: #cd853f;
    font-size: 1rem;
    font-weight: 500;
}

.stat-value {
    color: #ffd700;
    font-size: 1.2rem;
    font-weight: 700;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.ticket-card {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.9), rgba(101, 67, 33, 0.9));
    border: 1px solid #8B4513;
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.ticket-card:hover {
    transform: scale(1.05);
    border-color: #ffd700;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
    z-index: 10;
}

.ticket-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffd700;
    margin-bottom: 4px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.matched-char {
    font-size: 0.7rem;
    color: #cd853f;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.no-results {
    text-align: center;
    color: #cd853f;
    padding: 60px;
    font-size: 1.4rem;
    font-style: italic;
}

.no-results::before {
    content: '🔍';
    display: block;
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.error {
    background: linear-gradient(145deg, #8B0000, #654321);
    color: #ffd700;
    padding: 20px 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    text-align: center;
    border: 2px solid #8B0000;
    box-shadow: 0 5px 15px rgba(139, 0, 0, 0.3);
}

#toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.toast {
    background: linear-gradient(145deg, rgba(139, 69, 19, 0.95), rgba(101, 67, 33, 0.95));
    border: 2px solid #8B4513;
    border-radius: 15px;
    padding: 20px 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    min-width: 320px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #ffd700;
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid #228B22;
}

.toast.error {
    border-left: 4px solid #8B0000;
}

.toast.info {
    border-left: 4px solid #4682B4;
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    font-weight: 500;
    font-family: 'Cinzel', serif;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2.2rem;
    }
    
    .search-section {
        padding: 25px;
    }
    
    .search-box {
        flex-direction: column;
        align-items: stretch;
    }
    
    #characterInput {
        min-width: 100%;
    }
    
    .captcha-section {
        min-width: 100%;
        align-self: stretch;
    }
    
    .captcha-input {
        width: 100%;
    }
    
    #searchBtn {
        width: 100%;
    }
    
    .toast {
        min-width: 280px;
    }
    
    #toast-container {
        right: 15px;
        left: 15px;
    }
    
    .results {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
    }
    
    .ticket-card {
        min-height: 50px;
        padding: 6px;
    }
    
    .ticket-number {
        font-size: 0.7rem;
    }
    
    .matched-char {
        font-size: 0.6rem;
    }
    
    .filter-box {
        flex-direction: column;
        align-items: center;
    }
    
    #ticketNumberInput {
        min-width: 100%;
        max-width: 100%;
    }
    
    #filterTicketBtn, #showAllBtn {
        width: 100%;
        margin-top: 5px;
    }
}

footer {
    text-align: center;
    margin-top: 50px;
    padding: 30px 0;
    border-top: 2px solid rgba(139, 69, 19, 0.3);
}

.footer-decoration {
    font-size: 1.2rem;
    margin-bottom: 15px;
    opacity: 0.6;
    letter-spacing: 8px;
}

footer p {
    color: #cd853f;
    font-style: italic;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}