/* Align visuals with quiz-app-flask theme */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');
/* Removed Bootstrap Icons CSS; using local SVGs */

/* Global box-sizing to avoid overflow on 100% width elements */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

/* Theming */
:root {
    /* Primary palette tuned to quiz-app */
    --accent: #00c6ff;
    --primary-color: var(--accent);
    --radius-lg: 16px;
    --radius-md: 12px;
    --blur: 18px;
    --transition-fast: 160ms;
    --background-color: #0f0c29;
    --bg-gradient-a: #24243e;
    --bg-gradient-b: #302b63;
    --bg-gradient-c: #0f0c29;
    --background-gradient: linear-gradient(120deg, var(--bg-gradient-a), var(--bg-gradient-b), var(--bg-gradient-c));
    --card-background-color: rgba(255,255,255,0.55);
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-tint: rgba(15,12,41,0.35);
    --glass-blur: 20px;
    --glass-border: rgba(255, 255, 255, 0.22);
    --text-color: #e5e7eb;
    --text-muted-color: #c7d2fe;
    --tab-inactive-color: #94a3b8;
    --shadow-color: rgba(0,0,0,0.35);
    --secondary-color: #0072ff;
}

body[data-theme="light"],
body.light-theme {
    --background-color: #f7f9fc;
    --bg-gradient-a: #e9eef6;
    --bg-gradient-b: #ffffff;
    --bg-gradient-c: #f0f4fa;
    --background-gradient: linear-gradient(135deg, var(--bg-gradient-a), var(--bg-gradient-b));
    --card-background-color: rgba(255,255,255,0.55);
    --glass-bg: rgba(255,255,255,0.55);
    --glass-border: rgba(15, 23, 42, 0.08);
    --text-color: #0f172a;
    --text-muted-color: #64748b;
    --shadow-color: rgba(2, 6, 23, 0.1);
}

body[data-theme="dark"],
body.dark-theme {
    --background-color: #0f0c29;
    --bg-gradient-a: #24243e;
    --bg-gradient-b: #302b63;
    --bg-gradient-c: #0f0c29;
    --background-gradient: linear-gradient(120deg, var(--bg-gradient-a), var(--bg-gradient-b), var(--bg-gradient-c));
    --card-background-color: rgba(16,22,32,0.42);
    --glass-bg: rgba(16,22,32,0.4);
    --glass-border: rgba(255,255,255,0.18);
    --text-color: #e5e7eb;
    --text-muted-color: #c7d2fe;
    --tab-inactive-color: #9aa3af;
    --shadow-color: rgba(0,0,0,0.32);
}

