@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00ff88;
    --secondary: #00d4ff;
    --danger: #ff0000;
    --warning: #ffaa00;
    --success: #00ff88;
    --dark: #0a0e27;
    --darker: #050714;
    --light: #ffffff;
    --gray: #8892b0;
    --purple: #9c88ff;
}

body {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;

    background: linear-gradient(135deg, #0a0e27 0%, #050714 100%);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
}

.cyber-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(0, 255, 136, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 136, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: gridMove 20s linear infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary);
    border-radius: 50%;
    animation: float 15s linear infinite;
    opacity: 0.6;
}

@keyframes float {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    z-index: 1000;
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 4px 30px rgba(0, 255, 136, 0.3);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: var(--light);
    text-decoration: none;
    position: relative;
    transition: all 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-weight: 500;
}

.nav-link:hover:not(.sign-in-btn) {
    color: var(--primary);
    background: rgba(0, 255, 136, 0.1);
    transform: translateY(-2px);
}
/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

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

.toast-success {
    background: linear-gradient(135deg, #00C851 0%, #007E33 100%);
}

.toast-error {
    background: linear-gradient(135deg, #ff4444 0%, #cc0000 100%);
}

.toast-info {
    background: linear-gradient(135deg, #33b5e5 0%, #0099cc 100%);
}

.toast-warning {
    background: linear-gradient(135deg, #ffbb33 0%, #ff8800 100%);
}
/* เพิ่มใน challenge.css */
.interactive-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 8px;
}

@keyframes highlight {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 255, 136, 0);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 8px 40px rgba(0, 255, 136, 0.5);
    }
}
.sign-in-btn {
    background: linear-gradient(45deg, var(--primary), var(--secondary)) !important;
    color: var(--dark) !important;
    font-weight: bold !important;
    border-radius: 25px !important;
    padding: 0.8rem 1.5rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border: 2px solid var(--primary) !important;
    transition: all 0.3s ease !important;
    margin-left: 1rem !important;
}

.sign-in-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 25px rgba(0, 255, 136, 0.4) !important;
}
.nav-user-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* avatar ปุ่มด้านขวา */
.profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.8rem;
    border-radius: 999px;
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.6);
    text-decoration: none;
    color: var(--light);
    font-weight: 500;
    transition: all 0.25s ease;
}

.profile-pill:hover {
    background: rgba(0, 255, 136, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 255, 136, 0.4);
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.6);
}

.navUsername {
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    color: var(--light);
    opacity: 0.9;
}


.main-content {
    margin-top: 80px;
    padding: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 10;
}

.hero {
    text-align: center;
    padding: 4rem 2rem;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { filter: drop-shadow(0 0 20px rgba(0, 255, 136, 0.5)); }
    to { filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.8)); }
}

.hero p {
    font-size: 1.2rem;
    color: var(--gray);
    margin-bottom: 2rem;
}

.ctf-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.category-card {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid transparent;
    border-radius: 15px;
    padding: 2rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s;
    z-index: -1;
}

.category-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: var(--primary);
    box-shadow: 0 20px 60px rgba(0, 255, 136, 0.4);
}

.category-card:hover::before {
    opacity: 0.1;
}

.category-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

.category-title {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-weight: bold;
}

.category-description {
    color: var(--light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.category-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--light);
    text-transform: uppercase;
}

.difficulty-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.difficulty-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    color: #ffffff;
}

.difficulty-easy {
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid var(--primary);
}

.difficulty-medium {
    background: rgba(255, 170, 0, 0.2);
    border: 1px solid var(--warning);
}

.difficulty-hard {
    background: rgba(255, 0, 0, 0.2);
    border: 1px solid var(--danger);
}

.difficulty-expert {
    background: rgba(156, 136, 255, 0.2);
    border: 1px solid var(--purple);
}

.back-btn {
    background: rgba(0, 255, 136, 0.2);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.back-btn:hover {
    background: var(--primary);
    color: var(--dark);
    transform: translateX(-5px);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    z-index: 2000;
    overflow-y: auto;
    padding: 2rem;
}

.modal.active {
    display: block;
}

.modal-content {
    background: var(--dark);
    border: 2px solid var(--primary);
    border-radius: 15px;
    padding: 2rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    animation: modalSlideIn 0.3s ease-out;
    min-height: calc(100vh - 4rem);
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary);
}

