*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font-main: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --crimson: #b91c1c;
  --crimson-dark: #991b1b;
  --gold: #d97706;
  --blue-focus: #1d4ed8;
  --blue-ring: rgba(59, 130, 246, 0.25);
  --text-dark: #111827;
  --text-muted: #4b5563;
}

html, body {
  height: 100%;
  font-family: var(--font-main);
  color: var(--text-dark);
  -webkit-font-smoothing: antialiased;
}

body {
  position: relative;
  min-height: 100dvh;
  background-color: #fdf6e2;
  background-image: url('/assets/pc.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* Giữ nguyên tỉ lệ 1:1 cho cụm banner + logo trên và sóng nền dưới trên mọi kích thước PC */
body::before,
body::after {
  content: '';
  position: fixed;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url('/assets/pc.png');
  background-size: 100% auto;
  background-repeat: no-repeat;
}

body::before {
  top: 0;
  height: 14vw;
  min-height: 105px;
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
}

body::after {
  bottom: 0;
  height: 12vw;
  min-height: 90px;
  background-position: center bottom;
  -webkit-mask-image: linear-gradient(to top, #000 78%, transparent 100%);
  mask-image: linear-gradient(to top, #000 78%, transparent 100%);
}

/* Mobile & màn hình dọc dùng mobile.png */
@media (max-width: 767px), (orientation: portrait) and (max-width: 1024px) {
  body {
    background-image: url('/assets/mobile.png');
    background-size: cover;
    background-position: center center;
    background-attachment: scroll;
  }

  body::before,
  body::after {
    background-image: url('/assets/mobile.png');
  }

  body::before {
    height: 36vw;
    min-height: 115px;
  }

  body::after {
    height: 40vw;
    min-height: 125px;
  }
}

.page-wrapper {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(120px, 19vh, 180px) 16px clamp(90px, 14vh, 140px);
}

.card {
  width: 100%;
  max-width: 620px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 24px;
  border: 1px solid rgba(217, 119, 6, 0.25);
  box-shadow: 0 20px 50px rgba(127, 29, 29, 0.14), 0 4px 16px rgba(0, 0, 0, 0.06);
  padding: 32px 28px;
  animation: fadeUp 0.35s ease-out;
}

@media (max-width: 640px) {
  .card {
    padding: 24px 18px;
    border-radius: 20px;
  }
}

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

.hidden {
  display: none !important;
}

/* --- Màn hình nhập tên --- */
.input-group {
  position: relative;
}

.input-label {
  display: block;
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 12px;
  text-align: center;
}

.input-ring {
  position: relative;
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-ring.focused {
  border-color: var(--blue-focus);
  box-shadow: 0 0 0 4px var(--blue-ring);
}

.delegate-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 16px 44px 16px 18px;
  font-family: var(--font-main);
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  font-weight: 500;
  color: var(--text-dark);
}

.delegate-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.clear-btn {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #e5e7eb;
  color: #4b5563;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.clear-btn:hover {
  background: #d1d5db;
}

/* Danh sách gợi ý */
.suggestions-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.14);
  list-style: none;
  z-index: 30;
  padding: 6px;
}

.suggestion-item {
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #eff6ff;
}

.suggestion-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.suggestion-pos {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.35;
}

.suggestion-empty {
  padding: 14px;
  text-align: center;
  color: #64748b;
  font-size: 0.92rem;
}

.error-msg {
  margin-top: 12px;
  color: #dc2626;
  font-size: 0.92rem;
  font-weight: 500;
  text-align: center;
}

.checkin-btn {
  margin-top: 22px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #c81e1e 0%, #991b1b 100%);
  color: #ffffff;
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(185, 28, 28, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s ease;
}

.checkin-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(185, 28, 28, 0.36);
}

.checkin-btn:active:not(:disabled) {
  transform: translateY(0);
}

.checkin-btn:disabled {
  background: #cbd5e1;
  color: #64748b;
  box-shadow: none;
  cursor: not-allowed;
}

/* --- Màn hình Chào mừng (3 dòng cân đối) --- */
.welcome-card {
  max-width: 680px;
  text-align: center;
  padding: 36px 28px 30px;
  border: 1.5px solid rgba(217, 119, 6, 0.35);
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 24px;
  border: 1px solid #a7f3d0;
}

.check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #059669;
  color: #ffffff;
  font-size: 0.75rem;
}

.welcome-lines {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.welcome-greeting {
  font-size: clamp(1.1rem, 2.8vw, 1.35rem);
  font-weight: 600;
  color: #78350f;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.welcome-name {
  font-size: clamp(1.65rem, 5vw, 2.4rem);
  font-weight: 800;
  color: #991b1b;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.welcome-position {
  font-size: clamp(0.98rem, 2.6vw, 1.2rem);
  font-weight: 600;
  color: #1e293b;
  line-height: 1.5;
  max-width: 540px;
  text-wrap: balance;
  word-break: break-word;
}

.welcome-meta {
  margin-top: 22px;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
}

.back-btn {
  margin-top: 24px;
  padding: 10px 24px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.back-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}
