:root {
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --text-color: #2d3748;
    --heading-color: #1a202c;
    --card-bg: rgba(255, 255, 255, 0.95);
    --primary-color: #4facfe;
    --primary-gradient: linear-gradient(to right, #4facfe 0%, #00f2fe 100%);
    --primary-hover: #00c6fb;
    --accent-color: #43e97b;
    --accent-gradient: linear-gradient(to right, #43e97b 0%, #38f9d7 100%);
    --danger-color: #ff0844;
    --danger-gradient: linear-gradient(to right, #ff0844 0%, #ffb199 100%);
    --border-radius: 16px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-image: var(--bg-gradient);
    background-color: #f5f7fa;
    background-attachment: fixed;
    background-clip: padding-box;
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    /* Changed for footer positioning */
    align-items: center;
    /* Center container horizontally */
    min-height: 100vh;
    padding: 25px 15px;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 10px;
}

header h1 {
    color: #2d3748;
    font-size: 26px;
    margin-bottom: 0;
    font-weight: 800;
    letter-spacing: 0.05em;
}

header p {
    color: #4a5568;
    font-size: 1.1rem;
    margin-top: 10px;
}

.logo-title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.header-logo {
    height: 40px;
    width: auto;
}

@media (max-width: 600px) {

    header h1,
    body:not(.dashboard-body):not(.login-page) header h1,
    .dashboard-body header h1 {
        font-size: 20px;
    }

    .header-logo {
        height: 32px;
    }

    .logo-title-container {
        gap: 10px;
    }
}

.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 30px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.hidden {
    display: none !important;
}

/* Input Section */
.input-group {
    margin-bottom: 24px;
}

.row {
    display: flex;
    gap: 20px;
}

.input-group.half {
    flex: 1;
}

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--heading-color);
    font-size: 0.95rem;
}

.input-group input,
.input-group select,
.input-group textarea,
.form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-color);
    background-color: #f8fafc;
    transition: all 0.2s ease;
    font-family: inherit;
    appearance: none;
}

.input-group select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2em;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus,
.form-control:focus {
    outline: none;
    border-color: #4facfe;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

/* Buttons */
.btn {
    display: inline-block;
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn.primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 6px rgba(79, 172, 254, 0.3);
    margin-bottom: 10px;
    /* Spacing */
}

.btn.primary:hover {
    box-shadow: 0 7px 14px rgba(79, 172, 254, 0.4);
    transform: translateY(-2px);
}

.btn.primary:active {
    transform: translateY(1px);
}

.btn.accent {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 6px rgba(67, 233, 123, 0.3);
}

.btn.accent:hover {
    box-shadow: 0 7px 14px rgba(67, 233, 123, 0.4);
    transform: translateY(-2px);
}

.btn.secondary {
    background-color: #edf2f7;
    color: #4a5568;
}

.btn.secondary:hover {
    background-color: #e2e8f0;
    color: #2d3748;
}

/* Loader */
#loading-section {
    text-align: center;
    padding: 60px 20px;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4facfe;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Question Editor */
.question-item {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

.question-item h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: #2d3748;
}

/* Quiz Play UI */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.badge {
    background: #e2e8f0;
    color: #2d3748;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
}

.badge.score {
    background: #bee3f8;
    color: #2c5282;
}

.badge.timer {
    background: #fed7d7;
    color: #9b2c2c;
    font-family: monospace;
    font-size: 1.1rem;
}

#question-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-color);
    margin-bottom: 40px;
    line-height: 1.4;
    text-align: center;
}