.modal-title {
    font-size: 2rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.close-btn {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    flex-shrink: 0;
}

.close-btn:hover {
    background: #ff0000;
    transform: rotate(90deg);
}

.progress-section {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--secondary);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 2rem;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s;
}

.challenge-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.challenge-item {
    background: rgba(10, 14, 39, 0.8);
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 10px;
    padding: 1.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.challenge-item:hover {
    border-color: var(--primary);
    transform: translateX(10px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.3);
}

.challenge-item.completed {
    border-color: var(--success);
    background: rgba(0, 255, 136, 0.05);
}

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.challenge-name {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--light);
    flex: 1;
}

.challenge-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.challenge-points {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--dark);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.status-badge {
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 2px solid;
}

.status-completed {
    background: var(--success);
    border-color: var(--success);
    color: var(--dark);
}

.status-not-started {
    background: transparent;
    border-color: var(--gray);
    color: var(--gray);
}

.challenge-description {
    color: var(--gray);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.challenge-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.challenge-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--gray);
}

.terminal {
    background: #000;
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    margin: 1rem 0;
    white-space: pre-wrap; /* เพิ่มบรรทัดนี้ */
}

.terminal-output {
    color: var(--light);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* เพิ่ม style สำหรับ input inline */
.terminal-input-wrapper {
    display: flex;
    align-items: flex-start;
    margin-top: 0.5rem;
    font-family: 'Courier New', monospace;
}

.terminal-prompt {
    color: var(--success);
    margin-right: 0.5rem;
    user-select: none;
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--light);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    outline: none;
    padding: 0;
}

.hint-box {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.08), rgba(255, 170, 0, 0.12));
    border: 2px solid var(--warning);
    border-radius: 15px;
    padding: 1.5rem;
    margin: 2rem 0;
    box-shadow: 0 4px 15px rgba(255, 170, 0, 0.1);
}

.hint-btn {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.15), rgba(255, 170, 0, 0.25));
    color: var(--warning);
    border: 2px solid var(--warning);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    margin: 0.5rem 0.5rem 0.5rem 0;
    transition: all 0.3s ease;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.hint-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 170, 0, 0.3), transparent);
    transition: left 0.5s;
}

.hint-btn:hover::before {
    left: 100%;
}

.hint-btn:hover {
    background: linear-gradient(135deg, rgba(255, 170, 0, 0.3), rgba(255, 170, 0, 0.4));
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 170, 0, 0.4);
}

.hint-content {
    display: none;
    margin: 1rem 0.5rem 1rem 0;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.6);
    border-left: 4px solid var(--warning);
    border-radius: 8px;
    line-height: 1.8;
    color: var(--light);
    box-shadow: inset 0 0 20px rgba(255, 170, 0, 0.1);
    font-size: 0.95rem;
}

.hint-content::before {
    content: '💡 ';
    font-size: 1.3em;
    margin-right: 0.5rem;
    filter: drop-shadow(0 0 5px rgba(255, 170, 0, 0.5));
}

.hint-content br {
    margin-bottom: 0.5rem;
}

.hint-content code {
    background: rgba(255, 170, 0, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    color: var(--warning);
    font-family: 'Courier New', monospace;
    font-weight: 600;
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.analysis-results {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--secondary);
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    font-family: monospace;
    font-size: 0.9rem;
}

.cipher-box {
    background: rgba(156, 136, 255, 0.1);
    border: 2px solid var(--purple);
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1rem 0;
    text-align: center;
    font-family: monospace;
    word-break: break-all;
}

.tool-section {
    background: rgba(0, 212, 255, 0.05);
    border: 1px solid var(--secondary);
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
}

.tool-btn {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--dark);
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    margin: 0.5rem;
    transition: all 0.3s;
}

.tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 136, 0.4);
}

.flag-input {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.flag-input input {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    color: var(--light);
    font-family: monospace;
    min-width: 300px;
}

.submit-btn {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--dark);
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 255, 136, 0.4);
}

.success-message {
    background: rgba(0, 255, 136, 0.2);
    border: 2px solid var(--success);
    border-radius: 10px;
    padding: 1.5rem;
    margin: 1rem 0;
    text-align: center;
    color: var(--success);
    display: none;
    font-weight: bold;
}

