:root {
  color-scheme: light;
  --blue: #245a99;
  --blue-dark: #173968;
  --text: #172b4d;
  --muted: #64748b;
  --line: #dce5f0;
  --surface: #ffffff;
  --background: #eef4fb;
  --success: #18734b;
  --danger: #a72d2d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #dceafb, transparent 34%),
    var(--background);
}

button,
input {
  font: inherit;
}

.attendance-page {
  width: min(1080px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 18px;
}

.attendance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.attendance-header img {
  width: min(230px, 46vw);
  height: auto;
}

.live-clock {
  text-align: right;
}

.live-clock strong,
.live-clock span {
  display: block;
}

.live-clock strong {
  color: var(--blue-dark);
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.live-clock span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.85rem;
}

.attendance-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 20px 55px rgba(28, 63, 104, 0.12);
}

.attendance-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
}

.attendance-intro h1,
.success-screen h1 {
  margin: 4px 0 6px;
  color: var(--blue-dark);
  font-size: clamp(1.65rem, 4vw, 2.3rem);
}

.attendance-intro p,
.success-screen p {
  margin: 0;
  color: var(--muted);
}

.attendance-intro > div:last-child {
  max-width: 330px;
  text-align: right;
}

.attendance-intro small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.eyebrow {
  color: var(--blue) !important;
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.network-badge {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
}

.network-badge.checking {
  color: #815800;
  background: #fff1cf;
}

.network-badge.allowed {
  color: #17613f;
  background: #e1f5e9;
}

.network-badge.blocked {
  color: #9d2929;
  background: #fde7e7;
}

.attendance-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 0.88fr);
  gap: 26px;
  padding: 26px;
}

.camera-wrap {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  border-radius: 20px;
  background: #0e1727;
}

