/* ══════════════════════════════════════════════════════════
   MATIX — Global Design System  v2.0
   Dark deep-space indigo theme
══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Vibur&display=swap');

/* ── Design Tokens ──────────────────────────────────────── */
:root {
    --bg:            #020712;
    --bg-2:          #0f172a;
    --bg-card:       rgba(15, 23, 42, 0.76);
    --accent:        #818cf8;
    --accent-bright: #a5b4fc;
    --accent-dim:    rgba(129, 140, 248, 0.18);
    --accent-2:      #fb923c;
    --accent-3:      #38bdf8;
    --accent-green:  #4ade80;
    --text:          #f8fafc;
    --text-muted:    #94a3b8;
    --text-faint:    #64748b;
    --border:        rgba(129, 140, 248, 0.28);
    --border-hover:  rgba(129, 140, 248, 0.55);
    --radius-sm:     10px;
    --radius:        16px;
    --radius-lg:     22px;
    --shadow-card:   0 8px 40px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.07);
    --shadow-btn:    0 4px 18px rgba(99, 102, 241, 0.35);
    --font-head:     'Vibur', cursive;
    --font-body:     'Segoe UI', system-ui, -apple-system, sans-serif;
    --transition:    0.22s ease;

    /* Merged Challenge variables here safely without overwriting main theme tokens */
    --card-bg:       #1e293b;
    --accent-neon:   #38bdf8;
    --accent-red:    #f87171;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ───────────────────────────────────────────────── */
html { 
    overflow-y: auto !important; 
    height: 100% !important;
}

body {
    background:
        radial-gradient(ellipse at 15% 10%, rgba(30, 58, 138, 0.32) 0%, transparent 50%),
        radial-gradient(ellipse at 88% 82%, rgba(124, 58, 237, 0.20) 0%, transparent 45%),
        var(--bg);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    width: 100vw !important;
    line-height: 1.65;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important; 
    display: block !important; 
    box-sizing: border-box !important;
}

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 , p{
    font-family: var(--font-head);
    letter-spacing: 1px;
    line-height: 1.2;
    color: var(--text);
}
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.5rem); color: var(--accent-bright); }
p  { color: var(--text-muted); line-height: 1.7; }
a  { color: var(--accent-3); text-decoration: none; transition: color var(--transition); }
a:hover { color: #7dd3fc; text-decoration: underline; }
strong { color: var(--accent-bright); }

/* ── Glass Card ─────────────────────────────────────────── */
.card, .glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    animation: fadeSlideIn 0.5s ease;
}
.card::before, .glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(129,140,248,0.15), rgba(129,140,248,0.05));
    pointer-events: none;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn, a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font-head);
    font-size: 1.1rem;
    letter-spacing: 1px;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, #4338ca, #6366f1, #818cf8);
    color: #fff;
    border-color: rgba(129,140,248,0.5);
    box-shadow: var(--shadow-btn);
    overflow: hidden;
    position: relative;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(99,102,241,0.5);
    filter: brightness(1.1);
    text-decoration: none;
    color: #fff;
}
.btn-secondary {
    background: rgba(15, 23, 42, 0.8);
    color: var(--accent-bright);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    text-decoration: none;
}
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ── Inputs ─────────────────────────────────────────────── */
input:not([type="radio"]):not([type="checkbox"]):not([type="color"]),
textarea,
select {
    background: rgba(2, 6, 23, 0.75);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 11px 14px;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
input:not([type="radio"]):not([type="checkbox"]):not([type="color"]):focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(129,140,248,0.18);
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.28); }

/* ── Nav bar ────────────────────────────────────────────── */
.site-nav {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 22px;
    background: rgba(2, 7, 18, 0.88);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
}
.nav-logo {
    font-family: var(--font-head);
    font-size: 1.4rem;
    color: var(--accent-bright);
    margin-right: auto;
    text-decoration: none;
}
.nav-link {
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-head);
    font-size: 1.05rem;
    border: 1px solid transparent;
    transition: all var(--transition);
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    color: var(--accent);
    border-color: var(--border);
    background: var(--accent-dim);
    text-decoration: none;
}

