.center-text {
  text-align: center;
}
.logo {
  max-height: 60px;
}
/* Dashboard & Admin Layout Improvements */
.admin-container {
  padding: 2rem;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.status-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.results-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  width: 100%;
}
.result-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  overflow-wrap: break-word;
}
.result-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}
.btn-delete {
  padding: 0.5rem 0.75rem;
  background: #fee2e2;
  color: var(--danger);
  font-weight: 600;
}
.btn-delete:hover {
  background: #fecaca;
}
/* Global loading and toast UI */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  z-index: 9999;
  font-family: sans-serif;
  font-size: 1.2rem;
  color: #555;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.admin-app--loading {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.admin-app--ready {
  opacity: 1;
  transition: opacity 0.3s ease;
}
.login-status-message {
  color: var(--danger);
  text-align: center;
  margin-bottom: 1rem;
}
.offline-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  z-index: 9999;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-family: sans-serif;
  font-size: 1.1rem;
  color: #555;
}
.modal--open {
  display: flex;
}
.modal:not(.modal--open) {
  display: none;
}
.toast-container {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 9999;
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  width: fit-content;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  color: #111;
  text-align: center;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: auto;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast.info,
.toast.success,
.toast.danger {
  border-right: 4px solid transparent;
}
.toast.info {
  border-left: 4px solid #3b82f6;
}
.toast.success {
  border-left: 4px solid #10b981;
}
.toast.danger {
  border-left: 4px solid #f87171;
}
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --danger: #ef4444;
  --bg: #f4f7fb;
  --text: #1e293b;
  --border: #dbe3ef;
  --border-strong: #c5d0df;
  --white: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 32%), radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.06), transparent 28%), linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
body.app-loading #app {
  opacity: 0;
}
body.app-ready #app {
  opacity: 1;
  transition: opacity 0.16s ease;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 85%);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 85%);
  opacity: 0.45;
}
/* Thin Scrollbars */
#app::-webkit-scrollbar,
.container::-webkit-scrollbar,
.admin-container::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
#app::-webkit-scrollbar-thumb,
.container::-webkit-scrollbar-thumb,
.admin-container::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
#app::-webkit-scrollbar-track,
.container::-webkit-scrollbar-track,
.admin-container::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
  background: transparent;
}
#question-container::-webkit-scrollbar,
.results-list::-webkit-scrollbar {
  width: 4px;
}
#question-container::-webkit-scrollbar-thumb,
.results-list::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 10px;
}
.container {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.84));
  border: 1px solid rgba(203, 213, 225, 0.85);
  padding: 2.5rem;
  border-radius: 1rem;
  box-shadow:
    0 24px 60px rgba(15, 23, 42, 0.08),
    0 2px 4px rgba(15, 23, 42, 0.04);
  width: 648px;
  height: 680px;
  margin: 1rem;
  display: flex;
  flex-direction: column;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
#login-screen,
#end-screen {
  max-width: 546px;
  width: 100%;
  height: auto;
  padding: 3rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
#end-screen {
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}
#end-screen::before {
  content: "";
  position: absolute;
  inset: 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(37, 99, 235, 0.08);
  background: radial-gradient(circle at top, rgba(37, 99, 235, 0.08), transparent 38%), radial-gradient(circle at bottom right, rgba(16, 185, 129, 0.08), transparent 34%);
  pointer-events: none;
}
#end-screen > * {
  position: relative;
  z-index: 1;
}
#end-screen .logo-container {
  margin-bottom: 1.25rem;
}
#end-screen h1 {
  font-size: clamp(2rem, 4vw, 2.6rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}
#end-screen p {
  max-width: 30rem;
  margin: 0.35rem auto 0;
  color: var(--secondary);
}
.container form,
.admin-container form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 0.75rem;
}
#login-screen > h1,
#login-screen > p,
#admin-login > h1,
#admin-login > p {
  text-align: center;
}
#login-screen .btn,
#admin-login .btn {
  width: 100%;
}
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.input-group input {
  width: 100%;
  padding: 1.1rem 1.15rem;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.04);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease;
}
.input-group input::placeholder {
  color: #64748b;
  font-weight: 500;
  font-size: 0.95rem;
}
.input-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  background: #fff;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 0.75rem;
  background: var(--primary);
  color: var(--white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}