/* Escuro Profundo (Midnight). Keep star as alias for compat */
body[data-theme="midnight"],
body[data-theme="star"],
body.starry-theme {
    /* Starry theme (quiz-app) */
    --background-color: #070b1a;
    --bg-gradient-a: #0a1130;
    --bg-gradient-b: #0b1333;
    --bg-gradient-c: #070b1a;
    --background-gradient: radial-gradient(1200px 600px at 20% 10%, #0a1130 0%, rgba(10,17,48,0.0) 55%),
                           radial-gradient(1000px 500px at 80% 90%, #0b1333 0%, rgba(11,19,51,0.0) 55%),
                           #070b1a;
    --card-background-color: rgba(9,14,26,0.5);
    --glass-bg: rgba(9,14,26,0.46);
    --glass-border: rgba(255,255,255,0.18);
    --text-color: #dfe7ff;
    --text-muted-color: #bcd9ff;
    --tab-inactive-color: #9fb3c8;
    --shadow-color: rgba(0,0,0,0.55);
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background: var(--background-gradient);
    background-size: 200% 200%;
    animation: bg-pan 24s ease infinite;
    /* Padding na parte inferior para não ser coberto pela nav-bar */
    padding-bottom: 80px; 
}

@keyframes bg-pan {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Background shapes container (instead of body::before/after) */
.background-shapes {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.background-shapes::before,
.background-shapes::after {
    content: "";
    position: absolute;
    filter: blur(80px) hue-rotate(0deg);
    opacity: 0.55;
    will-change: transform, filter, opacity;
}
.background-shapes::before {
    width: 60vmin; height: 60vmin;
    left: -10vmin; top: -10vmin;
    background: radial-gradient(closest-side, rgba(0,198,255,0.55), transparent 70%);
    animation: blob-move-a 42s ease-in-out infinite alternate, blob-hue 60s linear infinite;
}
.background-shapes::after {
    width: 70vmin; height: 70vmin;
    right: -10vmin; bottom: -10vmin;
    background: radial-gradient(closest-side, rgba(0,114,255,0.55), transparent 70%);
    animation: blob-move-b 36s ease-in-out infinite alternate, blob-hue 60s linear infinite;
}
@keyframes blob-move-a { 0%{ transform: translate(0,0) scale(1);} 100%{ transform: translate(10vmin, 6vmin) scale(1.1);} }
@keyframes blob-move-b { 0%{ transform: translate(0,0) scale(1);} 100%{ transform: translate(-8vmin, -4vmin) scale(1.08);} }
@keyframes blob-hue { to { filter: blur(80px) hue-rotate(360deg); } }

/* Override shapes to starfield for midnight/star theme */
body[data-theme="midnight"] .background-shapes::before,
body[data-theme="midnight"] .background-shapes::after,
body[data-theme="star"] .background-shapes::before,
body[data-theme="star"] .background-shapes::after,
body.starry-theme .background-shapes::before,
body.starry-theme .background-shapes::after {
    filter: none;
    opacity: 1;
    width: 2px; height: 2px;
    background: transparent;
    box-shadow:
      20px 40px #fff,
      120px 60px #cfe7ff,
      240px 120px #9fc9ff,
      360px 30px #ffffff,
      480px 200px #d7ecff,
      600px 140px #bcd9ff,
      720px 80px #eaf4ff,
      840px 220px #ffffff,
      960px 40px #d7ecff,
      1080px 160px #9fc9ff,
      50vw 20vh #ffffff,
      10vw 70vh #cfe7ff,
      30vw 40vh #9fc9ff,
      70vw 30vh #ffffff,
      85vw 65vh #d7ecff,
      60vw 80vh #bcd9ff,
      25vw 20vh #eaf4ff,
      40vw 75vh #ffffff,
      75vw 55vh #d7ecff,
      15vw 35vh #9fc9ff,
      5vw 10vh #fff,
      92vw 12vh #cfe7ff,
      80vw 5vh #9fc9ff,
      8vw 85vh #ffffff,
      55vw 92vh #d7ecff,
      35vw 88vh #bcd9ff,
      18vw 60vh #eaf4ff,
      66vw 44vh #ffffff,
      88vw 32vh #d7ecff,
      42vw 18vh #9fc9ff;
    animation: star-twinkle 7s ease-in-out infinite alternate, star-drift-a 120s linear infinite;
}

body[data-theme="midnight"] .background-shapes::after,
body[data-theme="star"] .background-shapes::after,
body.starry-theme .background-shapes::after {
    width: 1px; height: 1px;
    opacity: 0.9;
    box-shadow:
      12px 220px #ffffff,
      160px 180px #cfe7ff,
      280px 60px #9fc9ff,
      400px 260px #ffffff,
      520px 120px #d7ecff,
      640px 20px #bcd9ff,
      760px 160px #eaf4ff,
      880px 300px #ffffff,
      1000px 200px #d7ecff,
      1120px 40px #9fc9ff,
      5vw 50vh #ffffff,
      18vw 22vh #cfe7ff,
      28vw 66vh #9fc9ff,
      46vw 12vh #ffffff,
      58vw 70vh #d7ecff,
      62vw 28vh #bcd9ff,
      72vw 84vh #eaf4ff,
      82vw 16vh #ffffff,
      90vw 46vh #d7ecff,
      96vw 78vh #9fc9ff,
      12vw 14vh #ffffff,
      22vw 88vh #d7ecff,
      32vw 72vh #9fc9ff,
      44vw 48vh #ffffff,
      52vw 22vh #d7ecff,
      68vw 36vh #bcd9ff,
      74vw 58vh #eaf4ff,
      84vw 26vh #ffffff,
      26vw 56vh #d7ecff,
      14vw 42vh #9fc9ff;
    animation: star-twinkle 9s ease-in-out infinite alternate, star-drift-b 180s linear infinite;
}

@keyframes star-twinkle { 0% { opacity: 0.72; } 50% { opacity: 1; } 100% { opacity: 0.78; } }
@keyframes star-drift-a { 0% { transform: translate(0,0); } 50% { transform: translate(40px, -20px); } 100% { transform: translate(80px, -40px); } }
@keyframes star-drift-b { 0% { transform: translate(0,0); } 50% { transform: translate(-50px, 25px); } 100% { transform: translate(-100px, 50px); } }

/* Shooting star (meteor) visuals */
body[data-theme="midnight"] .background-shapes .meteor,
body[data-theme="star"] .background-shapes .meteor,
body.starry-theme .background-shapes .meteor {
    position: absolute;
    width: 2px; height: 2px; /* anchor point */
    pointer-events: none;
    z-index: 1;
    transform: rotate(var(--angle, -40deg));
    opacity: 0.95;
}
body[data-theme="midnight"] .background-shapes .meteor::before,
body[data-theme="star"] .background-shapes .meteor::before,
body.starry-theme .background-shapes .meteor::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: var(--len, 140px);
    height: 2px;
    background: linear-gradient(90deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.65) 30%, rgba(255,255,255,0.0) 80%);
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.7)) drop-shadow(0 0 12px rgba(90,150,255,0.4));
    transform: translateX(0);
    animation: meteor-travel var(--dur, 4s) linear forwards;
}
@keyframes meteor-travel {
  0% { transform: translateX(0); opacity: 1; }
  92% { opacity: 1; }
  100% { transform: translateX(calc(100vw + 260px)); opacity: 0; }
}

