:root {
  --bg: #0f1115;
  --card: #1a1d24;
  --card-2: #20242c;
  --text: #f2f3f5;
  --text-dim: #9aa1ac;
  --accent: #4d8dff;
  --accent-2: #7c5cff;
  --otp-bg: linear-gradient(135deg, #4d8dff, #7c5cff);
  --success: #2ecc71;
  --border: #262a33;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) 16px 14px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
  flex: none;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5);
}
.dot.live {
  background: var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.number {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub {
  font-size: 12px;
  color: var(--text-dim);
}

.icon-btn {
  border: none;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.icon-btn:active { transform: scale(0.92); opacity: 0.7; }
.icon-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.feed {
  flex: 1;
  padding: 14px 14px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty[hidden] {
  display: none;
}

.empty {
  margin-top: 20vh;
  text-align: center;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.empty-icon { font-size: 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  animation: rise 0.25s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.time {
  font-size: 12px;
  color: var(--text-dim);
}

.body-text {
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 2px;
}

.otp-btn {
  width: 100%;
  border: none;
  border-radius: 14px;
  background: var(--otp-bg);
  color: #fff;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
  box-shadow: 0 6px 18px -8px rgba(77, 141, 255, 0.55);
}
.otp-btn:active { transform: scale(0.98); }
.otp-btn.copied { background: linear-gradient(135deg, #2ecc71, #27ae60); }

.otp-code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 4px;
}

.otp-hint {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.unread-badge {
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 20px;
  padding: 2px 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #1c1c1e;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.skeleton {
  height: 84px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 37%, var(--card) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
