:root {
  --bg-0: #f3efe6;
  --bg-1: #f8f4ec;
  --ink: #111111;
  --muted: #5c5a54;
  --line: #d9d2c7;
  --brand: #0d5c63;
  --brand-strong: #064f5a;
  --accent: #ff8b5e;
  --ok: #1f7a5a;
  --warn: #b35a1c;
  --danger: #b82222;
  --card: #fffdf8;
  --shadow: 0 14px 36px rgba(17, 17, 17, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Outfit", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 10%, #f5dccf 0%, transparent 32%),
    radial-gradient(circle at 80% 0%, #d8efe8 0%, transparent 35%),
    linear-gradient(160deg, var(--bg-0), var(--bg-1));
}

h1,
h2,
h3,
.brand,
.eyebrow,
.timer-box strong {
  font-family: "Space Grotesk", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.status {
  min-height: 1.2rem;
  color: var(--brand-strong);
  font-size: 0.92rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.68rem 1.05rem;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease, background-color 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

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

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-wide {
  width: 100%;
}

.eyebrow {
  margin: 0;
  font-size: 0.84rem;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.landing-page {
  position: relative;
  overflow-x: hidden;
}

.bg-blob {
  position: fixed;
  border-radius: 50%;
  z-index: 0;
  filter: blur(3px);
}

.bg-blob-a {
  width: 420px;
  height: 420px;
  background: rgba(255, 139, 94, 0.18);
  top: -140px;
  right: -120px;
}

.bg-blob-b {
  width: 300px;
  height: 300px;
  background: rgba(13, 92, 99, 0.16);
  bottom: -120px;
  left: -80px;
}

.auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.auth-card {
  width: min(560px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 2rem;
}

.auth-card h1 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  margin: 0.5rem 0;
}

.user-chip {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.user-chip img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  background: #f0f0f0;
}

.chip-name {
  margin: 0;
  font-weight: 600;
}

.chip-email {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.actions {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
}

.role-pill {
  margin-top: 0.75rem;
  display: inline-block;
  background: #e2f0eb;
  border: 1px solid #cbe6dd;
  color: #136748;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.82rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(255, 253, 248, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  font-size: 1.08rem;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.identity {
  font-size: 0.92rem;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  padding: 1rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.panel-header h1,
.panel-header h2,
.panel-header h3 {
  margin: 0;
}

.panel-header {
  margin-bottom: 0.75rem;
}

.panel-header.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.form-stack {
  display: grid;
  gap: 0.75rem;
}

.form-stack label {
  font-size: 0.9rem;
  font-weight: 500;
  display: grid;
  gap: 0.3rem;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-family: "Outfit", sans-serif;
  background: #fff;
}

.two-col {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
}

.key-title {
  margin: 0.3rem 0;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.answer-key-grid {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.key-item {
  display: grid;
  gap: 0.2rem;
}

.key-item small {
  font-size: 0.74rem;
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.exam-list,
.attempt-list {
  display: grid;
  gap: 0.55rem;
}

.exam-item,
.attempt-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.65rem;
}

.exam-row,
.attempt-row {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.exam-meta,
.attempt-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.exam-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.attempt-block {
  margin-top: 1rem;
}

.blocked {
  border-color: #f3cbc5;
  background: #fff2f0;
}

.student-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  min-height: calc(100vh - 74px);
}

.paper-panel,
.qa-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0.85rem;
  min-height: 75vh;
}

.paper-panel {
  display: flex;
  flex-direction: column;
}

#examPdf {
  width: 100%;
  flex: 1;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.timer-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.35rem 0.65rem;
  display: grid;
  text-align: right;
  font-size: 0.75rem;
}

.timer-box strong {
  font-size: 1.04rem;
  line-height: 1.1;
}

.selector-wrap {
  display: grid;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem;
  background: #fff;
}

.question-label {
  margin: 0 0 0.45rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
}

.option-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.option-btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.8rem;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  background: #fff;
  cursor: pointer;
}

.option-btn.active {
  background: #dff2ea;
  border-color: #86cdb0;
  color: #0e6b49;
}

.option-btn.locked {
  cursor: not-allowed;
}

.nav-actions {
  margin: 0.75rem 0;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.palette-grid {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 0.55rem;
  display: grid;
  gap: 0.35rem;
  max-height: 280px;
  overflow: auto;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
}

.palette-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.82rem;
  background: #fff;
  cursor: pointer;
}

.palette-btn.answered {
  background: #e8f8f2;
  border-color: #92d9ba;
}

.palette-btn.current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.palette-btn.locked {
  cursor: default;
}

@media (max-width: 1080px) {
  .admin-layout,
  .student-shell {
    grid-template-columns: 1fr;
  }

  #examPdf {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .option-buttons {
    grid-template-columns: 1fr;
  }

  .palette-grid {
    grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  }
}