/* Minimal layout utilities to replace Bootstrap dependencies */
.container { max-width: 720px; margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; }
.row { display: flex; flex-wrap: wrap; margin: 0 -8px; }
.col-12 { flex: 0 0 100%; padding: 0 8px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mt-2 { margin-top: .5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.p-0 { padding: 0 !important; }
.p-4 { padding: 1.5rem !important; }
.p-3 { padding: 1rem !important; }
.py-4 { padding-top: 1.5rem !important; padding-bottom: 1.5rem !important; }
.text-center { text-align: center !important; }
.text-muted { color: var(--text-muted-color) !important; }
.d-none { display: none !important; }
.d-grid { display: grid !important; }
.gap-2 { gap: .5rem; }
.list-group { display: flex; flex-direction: column; gap: 8px; }
.list-group-item { padding: 12px; border-radius: 12px; border: 1px solid var(--glass-border); }

/* Headings mimic */
.h4 { font-size: 1.25rem; font-weight: 700; }
.h5 { font-size: 1.1rem; font-weight: 700; }

/* Form elements */
.form-label { display: block; font-weight: 600; margin-bottom: 6px; }
.form-control, .form-select { width: 100%; padding: 10px 12px; border-radius: 12px; font-size: 1rem; }
.form-check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.form-check-input { appearance: none; width: 42px; height: 26px; border-radius: 9999px; background: rgba(0,0,0,0.12); position: relative; outline: none; cursor: pointer; transition: background .2s ease; border: 1px solid var(--glass-border); }
.form-check-input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform .2s ease; }
.form-check-input:checked { background: var(--primary-color); }
.form-check-input:checked::after { transform: translateX(16px); }
.form-check-label { font-size: .95rem; }

/* Alerts */
.alert { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--glass-border); }
.alert-success { background: rgba(16,185,129,0.12); color: #065f46; border-color: rgba(16,185,129,0.2); }
/* Offline banner */
.offline-banner { background: #fffbeb; color: #92400e; border: 1px solid rgba(146,64,14,0.2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: .95rem; }
body[data-theme="dark"] .offline-banner,
body[data-theme="midnight"] .offline-banner { background: rgba(146,64,14,0.15); color: #f7e1c1; border-color: rgba(146,64,14,0.25); }

/* Spinner */
.spinner { width: 28px; height: 28px; border: 3px solid rgba(0,0,0,0.1); border-top-color: var(--primary-color); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Autocomplete */
.autocomplete-list { position: absolute; inset: auto auto auto auto; background: rgba(255,255,255,0.96); border: 1px solid var(--glass-border); border-radius: 12px; box-shadow: 0 18px 36px var(--shadow-color); overflow: hidden; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body[data-theme="dark"] .autocomplete-list,
body[data-theme="midnight"] .autocomplete-list { background: rgba(16,22,32,0.94); }
.autocomplete-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; color: var(--text-color); cursor: pointer; }
.autocomplete-item:hover, .autocomplete-item.active { background: rgba(0,0,0,0.06); }
body[data-theme="dark"] .autocomplete-item:hover,
body[data-theme="midnight"] .autocomplete-item:hover,
body[data-theme="dark"] .autocomplete-item.active,
body[data-theme="midnight"] .autocomplete-item.active { background: rgba(255,255,255,0.08); }
.autocomplete-highlight { background: rgba(10,132,255,0.18); border-radius: 4px; padding: 0 2px; }
.mini-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(0,0,0,0.15); border-top-color: var(--primary-color); border-radius: 50%; margin-right: 8px; animation: spin 1s linear infinite; vertical-align: -2px; }
body[data-theme="dark"] .mini-spinner,
body[data-theme="midnight"] .mini-spinner { border-color: rgba(255,255,255,0.18); border-top-color: var(--primary-color); }
/* Autocomplete layout */
.ac-title { font-size: 0.95rem; line-height: 1.2; }
.ac-subtitle { font-size: 0.85rem; color: var(--text-muted-color); line-height: 1.2; margin-top: 2px; }

/* Liquid background blobs */
/* Old blob background removed in favor of .background-shapes */

.view {
    display: none;
}

.view.active {
    display: block;
}

.header {
    background: linear-gradient(180deg, var(--glass-bg), var(--glass-tint));
    padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(140%);
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(140%);
    box-shadow: 0 6px 18px var(--shadow-color);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1020;
}
.large-title { font-size: 1.75rem; font-weight: 800; line-height: 1.2; transition: opacity var(--transition-fast) ease, transform var(--transition-fast) ease; }
.small-title { font-size: 1.0rem; font-weight: 700; opacity: 0; transform: translateY(-6px); transition: opacity var(--transition-fast) ease, transform var(--transition-fast) ease; }
.header.condensed { padding: 10px 16px; box-shadow: 0 4px 12px var(--shadow-color); }
.header.condensed .large-title { opacity: 0; transform: translateY(-6px); height: 0; overflow: hidden; }
.header.condensed .small-title { opacity: 1; transform: translateY(0); }

.card {
    border: 1px solid var(--glass-border);
    background: var(--card-background-color);
    backdrop-filter: saturate(160%) blur(calc(var(--blur) + 4px));
    -webkit-backdrop-filter: saturate(160%) blur(calc(var(--blur) + 4px));
    box-shadow: 0 6px 16px var(--shadow-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.card-body { padding: 16px; }

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: var(--card-background-color);
    border-top: 1px solid var(--glass-border);
    backdrop-filter: saturate(160%) blur(var(--blur));
    -webkit-backdrop-filter: saturate(160%) blur(var(--blur));
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -6px 16px var(--shadow-color);
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--tab-inactive-color);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: color var(--transition-fast) ease, background-color var(--transition-fast) ease;
    position: relative;
}

.nav-item .bi {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.tab-icon { width: 22px; height: 22px; display: inline-block; margin-bottom: 2px; opacity: 0.9; transition: transform var(--transition-fast) ease, opacity var(--transition-fast) ease; }
.icon-20 { width: 20px; height: 20px; display: inline-block; }
.icon-16 { width: 16px; height: 16px; display: inline-block; }

/* Mask-based icons that inherit currentColor */
.mi { background-color: currentColor; display: inline-block; vertical-align: middle; }
.mi { -webkit-mask: var(--mi) no-repeat 50% 50% / contain; mask: var(--mi) no-repeat 50% 50% / contain; }
.mi-16 { width: 16px; height: 16px; }
.mi-20 { width: 20px; height: 20px; }
.mi-22 { width: 22px; height: 22px; }
.mi-24 { width: 24px; height: 24px; }

.nav-item.active { color: var(--primary-color); background-color: rgba(10,132,255,0.12); }
.nav-item.active .tab-icon { transform: translateY(-1px) scale(1.08); opacity: 1; }
.nav-item::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    width: 26px;
    height: 4px;
    transform: translateX(-50%) scaleX(0.6);
    background: var(--primary-color);
    border-radius: 9999px;
    opacity: 0;
    transition: opacity var(--transition-fast) ease, transform var(--transition-fast) ease;
}
.nav-item.active::after { opacity: 1; transform: translateX(-50%) scaleX(1); }

.history-item {
    cursor: pointer;
}

.history-item:hover { background-color: rgba(0,0,0,0.04); }

.history-item .btn {
    padding: .25rem .5rem;
    font-size: .875rem;
    line-height: 1.5;
    border-radius: .2rem;
}

.history-item .btn .bi {
    font-size: 1rem;
}

/* iOS Segmented Control */
.ios-segmented { display: inline-flex; background: rgba(0,0,0,0.06); padding: 4px; border-radius: 12px; border: 1px solid var(--glass-border); backdrop-filter: blur(6px); }
.ios-segment { appearance: none; border: 0; background: transparent; color: var(--text-muted-color); padding: 6px 12px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.ios-segment.active { background: #fff; color: #111827; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
body[data-theme="dark"] .ios-segmented,
body[data-theme="midnight"] .ios-segmented { background: rgba(255,255,255,0.06); }
body[data-theme="dark"] .ios-segment.active,
body[data-theme="midnight"] .ios-segment.active { background: rgba(255,255,255,0.14); color: #e5e7eb; }
.ios-segmented.sm { padding: 3px; border-radius: 10px; }
.ios-segmented.sm .ios-segment { padding: 4px 10px; font-weight: 600; font-size: .85rem; border-radius: 7px; }

/* iOS List Cells */
.ios-list { display: flex; flex-direction: column; gap: 8px; }
.ios-cell { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 14px 12px; background: rgba(255,255,255,0.6); border: 1px solid var(--glass-border); border-radius: 14px; text-align: left; color: var(--text-color); }
body[data-theme="dark"] .ios-cell,
body[data-theme="midnight"] .ios-cell { background: rgba(16,22,32,0.42); }
.ios-cell:hover { filter: brightness(1.01); }
.ios-cell-leading .mi { opacity: 0.9; color: var(--primary-color); }
.ios-cell-trailing .chev { font-size: 1.25rem; line-height: 1; opacity: 0.4; }
.ios-cell-title { font-weight: 700; color: var(--text-color); }
.ios-cell-subtitle { color: var(--text-muted-color); font-size: 0.9rem; }
.ios-cell-trailing { display: flex; align-items: center; gap: 8px; color: var(--text-muted-color); }
.ios-cell-value { font-weight: 700; color: var(--text-color); }

.list-group-item { background-color: transparent; color: var(--text-color); border-color: var(--glass-border); }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-text { flex: 1 1 auto; min-width: 0; }
.history-actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Form controls contrast tweaks */
.form-control, .form-select {
    background-color: rgba(255,255,255,0.62);
    border-color: var(--glass-border);
    color: var(--text-color);
    backdrop-filter: blur(4px);
    display: block;
    width: 100%;
    max-width: 100%;
}
body[data-theme="dark"] .form-control,
body[data-theme="dark"] .form-select,
body[data-theme="midnight"] .form-control,
body[data-theme="midnight"] .form-select,
body[data-theme="star"] .form-control,
body[data-theme="star"] .form-select {
    background-color: rgba(16,22,32,0.36);
    color: var(--text-color);
}

/* Buttons inherit Bootstrap palette; ensure readable text color context */
.btn-primary { box-shadow: 0 6px 12px rgba(10,132,255,0.28); }
.btn { transition: transform var(--transition-fast) ease, box-shadow var(--transition-fast) ease; }
.btn:active { transform: translateY(1px); }

/* Modernize buttons */
.btn {
    border-radius: 9999px;
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.btn-lg { padding: 0.9rem 1.1rem; }
.btn-primary {
    color: #fff;
    background: var(--primary-color);
    box-shadow: 0 8px 18px rgba(10,132,255,0.32);
}
.btn-primary:hover { filter: brightness(1.03); box-shadow: 0 10px 22px rgba(10,132,255,0.36); }
.btn-outline-secondary {
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.42);
    backdrop-filter: blur(6px);
}
.btn-outline-secondary:hover { background: rgba(255,255,255,0.5); }
body[data-theme="dark"] .btn-outline-secondary,
body[data-theme="midnight"] .btn-outline-secondary,
body[data-theme="star"] .btn-outline-secondary {
    background: rgba(16,22,32,0.5);
}
body[data-theme="dark"] .btn-outline-secondary:hover,
body[data-theme="midnight"] .btn-outline-secondary:hover,
body[data-theme="star"] .btn-outline-secondary:hover {
    background: rgba(16,22,32,0.6);
}

/* Subtle modern variants for utility buttons */
.btn-danger { border: none; border-radius: 9999px; box-shadow: 0 4px 10px rgba(255,59,48,0.25); }
.btn-danger:hover { filter: brightness(1.03); }
.btn-warning { border: none; border-radius: 9999px; color: #111827; box-shadow: 0 4px 10px rgba(255,214,10,0.25); }
.btn-warning:hover { filter: brightness(1.03); }

/* Modal (custom) */
.modal-overlay { position: fixed; inset: 0; display: none; align-items: flex-end; justify-content: center; z-index: 2000; }
.modal-overlay.active { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.25); backdrop-filter: blur(2px); }
.modal-sheet { position: relative; width: 100%; max-width: 720px; margin: 0 auto; background: var(--card-background-color); border: 1px solid var(--glass-border); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 24px var(--shadow-color); padding: 12px; transform: translateY(100%); animation: slideUp 220ms ease forwards; }
.modal-bar { width: 40px; height: 4px; border-radius: 9999px; background: rgba(0,0,0,0.2); margin: 6px auto 12px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.modal-title { font-weight: 700; }
.modal-body { padding: 8px; }
.icon-btn { background: transparent; border: 1px solid var(--glass-border); width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }

@keyframes slideUp { to { transform: translateY(0); } }

/* Header theme toggle button */
.header-theme-toggle {
    position: absolute;
    top: 10px;
    right: 12px;
}
/* Icon button style matching quiz theme */
.icon-button {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-color);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
    padding: 0;
}
.icon-button:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 16px 28px rgba(0, 0, 0, 0.28); }
.icon-button:active { transform: translateY(0) scale(0.97); transition-duration: var(--transition-fast); }

/* App Header capsule (quiz style) */
.app-header {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 10px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 3000;
    padding: 8px 10px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--glass-bg), var(--glass-tint));
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(140%);
    -webkit-backdrop-filter: blur(calc(var(--glass-blur) * 0.8)) saturate(140%);
    box-shadow: 0 10px 24px var(--shadow-color);
}

/* Light theme tweaks to avoid dark hairline on capsule */
body[data-theme="light"] .app-header,
body.light-theme .app-header {
    background: linear-gradient(180deg, rgba(255,255,255,0.78), rgba(255,255,255,0.6));
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 10px 22px rgba(2,6,23,0.08);
}
.header { display: none; }
.app-header .icon-button { background: transparent; border: none; box-shadow: none; }
.app-header .nav-item { flex-direction: row; gap: 6px; }

/* Credits footer (quiz style) */
.app-credits {
    width: min(92vw, 720px);
    margin: 1rem auto 0 auto;
    text-align: center;
    opacity: 0.85;
    font-size: 0.9rem;
    color: var(--text-muted-color);
}
.app-credits.fixed {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom) + 10px);
    z-index: 100;
}
.app-credits a { color: inherit; text-decoration: underline; }
.app-credits .credit-icon { margin-left: .5rem; text-decoration: none; display:inline-flex; align-items:center; transition: transform .15s ease, opacity .15s ease; }
.app-credits .credit-icon svg { display:block; width: 18px; height: 18px; opacity: .9; }
.app-credits .credit-icon:hover { transform: translateY(-1px); }
.app-credits .credit-icon:hover svg { opacity: 1; }
/* Match quiz-app credit colors */
.app-credits .credit-icon.email { color: var(--secondary-color); }
.app-credits .credit-icon.whatsapp { color: #25D366; }
body.light-theme .app-credits .credit-icon.email { color: #0a84ff; }

/* Dark variants for header toggle */
body[data-theme="dark"] .header-theme-toggle,
body[data-theme="midnight"] .header-theme-toggle,
body[data-theme="star"] .header-theme-toggle {
    background: transparent;
}