.error-message {
    background: rgba(255, 0, 0, 0.2);
    border: 2px solid var(--danger);
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
    text-align: center;
    color: var(--danger);
    display: none;
}

.hex-viewer {
    background: #000;
    border: 2px solid var(--purple);
    border-radius: 10px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.packet-display {
    background: #000;
    border: 2px solid var(--secondary);
    border-radius: 10px;
    padding: 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    margin: 1rem 0;
    max-height: 300px;
    overflow-y: auto;
}
/* Hints Section */
/* .hints-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1), rgba(255, 152, 0, 0.1));
    border-radius: 12px;
    border: 2px solid rgba(255, 193, 7, 0.3);
}

.hints-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 152, 0, 0.2);
    border-radius: 8px;
    color: #ff9800;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.hints-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.current-points {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
}

.hint-button {
    width: 100%;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.hint-button:hover {
    background: rgba(0, 255, 159, 0.1);
}

.hint-button.hint-used {
    background: rgba(0, 255, 159, 0.15);
}

.hint-content {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--border);
    animation: slideDown 0.3s ease;
} */
.back-challenge-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 0, 0, 0.2);  /* เปลี่ยนเป็นสีแดง */
    color: var(--danger);  /* เปลี่ยนเป็นสีแดง */
    border: 2px solid var(--danger);  /* เปลี่ยนเป็นสีแดง */
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-challenge-btn:hover {
    background: var(--danger);  /* สีแดงเข้มเมื่อ hover */
    color: white;  /* ตัวอักษรเป็นสีขาวเมื่อ hover */
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.4);  /* เงาสีแดง */
}

.back-challenge-btn:active {
    transform: translateX(5px) scale(0.95);
}

/* ปรับ modal-content ให้มีที่สำหรับปุ่ม back */
.modal-content {
    position: relative;
    padding-top: 4rem; /* เพิ่มพื้นที่ด้านบน */
}

/* Points Deduction Animation */
@keyframes pointsDeduct {
    0% { transform: scale(1); color: var(--primary); }
    50% { transform: scale(1.2); color: #ff5252; }
    100% { transform: scale(1); color: var(--primary); }
}

.points-deducted {
    animation: pointsDeduct 0.5s ease;
}

/* Notification */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    background: rgba(10, 14, 39, 0.95);
    border-radius: 8px;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    color: white;
    font-weight: 500;
}

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

.notification-success {
    border-color: var(--success);
}

.notification-error {
    border-color: var(--danger);
}

.notification-warning {
    border-color: var(--warning);
}
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.confirm-overlay.show {
    opacity: 1;
}

