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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: #16213e;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 560px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* ─── Contest header ─────────────────────────────────────────────────── */

.contest-title {
    font-size: 32px;
    margin-bottom: 6px;
    color: #e94560;
    text-align: center;
    word-break: break-word;
}

.contest-title.placeholder {
    color: #666;
    font-size: 22px;
}

/* ─── Deadline ───────────────────────────────────────────────────────── */

.deadline {
    text-align: center;
    margin-bottom: 24px;
    padding: 8px 16px;
    background: #1b4332;
    border-radius: 8px;
    font-size: 15px;
}

.deadline.deadline-passed {
    background: #3e1a1a;
}

.deadline-label {
    color: #aaa;
    margin-right: 6px;
}

.deadline-time {
    color: #52b788;
    font-weight: 600;
}

.deadline-passed .deadline-time {
    color: #e94560;
    text-decoration: line-through;
}

.deadline-countdown {
    display: block;
    font-size: 16px;
    font-weight: 700;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

/* ─── Inputs ─────────────────────────────────────────────────────────── */

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #0f3460;
    border-radius: 8px;
    background: #1a1a2e;
    color: #eee;
    font-size: 16px;
    margin-bottom: 12px;
    transition: border 0.2s;
}

input:focus {
    outline: none;
    border-color: #e94560;
}

input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="file"] {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #0f3460;
    border-radius: 8px;
    background: #1a1a2e;
    color: #aaa;
    font-size: 14px;
    transition: border 0.2s;
}

input[type="file"]:focus {
    outline: none;
    border-color: #e94560;
}

/* ─── Buttons ────────────────────────────────────────────────────────── */

.btn {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: #e94560;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #d63851;
}

.btn-outline {
    background: transparent;
    color: #e94560;
    border: 2px solid #e94560;
}

.btn-outline:hover {
    background: #e94560;
    color: #fff;
}

.btn-sm {
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
}

/* ─── Flash messages ─────────────────────────────────────────────────── */

.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.flash-success {
    background: #1b4332;
    color: #52b788;
    border: 1px solid #2d6a4f;
}

.flash-error {
    background: #3e1a1a;
    color: #e94560;
    border: 1px solid #6b2222;
}

.flash-info {
    background: #1a2a3e;
    color: #89c2ff;
    border: 1px solid #1e4a6b;
}

/* ─── User form ──────────────────────────────────────────────────────── */

.user-form {
    margin: 8px 0;
}

/* ─── Success message ────────────────────────────────────────────────── */

.success-message {
    text-align: center;
    padding: 20px 0;
}

.success-message .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.success-message h2 {
    color: #52b788;
    margin-bottom: 8px;
}

.success-message p {
    color: #aaa;
    margin-top: 4px;
}

/* ─── Admin section ──────────────────────────────────────────────────── */

.admin-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #0f3460;
}

.admin-login {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.admin-login input {
    flex: 1;
    margin-bottom: 0;
}

.admin-login .btn {
    width: auto;
    white-space: nowrap;
}

.admin-error {
    color: #e94560;
    font-size: 13px;
    margin-top: 6px;
    padding: 6px 10px;
    background: #3e1a1a;
    border-radius: 6px;
}

/* ─── Modal ──────────────────────────────────────────────────────────── */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: #16213e;
    border-radius: 12px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 0 24px;
}

.modal-header h2 {
    color: #e94560;
    font-size: 22px;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #e94560;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px 20px 24px;
}

.modal-footer .btn {
    width: auto;
    padding: 10px 32px;
}

.modal-status {
    font-size: 14px;
    color: #aaa;
}

/* ─── Upload blocks ──────────────────────────────────────────────────── */

.upload-block {
    margin-bottom: 16px;
}

.upload-label {
    display: block;
    color: #aaa;
    font-size: 14px;
    margin-bottom: 6px;
}

.upload-label code {
    background: #1a1a2e;
    padding: 2px 6px;
    border-radius: 4px;
    color: #89c2ff;
    font-size: 13px;
}

.upload-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.upload-row .btn {
    width: auto;
    white-space: nowrap;
}

.upload-status {
    display: block;
    font-size: 13px;
    color: #52b788;
    margin-top: 4px;
}

/* ─── Settings block ─────────────────────────────────────────────────── */

hr {
    border: none;
    border-top: 1px solid #0f3460;
    margin: 20px 0;
}

.settings-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    color: #ccc;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #e94560;
    cursor: pointer;
    flex-shrink: 0;
}

.swap-config {
    margin-left: 30px;
    margin-top: -4px;
    margin-bottom: 4px;
}

.swap-config input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #0f3460;
    border-radius: 8px;
    background: #1a1a2e;
    color: #eee;
    font-size: 14px;
    font-family: 'Consolas', 'Courier New', monospace;
    margin-bottom: 4px;
    transition: border 0.2s;
}

.swap-config input[type="text"]:focus {
    outline: none;
    border-color: #e94560;
}

.swap-hint {
    font-size: 12px;
    color: #666;
}

/* ─── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 12px;
    }

    .contest-title {
        font-size: 24px;
    }

    .modal {
        max-width: 95vw;
        margin: 12px;
    }

    .admin-login {
        flex-direction: column;
    }

    .admin-login .btn {
        width: 100%;
    }
}
