@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

:root {
    --ink: #000000;
    --paper: #FCFBF5;
    --blue: #3355FF;
    --yellow: #FFDE00;
    --pink: #FF3E7F;
    --green: #00C853;
    --sh-sm: 2px 2px 0 0 var(--ink);
    --sh: 4px 4px 0 0 var(--ink);
    --sh-lg: 8px 8px 0 0 var(--ink);
}

* { font-family: 'Inter', sans-serif; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--paper);
    color: var(--ink);
    background-image: radial-gradient(rgba(0,0,0,0.09) 1.4px, transparent 1.4px);
    background-size: 22px 22px;
    -webkit-tap-highlight-color: transparent;
}

button, select, a, input, label {
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.15s ease, color 0.15s ease;
}
img, canvas { max-width: 100%; height: auto; }

.gradient-header {
    background: var(--blue);
    border: 3px solid var(--ink);
    border-radius: 0;
    box-shadow: var(--sh-lg);
    position: relative;
}

.card-shadow {
    border: 3px solid var(--ink);
    box-shadow: var(--sh);
    border-radius: 0 !important;
}

.spinner {
    border: 4px solid rgba(0,0,0,0.15);
    border-left-color: var(--blue);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }

.footer-link {
    transition: color 0.15s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
}
.footer-link:hover { color: var(--pink); transform: translate(-2px, -2px); }

.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: overlayFade 0.2s ease;
}
.modal-overlay.hidden { display: none; }
@keyframes overlayFade { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: var(--paper);
    border: 3px solid var(--ink);
    border-radius: 0;
    max-width: 640px;
    width: 100%;
    padding: 2rem;
    box-shadow: var(--sh-lg);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    animation: modalPop 0.22s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
@keyframes modalPop {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-content.max-w-4xl { max-width: 960px; }

.modal-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    background: var(--yellow);
    border: 2.5px solid var(--ink);
    border-radius: 0;
    width: 2.25rem;
    height: 2.25rem;
    line-height: 1;
    font-size: 1.5rem;
    color: var(--ink);
    cursor: pointer;
    box-shadow: var(--sh-sm);
}
.modal-close:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 0 var(--ink); }
.modal-close:active { transform: translate(0,0); box-shadow: 0 0 0 0 var(--ink); }
@media (max-width: 480px) {
    .modal-content { padding: 1.25rem; }
    .modal-close { top: 0.5rem; right: 0.5rem; width: 2rem; height: 2rem; font-size: 1.3rem; }
}

.toast {
    background: var(--ink);
    color: var(--paper);
    padding: 12px 16px;
    border: 2.5px solid var(--ink);
    border-radius: 0;
    box-shadow: var(--sh);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 280px;
    max-width: 90vw;
    animation: toastIn 0.25s ease;
    border-left: 6px solid var(--yellow);
}
.toast i { font-size: 1.2rem; color: var(--yellow); }
.toast .toast-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.8;
    background: none;
    border: none;
    color: var(--paper);
    font-size: 1.2rem;
}
.toast .toast-close:hover { opacity: 1; }
@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}

#mobileMenu:not(.hidden) { animation: menuDrop 0.18s ease; }
@keyframes menuDrop {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

#tableBody tr { transition: background-color 0.12s ease; }
#tableBody tr:hover { background-color: rgba(255,222,0,0.35); }

a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

#historyContainer::-webkit-scrollbar, .overflow-x-auto::-webkit-scrollbar { height: 10px; width: 8px; }
#historyContainer::-webkit-scrollbar-thumb, .overflow-x-auto::-webkit-scrollbar-thumb { background: var(--ink); }
#historyContainer::-webkit-scrollbar-track, .overflow-x-auto::-webkit-scrollbar-track { background: transparent; }
.overflow-x-auto { -webkit-overflow-scrolling: touch; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}