:root {
  color-scheme: light;
  --bg: #f2f7fc;
  --panel: #ffffff;
  --panel-alt: #eaf2fa;
  --border: #d0e2f2;
  --text: #0a1e3d;
  --muted: #4a6d8f;
  --primary: #1A88C8;
  --primary-strong: #085e96;
  --ok: #2c9c6e;
  --warn: #b37700;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.app-root { min-height: 100vh; }

.auth-screen {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  align-content: center;
  justify-content: center;
  gap: 24px;
  background: linear-gradient(155deg, #031a30 0%, #064578 40%, #1A88C8 100%);
}

.auth-screen .auth-brand h1 { color: #fff; font-size: 34px; letter-spacing: 1px; }
.auth-screen .auth-brand p { color: rgba(255,255,255,0.7); }

.auth-brand { text-align: center; }

.auth-logo {
  width: min(380px, 80vw);
  display: block;
  margin: 0 auto 14px;
}

.auth-brand h1 { margin: 0; font-size: 32px; }
.auth-brand p { margin: 8px 0 0; color: var(--muted); }

.auth-card {
  width: min(440px, 92vw);
  margin: 0 auto;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.status-message { margin: 12px 0 0; color: var(--primary-strong); font-size: 13px; }

.layout {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}

.panel:hover { box-shadow: 0 4px 24px rgba(0,0,0,0.07); }

.header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

h2, h3 { margin: 0 0 8px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

.subtitle { margin: 0; color: var(--muted); font-size: 13px; }

.nav { display: flex; flex-wrap: wrap; gap: 8px; }
.nav .btn { transition: all 0.2s; border-radius: 20px; padding: 7px 16px; font-size: 13px; }
.nav .btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.section { padding: 18px 22px; }

.section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }

.form {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.form.compact { background: transparent; border: 0; padding: 0; }

label { font-size: 13px; display: grid; gap: 4px; font-weight: 500; }

.password-wrap {
  position: relative;
  display: block;
}
.password-wrap input {
  width: 100%;
  padding-right: 36px;
}
.toggle-pw {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 4px;
  opacity: 0.5;
}
.toggle-pw:hover { opacity: 0.8; }

input, select, textarea {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(26,136,200,0.15);
}

textarea { resize: vertical; }

.btn {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--primary-strong);
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.2s;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(26,136,200,0.12); }
.btn:active { transform: translateY(0); }

.btn.primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, #1A88C8, #0e6aa8);
  color: #fff;
}

.btn.primary:hover { background: linear-gradient(135deg, #1e94d8, #1178b8); }

.btn.subtle { background: #fff; }

.hint { color: var(--muted); font-size: 13px; margin: 0; }
.hidden { display: none !important; }

.inner { margin-top: 14px; padding: 16px; }

table { width: 100%; border-collapse: collapse; }

th, td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 10px;
  font-size: 13px;
  vertical-align: top;
}

th { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }

a { color: var(--primary); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

.archive-grid { margin-top: 14px; }

.archive-date-header {
  margin: 20px 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}

.archive-user-header {
  margin: 24px 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary-strong);
}

.archive-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.archive-thumb-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s;
}

.archive-thumb-card:hover {
  box-shadow: 0 4px 16px rgba(26,136,200,0.15);
  transform: translateY(-2px);
}

.archive-thumb-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: var(--panel-alt);
}

.archive-thumb-info {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 18px;
  margin-top: 14px;
}

.live-tile {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.2s;
}

.live-tile:hover { box-shadow: 0 4px 20px rgba(26,136,200,0.12); }

.live-tile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel-alt);
  font-size: 13px;
}

.live-tile-header .btn { margin-left: auto; font-size: 12px; padding: 4px 12px; }

.live-iframe { width: 100%; aspect-ratio: 16 / 9; border: none; display: block; }

.status-live {
  display: inline-block;
  background: #16a34a;
  color: #fff;
  padding: 2px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.link-code-display {
  text-align: center;
  padding: 20px;
  margin-top: 14px;
  background: var(--panel-alt);
  border-radius: 14px;
}

.link-code-value {
  font-size: 48px;
  font-weight: 800;
  letter-spacing: 10px;
  color: var(--primary-strong);
  font-family: "Courier New", monospace;
}

.link-code-timer { font-size: 16px; color: var(--muted); margin-top: 8px; }

.mt { margin-top: 20px; }

.claim-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.claim-code-input {
  width: 180px;
  text-align: center;
  font-size: 18px;
  letter-spacing: 2px;
  font-family: "Courier New", monospace;
}

.claim-status {
  margin-top: 8px;
}

.assignments-list { margin-top: 12px; display: grid; gap: 8px; }

.assignment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-alt);
  border-radius: 10px;
  font-size: 13px;
}

.assignment-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assignment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.plan-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: all 0.2s;
}

.plan-card:hover {
  box-shadow: 0 6px 24px rgba(26,136,200,0.12);
  transform: translateY(-2px);
}

.plan-card-accent { border-color: var(--primary); }
.plan-card-highlight {
  border: 2px solid var(--primary);
  background: linear-gradient(170deg, #f0f8ff 0%, #fff 100%);
}

.plan-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--ok);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 8px;
  text-transform: uppercase;
}

