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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0a0a2e 0%, #1a1040 40%, #0d2137 70%, #0a1628 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  color: #e0e8f0;
  overflow-y: auto;
}

.page-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(180, 200, 230, 0.7);
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  margin-top: 10px;
}

.container {
  width: 100%;
  max-width: 800px;
  background: rgba(20, 30, 60, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid rgba(100, 180, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(100, 180, 255, 0.1);
  padding: 36px 28px;
  margin-bottom: 20px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #64d8ff, #a78bfa, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.subtitle {
  font-size: 0.9rem;
  color: rgba(180, 200, 230, 0.7);
  margin-bottom: 24px;
}

.stats-bar {
  background: rgba(15, 25, 50, 0.6);
  border: 1px solid rgba(100, 180, 255, 0.12);
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  color: rgba(180, 200, 230, 0.7);
}

.stats-bar strong {
  color: #64d8ff;
  font-weight: 600;
}

#message-list {
  max-height: 65vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#message-list::-webkit-scrollbar {
  width: 6px;
}

#message-list::-webkit-scrollbar-track {
  background: rgba(15, 25, 50, 0.3);
  border-radius: 3px;
}

#message-list::-webkit-scrollbar-thumb {
  background: rgba(100, 180, 255, 0.2);
  border-radius: 3px;
}

#message-list::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 180, 255, 0.35);
}

.message-card {
  background: rgba(15, 25, 50, 0.4);
  border: 1px solid rgba(100, 180, 255, 0.1);
  border-radius: 14px;
  padding: 16px 20px;
  transition: border-color 0.2s ease, opacity 0.4s ease, transform 0.4s ease, max-height 0.4s ease, padding 0.4s ease, margin 0.4s ease;
}

.message-card:hover {
  border-color: rgba(100, 180, 255, 0.25);
}

.message-card.removing {
  opacity: 0;
  transform: translateX(30px);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  overflow: hidden;
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.message-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #e0e8f0;
}

.message-time {
  font-size: 0.8rem;
  color: rgba(140, 180, 220, 0.5);
}

.message-text {
  color: rgba(180, 200, 230, 0.8);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 12px;
  word-break: break-word;
}

.message-actions {
  display: flex;
  justify-content: flex-end;
}

.delete-btn {
  background: rgba(240, 60, 60, 0.15);
  border: 1px solid rgba(240, 60, 60, 0.3);
  color: #f06060;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.delete-btn:hover {
  background: rgba(240, 60, 60, 0.25);
  border-color: rgba(240, 60, 60, 0.5);
}

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

.empty-state {
  text-align: center;
  color: rgba(140, 180, 220, 0.4);
  font-size: 1.1rem;
  padding: 40px 0;
}

/* ===== PIN Overlay ===== */
#pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0a2e 0%, #1a1040 40%, #0d2137 70%, #0a1628 100%);
}

#pin-overlay.hidden { display: none; }

.pin-box {
  background: rgba(20, 30, 60, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(100, 180, 255, 0.15);
  border-radius: 24px;
  padding: 40px 36px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(100, 180, 255, 0.1);
  width: 100%;
  max-width: 360px;
}

.pin-box h2 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #64d8ff, #a78bfa, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.pin-box p {
  font-size: 0.9rem;
  color: rgba(180, 200, 230, 0.7);
  margin-bottom: 24px;
}

.pin-box input[type="email"],
.pin-box input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  background: rgba(15, 25, 50, 0.6);
  border: 1px solid rgba(100, 180, 255, 0.2);
  border-radius: 12px;
  color: #e0e8f0;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
  margin-bottom: 12px;
}

.pin-box input[type="email"]::placeholder,
.pin-box input[type="password"]::placeholder {
  color: rgba(140, 170, 200, 0.4);
}

.pin-box input[type="email"]:focus,
.pin-box input[type="password"]:focus {
  border-color: rgba(100, 200, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(100, 200, 255, 0.1);
}

#pin-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #4a6cf7, #6a3de8);
  transition: opacity 0.2s, transform 0.2s;
}

#pin-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.pin-error {
  display: none;
  color: #f06060;
  font-size: 0.85rem;
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(240, 60, 60, 0.1);
  border: 1px solid rgba(240, 60, 60, 0.2);
  border-radius: 8px;
}

.pin-error.visible { display: block; }

/* ===== Title Config / QR Config ===== */
.title-config,
.qr-config {
  margin-bottom: 16px;
}

.title-config h2,
.qr-config h2 {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, #64d8ff, #a78bfa, #e879f9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.title-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  color: rgba(180, 200, 230, 0.7);
  cursor: pointer;
  user-select: none;
}

#title-toggle,
#qr-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(15, 25, 50, 0.6);
  border: 1px solid rgba(100, 180, 255, 0.2);
  border-radius: 12px;
  transition: background 0.3s, border-color 0.3s;
  flex-shrink: 0;
}

.toggle-switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: rgba(180, 200, 230, 0.6);
  border-radius: 50%;
  transition: transform 0.3s, background 0.3s;
}

#title-toggle:checked + .toggle-switch,
#qr-toggle:checked + .toggle-switch {
  background: linear-gradient(135deg, #4a6cf7, #6a3de8);
  border-color: rgba(106, 61, 232, 0.5);
}

#title-toggle:checked + .toggle-switch::before,
#qr-toggle:checked + .toggle-switch::before {
  transform: translateX(20px);
  background: #fff;
}

.title-input-group {
  display: flex;
  flex-direction: column;
}

#title-text {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 25, 50, 0.6);
  border: 1px solid rgba(100, 180, 255, 0.2);
  border-radius: 12px;
  color: #e0e8f0;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

#title-text:focus {
  border-color: rgba(100, 200, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(100, 200, 255, 0.1);
}

#title-text::placeholder {
  color: rgba(140, 170, 200, 0.4);
}

.title-input-group .char-counter {
  font-size: 0.8rem;
  color: rgba(140, 180, 220, 0.4);
  text-align: right;
  margin-top: 6px;
}

.title-status {
  font-size: 0.8rem;
  color: #64d8ff;
  opacity: 0;
  transition: opacity 0.3s;
}

.title-status.visible {
  opacity: 1;
}

.hidden {
  display: none;
}

@media (max-width: 480px) {
  body {
    padding: 16px;
  }

  .container {
    padding: 28px 20px;
  }

  h1 {
    font-size: 1.5rem;
  }
}