/* ── Page wrapper ───────────────────────────────────────── */
.page-wrap { max-width: 860px; margin: 0 auto; padding: 36px 20px; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0a0f20; }
::-webkit-scrollbar-thumb { background: rgba(129,140,248,0.35); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(129,140,248,0.60); }

/* ── Utilities ──────────────────────────────────────────── */
.text-accent   { color: var(--accent); }
.text-accent-2 { color: var(--accent-2); }
.text-muted    { color: var(--text-muted); }
.hidden        { display: none !important; }

/* ── Animations ─────────────────────────────────────────── */
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes inputShake {
    0%,100% { transform: translateX(0); }
    20%,60% { transform: translateX(-6px); }
    40%,80% { transform: translateX(6px); }
}

.very-cool-text {
    font-size: 1.1rem;
    color: var(--text-faint);
    margin-top: 12px;
    animation: fadeSlideIn 0.8s ease;
}

.vertical-spacer {
    height: 12px;
}

.problem-text {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 18px;
}

.button {
    background: linear-gradient(135deg, #4338ca, #6366f1, #818cf8);
    color: #fff;
    border-color: rgba(129,140,248,0.5);
    box-shadow: var(--shadow-btn);
    overflow: hidden;
    position: relative;
}

.invisible {
    display: none !important;
}

/* ── Page Layouts Safe Center Block ── */
.challenge-container-view {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
}

.challenge-card {
    background-color: var(--card-bg);
    border: 2px solid #334155;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    text-align: center;
}

.header-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: bold;
}

.streak-badge {
    color: var(--accent-green);
    background: rgba(74, 222, 128, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.timer-badge {
    color: var(--accent-neon);
    background: rgba(56, 189, 248, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.sub-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.problem-box {
    font-size: 1.5rem;
    color: rgb(255, 255, 255);
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background-color: rgba(104, 222, 255, 0.419);
    border: 1px solid var(--border);
}

.input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

input[type="number"] {
    flex: 1;
    background: #0f172a;
    border: 2px solid #334155;
    border-radius: 8px;
    padding: 0.75rem;
    color: #fff;
    font-size: 1.2rem;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

input[type="number"]:focus {
    border-color: var(--accent-neon);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

button {
    background-color: var(--accent-neon);
    color: #0f172a;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

button:hover {
    opacity: 0.9;
}

button:active {
    transform: scale(0.98);
}

.feedback {
    min-height: 1.5rem;
    font-weight: 600;
    margin-top: 1rem;
}

.success { color: var(--accent-green); }
.error { color: var(--accent-red); }

.difficulty-box { 
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(18, 89, 255, 0.8), rgba(15, 23, 42, 0.6));
    border: 1px solid var(--border);
    color: #38bdf8;
}


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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
}

.qr-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.qr-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #0f172a;
}

.subtitle {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 28px;
}

.input-group {
    width: 100%;
    margin-bottom: 16px;
}

input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: all 0.2s ease;
}

input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

button {
    width: 100%;
    background-color: #2563eb;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    padding: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #1d4ed8;
}

/* Secondary styling variant specifically for downloads */
.secondary-btn {
    background-color: #0f172a;
    margin-top: 16px;
}

.secondary-btn:hover {
    background-color: #1e293b;
}

.qr-display {
    margin-top: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 220px;
}

/* Formats the raw generated element output */
.qr-display canvas, .qr-display img {
    padding: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    max-width: 100%;
    height: auto;
}

.action-container {
    transition: opacity 0.3s ease;
}

.hidden {
    display: none;
    opacity: 0;
}

.ideas-header {
    text-align: center;
    margin-bottom: 24px;
}

.ideas-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
}

.ideas-header h4 {
    font-size: 1.085rem;
    margin-block-start: 1.17em; 
    margin-block-end: 1.17em;
    color: #002f70;
    margin-top: 8px;
}

.ideas-adder {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.submit-area {
    display: flex;
    gap: 8px;
    width: 100%;
    max-width: 500px;
}

.ideas-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.ideas-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 500px;
    margin: 0 auto;
}

.idea-text {
    background: #f1f5f9;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    color: #1e293b;
    font-size: 1rem;
}

.idea-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

.delete-button, .like-button, .comment-button {
    background: #e11d48;
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.comments-section {
    margin-top: 12px;
    padding-left: 16px;
    border-left: 2px solid #e2e8f0;
}