.plan-name { margin: 0; font-size: 20px; color: var(--primary-strong); }
.plan-limit { font-size: 14px; font-weight: 600; color: var(--primary); }
.plan-desc { font-size: 13px; color: var(--muted); margin: 0; flex: 1; }
.plan-price { font-size: 18px; font-weight: 700; color: var(--text); margin-top: 4px; }
.plan-select-btn { width: 100%; margin-top: 8px; }

.archive-session-list { display: grid; gap: 8px; margin-top: 14px; }

.archive-session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.archive-session-item:hover {
  background: #fff;
  box-shadow: 0 2px 12px rgba(26,136,200,0.1);
  transform: translateY(-1px);
}

.archive-session-meta { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }

.btn.danger {
  border-color: #dc2626;
  background: #fef2f2;
  color: #dc2626;
}

.btn.danger:hover { background: #dc2626; color: #fff; }

.btn.sm { padding: 4px 10px; font-size: 12px; }

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}

.lightbox-overlay.active { display: flex; align-items: center; justify-content: center; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.lightbox-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 94vw;
  max-height: 94vh;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  user-select: none;
  -webkit-user-drag: none;
}

.lightbox-close {
  position: absolute;
  top: -36px;
  right: -8px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  opacity: 0.8;
  transition: opacity 0.2s;
  z-index: 2;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  font-size: 44px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 12px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
}

.lightbox-prev { left: -64px; }
.lightbox-next { right: -64px; }
.lightbox-prev:hover,
.lightbox-next:hover { opacity: 1; background: rgba(255, 255, 255, 0.22); }

.lightbox-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.lightbox-footer .btn.sm {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.lightbox-footer .btn.sm:hover {
  background: rgba(255, 255, 255, 0.3);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.modal-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.modal-card {
  position: relative;
  width: min(460px, 92vw);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  z-index: 1;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.25);
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.password-value {
  margin-top: 12px;
  font-family: "Courier New", monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

/* ── Footer ─────────────────────────────────────────── */

.app-footer {
  text-align: center;
  padding: 16px;
}

.footer-contact {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s;
}
.footer-contact:hover {
  color: var(--primary);
  text-decoration: underline;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}

.pagination:empty { display: none; }

.pagination .btn { padding: 5px 12px; font-size: 12px; min-width: 32px; }

.instructions-hero {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-alt);
}

.instructions-hero-copy h3 {
  margin: 0 0 10px;
  font-size: 28px;
}

.instructions-kicker {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instructions-lead {
  margin: 0;
  max-width: 860px;
  color: var(--muted);
  font-size: 15px;
}

.instructions-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.instructions-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 600;
}

.instructions-quick-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.instructions-quick-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.instructions-quick-link:hover {
  background: var(--panel-alt);
}

.instructions-callout,
.instructions-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  background: var(--panel-alt);
  color: var(--text);
  font-size: 13px;
}

.instructions-note {
  margin-top: 16px;
}

.instructions-note-warning {
  border-left-color: var(--warn);
}

.instructions-note-success {
  border-left-color: var(--ok);
}

.instructions-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.instructions-grid-two {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.instructions-card,
.instructions-step {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
}

.instructions-card h4,
.instructions-card h5,
.instructions-step h5 {
  margin: 0 0 10px;
}

.instructions-card h4,
.instructions-block-header h4 {
  font-size: 22px;
}

.instructions-card h5,
.instructions-step h5 {
  font-size: 18px;
}

.instructions-card p,
.instructions-step p,
.instructions-block-header p {
  margin: 0;
}

.instructions-card ol,
.instructions-card ul,
.instructions-step ol,
.instructions-step ul {
  margin: 0;
  padding-left: 20px;
}

.instructions-card li,
.instructions-step li {
  margin-bottom: 8px;
}

.instructions-block {
  margin-top: 28px;
  padding-top: 2px;
}

.instructions-block-header {
  margin-bottom: 14px;
}

.instructions-block-header p:last-child {
  color: var(--muted);
}

.instructions-step-list {
  display: grid;
  gap: 14px;
}

.instructions-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--panel);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#instructionsSection [id^="instructions-"] {
  scroll-margin-top: 16px;
}

.instructions-shell {
  display: grid;
  gap: 16px;
}

.instructions-shell-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.instructions-shell-kicker {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instructions-shell-header h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

.instructions-shell-frame {
  width: 100%;
  height: calc(100vh - 220px);
  min-height: 920px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(145deg, #0a1628 0%, #142a4a 50%, #1A88C8 100%);
  box-shadow: 0 12px 34px rgba(10, 30, 61, 0.12);
}

@media (max-width: 840px) {
  .layout { padding: 12px; }
  .header { flex-direction: column; align-items: flex-start; }
  .link-code-value { font-size: 32px; letter-spacing: 6px; }
  .lightbox-prev { left: 4px; }
  .lightbox-next { right: 4px; }
  .lightbox-close { top: 4px; right: 4px; }
  .lightbox-img { max-width: 96vw; max-height: 75vh; }
  .instructions-hero { padding: 18px; }
  .instructions-hero-copy h3 { font-size: 24px; }
  .instructions-card,
  .instructions-step { padding: 16px; }
  .instructions-shell-frame {
    height: 78vh;
    min-height: 720px;
  }
}