.options-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.option-btn {
    width: 100%;
    text-align: center;
    padding: 20px;
    background-color: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.option-btn:hover:not(:disabled) {
    border-color: #4facfe;
    background-color: #ebf8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.option-btn.correct {
    background: #c6f6d5;
    border-color: #48bb78;
    color: #22543d;
}

.option-btn.wrong {
    background: #fed7d7;
    border-color: #f56565;
    color: #742a2a;
}

.feedback {
    margin-top: 30px;
    padding: 24px;
    background: #f8fafc;
    border-radius: 12px;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#result-section {
    text-align: center;
}

.result-score {
    font-size: 4rem;
    font-weight: 800;
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    /* margin: 20px 0; */
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    color: #4a5568;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--heading-color);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ranking-table th,
.ranking-table td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.ranking-table th {
    background: #f7fafc;
    font-weight: 600;
    color: #4a5568;
}

.ranking-table tr.highlight {
    background: #ebf8ff;
    font-weight: bold;
}

/* Footer Style */
/* Footer Style */
.site-footer {
    margin-top: auto;
    padding: 20px 20px 10px;
    text-align: center;
    width: 100%;
}

.footer-message {
    font-size: 0.95rem;
    font-weight: 800;
    color: #2d3748;
    margin-bottom: 15px;
    padding-bottom: 15px;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #a0aec0;
    margin-left: -40px;
    margin-right: -40px;
}

.footer-logo-link {
    display: inline-block;
    margin-bottom: 0px;
    transition: transform 0.3s ease;
}

.footer-logo-link:hover {
    transform: translateY(-3px);
}

.footer-logo {
    height: 75px;
    /* Increased to 2x size */
    width: auto;
    display: block;
    margin: 0 auto;
    /* Enhance centering if needed */
}

.copyright {
    color: #4a5568;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.copyright a {
    color: inherit;
    text-decoration: none;
}

.copyright a:hover {
    color: #718096;
}

@media (max-width: 600px) {
    .row {
        flex-direction: column;
        gap: 0;
    }

    .input-group.half {
        width: 100%;
    }

    body:not(.dashboard-body):not(.login-page) header h1 {
        font-size: 20px;
    }

    .dashboard-body header h1 {
        font-size: 30px;
    }

    #question-text {
        font-size: 18px;
    }

    .option-btn {
        font-size: 15px;
    }

    .card {
        padding: 10px;
    }
}

@media (min-width: 600px) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Login Page Specifics */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 30px;
    color: #2d3748;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #4a5568;
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    background: #f8fafc;
    transition: all 0.2s;
    outline: none;
}

.login-card input:focus {
    border-color: #4facfe;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.2);
}

.error-msg {
    color: #e53e3e;
    background: #fff5f5;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* Responsive Line Break */
.sp-br {
    display: none;
}

@media (max-width: 768px) {
    .sp-br {
        display: inline;
    }
}


/* Admin Footer Specifics */
.site-footer.admin-footer {
    background: #fff;
    border-top: 1px solid #e2e8f0;
}

/* Adjust negative margins for admin context */
.site-footer.admin-footer .footer-message {
    margin-left: -20px;
    margin-right: -20px;
    border-bottom: 1px solid #e2e8f0;
}

@media (min-width: 900px) {

    /* Fixed Footer */
    .site-footer.admin-footer {
        position: fixed;
        bottom: 0;
        right: 0;
        width: calc(100% - 260px);
        z-index: 80;
        box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.05);
        background: #fff;
    }

    /* Fixed Sidebar Header */
    .sidebar-header {
        padding: 30px;
        font-size: 1.3rem;
        font-weight: 800;
        color: var(--heading-color);
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    /* Header Styling (Position handled by internal styles) */
    .top-bar {
        z-index: 89;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
    }

    /* Scrollable Content Area adjustments */
    .main-content,
    .content-area {
        padding-bottom: 350px !important;
        /* Ample space for footer */
    }

    /* Adjust for fixed header in wrapped layouts */
    .main-wrapper .content-area {
        /* margin-top: 80px; */
        padding-top: 20px;
    }
}

.page-title {
    margin: 0;
    font-size: 1.4rem;
}

@media (max-width: 768px) {
    .page-title {
        font-size: 1.1rem;
    }
}

/* URL Header in Card (Responsive Negative Margins) */
.url-section-header {
    margin: -40px -40px 20px -40px;
    padding: 20px 40px;
    background: #fafbfc;
    border-bottom: 1px solid #e2e8f0;
}

@media (max-width: 600px) {
    .url-section-header {
        margin: -10px -10px 30px -10px;
        padding: 15px 15px;
    }
}