.btn:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  box-shadow: none;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.85);
  color: var(--secondary);
  border-color: var(--border);
  box-shadow: none;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(248, 250, 252, 0.98);
  border-color: var(--border-strong);
}
.btn-danger {
  background: var(--danger);
  box-shadow: 0 10px 20px rgba(239, 68, 68, 0.16);
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}
.navigation {
  display: flex;
  gap: 0.75rem;
}
.navigation .btn {
  flex: 1 1 0;
  width: 100%;
  min-width: 0;
}
#login-screen .btn,
#admin-login .btn,
.modal-actions .btn,
.header-actions .btn {
  width: 100%;
}
#submit-btn,
#next-btn,
#prev-btn {
  min-width: 0;
}
#prev-btn {
  background: linear-gradient(180deg, #64748b, #475569);
  color: #ffffff;
  border-color: #475569;
  box-shadow: 0 10px 20px rgba(71, 85, 105, 0.16);
}
#prev-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #5b6b7f, #334155);
  border-color: #334155;
}
#question-container {
  flex: 1;
  overflow-y: scroll; /* Force scrollbar to be present or reserved space */
  padding-right: 0.5rem;
  margin-bottom: 1rem;
  min-height: 350px;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 1rem;
  padding: 1.1rem 1rem 1rem;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
/* Add subtle entry animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.container {
  animation: fadeIn 0.4s ease-out;
}
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  position: relative;
}
.logo {
  max-height: 100px;
  width: auto;
  object-fit: contain;
}
@media (max-width: 768px) {
  body {
    align-items: flex-start;
    padding: 0.75rem 0 1rem;
  }
  .container {
    width: min(100%, 720px);
    height: auto;
    max-height: 90vh;
    padding: 1.5rem;
    margin: 0.5rem auto;
  }
  h1 {
    font-size: 1.5rem;
  }
  .logo {
    max-height: 80px;
  }
  #question-container {
    max-height: 350px;
  }
  .options-grid {
    gap: 0.75rem;
  }
  .option-card {
    padding: 0.875rem;
    font-size: 0.95rem;
  }
  .navigation {
    flex-direction: row;
    gap: 0.5rem;
  }
  .btn {
    padding: 0.625rem 0.5rem;
    font-size: 0.9rem;
  }
  .toast-container {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    max-width: min(calc(100vw - 1rem), 380px);
  }
}
@media (max-width: 480px) {
  body {
    padding: 0;
  }
  .container {
    width: 100%;
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
    max-height: none;
  }
  #question-container {
    max-height: none;
    flex: 1;
  }
  .toast-container {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }
  .toast {
    max-width: calc(100vw - 1rem);
  }
}
.btn,
.option-card {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn:active,
.option-card:active {
  transform: scale(0.97);
}
.test-screen-header {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}
.logout-link {
  display: inline-flex;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--secondary);
  text-decoration: none;
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s,
    background-color 0.2s;
  background: rgba(255, 255, 255, 0.7);
}
.logout-link:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
  background: rgba(254, 242, 242, 0.9);
}
.header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--secondary);
  padding: 0.9rem 1rem;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 2px;
  background: rgba(248, 250, 252, 0.9);
}
#timer {
  color: var(--danger);
}
.options-grid {
  display: grid;
  gap: 1rem;
  margin: 1.25rem 0 0.25rem;
}
.option-card {
  padding: 1rem;
  border: 1px solid rgba(219, 227, 239, 0.9);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.option-card:hover {
  border-color: var(--primary);
  background-color: rgba(37, 99, 235, 0.05);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.08);
}
.option-card.selected {
  border-color: var(--primary);
  background-color: rgba(37, 99, 235, 0.1);
  box-shadow:
    0 0 0 1px var(--primary),
    0 12px 22px rgba(37, 99, 235, 0.12);
}
.option-card.dimmed {
  opacity: 0.45;
  pointer-events: none;
}
.question-category {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}
.hidden {
  display: none !important;
}