.confirm-dialog {
    background: var(--dark);
    border: 2px solid var(--primary);
    border-radius: 15px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.confirm-overlay.show .confirm-dialog {
    transform: scale(1);
}

.confirm-dialog h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.confirm-dialog p {
    color: var(--light);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.confirm-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-cancel, .btn-confirm {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid;
}

.btn-cancel {
    background: transparent;
    border-color: var(--gray);
    color: var(--gray);
}

.btn-cancel:hover {
    background: rgba(136, 146, 176, 0.1);
    border-color: var(--light);
    color: var(--light);
}

.btn-confirm {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.btn-confirm:hover {
    background: #ff0000;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 0, 0.4);
}
/* SQL Interface Styles */
.sql-interface {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.login-panel {
    background: rgba(10, 14, 39, 0.9);
    border: 2px solid var(--primary);
    border-radius: 15px;
    padding: 1.5rem;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--primary);
    margin-bottom: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.status-indicator {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    color: var(--light);
    font-weight: bold;
    font-size: 0.9rem;
}

.login-btn {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    color: var(--dark);
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1.1rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 255, 136, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.result-panel {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    min-height: 60px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.debug-panel {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--secondary);
    border-radius: 15px;
    overflow: hidden;
}

.debug-header {
    background: var(--secondary);
    color: var(--dark);
    padding: 1rem;
    font-weight: bold;
}

.debug-content {
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--light);
    max-height: 300px;
    overflow-y: auto;
}

.filter-panel {
    grid-column: 1 / -1;
    background: rgba(255, 170, 0, 0.1);
    border: 2px solid var(--warning);
    border-radius: 15px;
    overflow: hidden;
}

.filter-header {
    background: rgba(255, 170, 0, 0.2);
    color: var(--warning);
    padding: 1rem;
    font-weight: bold;
}

.filter-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-item {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--light);
}

.filter-item code {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: var(--danger);
}
/* ============================================
   INTERACTIVE WORKSPACE STYLING
   ============================================ */

.workspace-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.workspace-step {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.workspace-step:hover {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.step-header {
    background: rgba(0, 255, 136, 0.1);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid rgba(0, 255, 136, 0.3);
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.step-header h4 {
    margin: 0;
    color: var(--primary);
    font-size: 1.1rem;
}

.step-content {
    padding: 1.5rem;
}

.workspace-input {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary);
    border-radius: 8px;
    color: var(--light);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
    margin-bottom: 1rem;
}

.workspace-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.workspace-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #000;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.workspace-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.4);
}

.workspace-btn:active {
    transform: translateY(0);
}

.workspace-output {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--secondary);
    border-radius: 8px;
    min-height: 60px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--light);
}

.result-box {
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid var(--secondary);
    border-radius: 6px;
    padding: 1rem;
    margin: 0.5rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
    word-break: break-all;
}

.result-box:hover {
    background: rgba(0, 212, 255, 0.2);
    border-color: var(--primary);
}

/* XOR Calculator */
.xor-calculator {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(156, 136, 255, 0.3);
}

.calc-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.calc-row label {
    color: var(--gray);
    font-size: 0.9rem;
    min-width: 60px;
}

.calc-row input {
    flex: 1;
    padding: 0.7rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--primary);
    border-radius: 5px;
    color: var(--light);
    font-family: 'Courier New', monospace;
    text-align: center;
}

.calc-row span {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: bold;
}

.calc-row button {
    padding: 0.7rem 1.2rem;
    background: var(--purple);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.calc-row button:hover {
    background: var(--primary);
    color: #000;
}

.calc-result {
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    min-height: 40px;
    font-family: 'Courier New', monospace;
}

/* Prime Tester */
.prime-tester {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(156, 136, 255, 0.3);
}

/* Operation Buttons */
.operation-btn {
    background: rgba(156, 136, 255, 0.2);
    border: 1px solid var(--purple);
    color: var(--light);
    padding: 0.7rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.operation-btn:hover {
    background: rgba(156, 136, 255, 0.4);
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* Cipher Display */
.cipher-display {
    background: rgba(0, 0, 0, 0.5);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem 0;
}

.cipher-display:hover {
    background: rgba(0, 212, 255, 0.1);
    border-color: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    .workspace-container {
        gap: 1rem;
    }
    
    .step-content {
        padding: 1rem;
    }
    
    .calc-row {
        flex-wrap: wrap;
    }
    
    .calc-row label {
        min-width: 100%;
    }
    
    .operation-btn {
        font-size: 0.85rem;
        padding: 0.6rem 0.8rem;
    }
}

/* Animation */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.workspace-step {
    animation: slideIn 0.5s ease;
}

.workspace-step:nth-child(1) { animation-delay: 0s; }
.workspace-step:nth-child(2) { animation-delay: 0.1s; }
.workspace-step:nth-child(3) { animation-delay: 0.2s; }
.workspace-step:nth-child(4) { animation-delay: 0.3s; }

/* Success Highlight */
.workspace-output:has(strong[style*="success"]) {
    border-color: var(--success);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* Layer History */
#layerHistory {
    line-height: 1.8;
}

#layerHistory:empty::before {
    content: '(ยังไม่มี operations)';
    color: var(--gray);
    font-style: italic;
}

/* Responsive */
@media (max-width: 968px) {
    .sql-interface {
        grid-template-columns: 1fr;
    }
    
    .filter-panel {
        grid-column: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .ctf-categories { grid-template-columns: 1fr; }
    .nav-links { flex-direction: column; gap: 0.5rem; }
    .nav-container { flex-direction: column; gap: 1rem; }
    .sign-in-btn { margin-left: 0 !important; }
    .challenge-header { flex-direction: column; align-items: flex-start; }
    .challenge-right { align-items: flex-start; }
    .flag-input input { min-width: 200px; }
}
/* Enhanced Responsive Design */
@media (max-width: 480px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        padding: 1rem;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        border-top: 2px solid var(--primary);
    }
    
    .back-challenge-btn {
        top: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .notification {
        right: 10px;
        left: 10px;
        max-width: calc(100% - 20px);
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }
}