.camera-wrap video {
  display: block;
  width: 100%;
  height: 560px;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-guide {
  position: absolute;
  inset: 12% 20%;
  border: 3px solid rgba(255, 255, 255, 0.86);
  border-radius: 48%;
  box-shadow: 0 0 0 999px rgba(4, 12, 24, 0.16);
}

.camera-caption {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #fff;
  text-align: center;
  background: rgba(7, 17, 31, 0.76);
}

.instruction-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.instruction-box {
  padding: 25px 20px;
  border-radius: 17px;
  text-align: center;
  background: #f2f7fd;
}

.instruction-box span {
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.instruction-box strong {
  display: block;
  margin: 12px 0 8px;
  color: var(--blue-dark);
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}

.instruction-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-box {
  margin-top: 15px;
  padding: 13px 14px;
  border-radius: 11px;
  line-height: 1.45;
}

.status-info {
  color: #245c9d;
  background: #eaf2fc;
}

.status-success {
  color: #17613f;
  background: #e4f5eb;
}

.status-warning {
  color: #865900;
  background: #fff0cf;
}

.status-error {
  color: #9d2929;
  background: #fde7e7;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.button {
  flex: 1;
  border: 0;
  border-radius: 11px;
  padding: 13px 16px;
  cursor: pointer;
  font-weight: 800;
}

.button.primary {
  color: #fff;
  background: var(--blue);
}

.button.secondary {
  color: var(--blue);
  background: #e8f1fc;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.recognized-result {
  display: grid;
  gap: 1px;
  overflow: hidden;
  margin-top: 15px;
  border-radius: 12px;
  background: var(--line);
}

.recognized-result > div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 11px 13px;
  background: #f8fbff;
}

.recognized-result span {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.success-screen {
  display: grid;
  min-height: 610px;
  place-items: center;
  align-content: center;
  padding: 42px 24px;
  text-align: center;
}

.success-icon {
  display: grid;
  width: 88px;
  height: 88px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  font-size: 2.6rem;
  font-weight: 900;
  box-shadow: 0 14px 30px rgba(24, 115, 75, 0.25);
}

.success-time {
  margin: 20px 0 3px;
  color: var(--blue-dark);
  font-size: clamp(2.4rem, 8vw, 4.6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.success-network {
  margin-top: 10px !important;
}

.success-screen .button {
  min-width: 220px;
  margin-top: 24px;
}

footer {
  padding: 18px 0 0;
  color: #718096;
  text-align: center;
  font-size: 0.78rem;
}

@media (max-width: 760px) {
  .attendance-page {
    width: min(100% - 20px, 620px);
    padding-top: 14px;
  }

  .attendance-header {
    margin-bottom: 14px;
  }

  .live-clock span {
    max-width: 150px;
  }

  .attendance-card {
    border-radius: 18px;
  }

  .attendance-intro {
    align-items: flex-start;
    flex-direction: column;
    padding: 19px;
  }

  .attendance-intro > div:last-child {
    max-width: none;
    text-align: left;
  }

  .attendance-layout {
    grid-template-columns: 1fr;
    gap: 17px;
    padding: 14px;
  }

  .camera-wrap {
    min-height: 390px;
  }

  .camera-wrap video {
    height: 430px;
  }

  .instruction-box {
    padding: 19px 14px;
  }

  .button-row {
    flex-direction: column;
  }

  .success-screen {
    min-height: 560px;
  }
}

@media (max-width: 430px) {
  .attendance-header img {
    width: 165px;
  }

  .live-clock strong {
    font-size: 1.15rem;
  }

  .live-clock span {
    font-size: 0.7rem;
  }

  .camera-wrap {
    min-height: 350px;
  }

  .camera-wrap video {
    height: 390px;
  }
}

/* Premium attendance motion */
.attendance-card {
  animation: attendanceEnter 0.55s cubic-bezier(.2,.8,.2,1) both;
  transition:
    box-shadow 0.35s ease,
    transform 0.35s ease;
}

.attendance-card:hover {
  box-shadow: 0 26px 70px rgba(28, 63, 104, 0.16);
}

.attendance-header {
  animation: headerEnter 0.5s ease both;
}

.verification-progress {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 18px 26px 0;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  transition: color 0.3s ease;
}

.progress-step span {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: #e8eef6;
  font-size: 0.74rem;
  font-weight: 900;
  transition:
    color 0.3s ease,
    background 0.3s ease,
    transform 0.3s ease;
}

.progress-step strong {
  font-size: 0.76rem;
}

.progress-step.complete {
  color: #18734b;
}

.progress-step.complete span {
  color: #fff;
  background: #24835a;
}

.progress-step.current span {
  transform: scale(1.12);
  box-shadow: 0 0 0 5px rgba(36, 90, 153, 0.12);
}

.verification-progress > i {
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, #b9c8da, #e4ebf3);
}

.camera-wrap {
  isolation: isolate;
  transition: box-shadow 0.35s ease;
}

.camera-guide {
  z-index: 2;
  animation: guidePulse 2.4s ease-in-out infinite;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.scan-line {
  position: absolute;
  z-index: 3;
  top: 15%;
  right: 22%;
  left: 22%;
  height: 2px;
  opacity: 0.75;
  background: linear-gradient(
    90deg,
    transparent,
    #70c6ff,
    transparent
  );
  box-shadow: 0 0 13px #70c6ff;
  animation: scanFace 2.8s ease-in-out infinite;
}

.camera-caption,
.status-box,
.instruction-box,
.network-badge {
  transition:
    color 0.3s ease,
    background 0.3s ease,
    opacity 0.3s ease,
    transform 0.3s ease;
}

.success-icon {
  animation: successPop 0.65s cubic-bezier(.2,1.4,.4,1) both;
}

.success-screen h1,
.success-screen p,
.success-time,
.success-network,
.success-screen .button {
  animation: resultEnter 0.5s ease both;
}

.success-time {
  animation-delay: 0.08s;
}

.success-network {
  animation-delay: 0.14s;
}

.success-screen .button {
  animation-delay: 0.2s;
}

.button {
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.button:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(36, 90, 153, 0.18);
}

.button:not(:disabled):active {
  transform: translateY(0) scale(0.98);
}

@keyframes attendanceEnter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes headerEnter {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes guidePulse {
  0%, 100% {
    border-color: rgba(255,255,255,0.72);
    box-shadow: 0 0 0 999px rgba(4,12,24,0.14);
  }
  50% {
    border-color: #8ed5ff;
    box-shadow:
      0 0 24px rgba(92,184,240,0.35),
      0 0 0 999px rgba(4,12,24,0.17);
  }
}

@keyframes scanFace {
  0%, 100% {
    top: 17%;
    opacity: 0.25;
  }
  50% {
    top: 78%;
    opacity: 0.9;
  }
}

@keyframes successPop {
  0% {
    opacity: 0;
    transform: scale(0.4) rotate(-12deg);
  }
  70% {
    transform: scale(1.1) rotate(2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes resultEnter {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .verification-progress {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    padding: 15px 14px 0;
  }

  .verification-progress > i {
    display: none;
  }

  .progress-step {
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .progress-step strong {
    font-size: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.success-person {
  display: grid;
  gap: 4px;
  margin: 14px 0 5px;
  text-align: center;
  animation: resultEnter 0.45s ease both;
}

.success-person strong {
  color: #173968;
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  line-height: 1.15;
}

.success-person span {
  color: #64748b;
  font-size: 0.9rem;
  font-weight: 650;
}

.success-person + #successGreeting {
  margin-top: 14px;
}

@media (max-width: 500px) {
  .success-person strong {
    font-size: 1.65rem;
  }

  .success-person span {
    font-size: 0.8rem;
  }
}
