:root {
  --bg-dark: #0a0e17;
  --bg-card: #131b2e;
  --bg-bubble-me: #3b82f6;
  --bg-bubble-her: #1e293b;
  --bg-detail-me: #4338ca;
  --bg-detail-her: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.35);
  --danger: #ef4444;
  --success: #10b981;
  --border: #1e293b;
  --border-light: #334155;
  --glass: rgba(19, 27, 46, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  user-select: none;
}

/* Container */
.app-container {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

/* Header */
.app-header {
  height: 60px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
}

.profile-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-wrapper {
  position: relative;
  cursor: pointer;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.avatar.online::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 11px;
  height: 11px;
  background: #10b981;
  border: 2px solid var(--bg-dark);
  border-radius: 50%;
}

.header-text h2 {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.header-text p {
  font-size: 12px;
  color: var(--text-muted);
}

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

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  transform: scale(0.96);
}

.mode-badge {
  font-size: 11px;
  padding: 5px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
}

.mode-badge.locked {
  background: rgba(234, 179, 8, 0.12);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.28);
}

.mode-badge.locked:hover, .mode-badge.locked:active {
  background: rgba(234, 179, 8, 0.2);
  transform: scale(0.97);
}

.mode-badge.unlocked {
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

/* Chat Messages Stream */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: radial-gradient(circle at 50% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 60%);
}

.chat-body::-webkit-scrollbar {
  width: 4px;
}
.chat-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

/* Message Bubbles */
/* Message Stream / Note Entries (All Left Aligned) */
.message-row {
  display: flex;
  width: 100%;
  justify-content: flex-start;
}

.msg-bubble {
  width: 100%;
  max-width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  position: relative;
  font-size: 14.5px;
  line-height: 1.5;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-left: 3px solid rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
  transition: all 0.25s ease;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.msg-bubble:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
  border-left-color: var(--accent);
}

.msg-meta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.msg-sender-tag {
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.3px;
}

.secret-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
}

.msg-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 4px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.65);
}

/* Input Area */
.chat-footer {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--glass-border);
  padding: 12px 14px;
  z-index: 20;
}

.compose-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 10px 12px;
  transition: border-color 0.2s;
}

.compose-box:focus-within {
  border-color: var(--accent);
}

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

.fake-input, .secret-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14.5px;
}

.fake-input::placeholder, .secret-input::placeholder {
  color: var(--text-muted);
}

.secret-input-wrapper {
  display: none;
  border-top: 1px dashed rgba(168, 85, 247, 0.4);
  padding-top: 8px;
  margin-top: 2px;
  animation: slide-down 0.25s ease-out forwards;
}

.secret-input-wrapper.active {
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.secret-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #c084fc;
  background: rgba(139, 92, 246, 0.15);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.toggle-secret-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-secret-btn.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(168, 85, 247, 0.5);
  color: #c084fc;
}

.send-btn {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.send-btn:hover {
  transform: scale(1.05);
}

.send-btn:active {
  transform: scale(0.92);
}

/* Modals & Overlays */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 380px;
  background: #111827;
  border: 1px solid var(--border-light);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* PIN Pad */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin: 10px 0;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-light);
  transition: all 0.2s;
}

.dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.key-btn {
  aspect-ratio: 1.25;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.key-btn:active {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(0.93);
}

.key-btn.key-action {
  grid-column: span 2;
  aspect-ratio: auto;
  padding: 10px 0;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.08);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Settings fields */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group textarea {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 13px;
  outline: none;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent);
}

/* Toast */
.toast {
  position: absolute;
  top: 75px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-light);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Panic Quick disguise */
.panic-banner {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  color: #1f2937;
  padding: 24px;
  z-index: 999;
  flex-direction: column;
}

.panic-banner.active {
  display: flex;
}
