/* Focus theme — overrides default.css base tokens */
:root {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-border: #ebecf0;
  --color-text: #1a1d24;
  --color-text-muted: #8b8f9a;
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-danger: #ef4444;
  --color-success: #22c55e;

  /* Ring tokens */
  --ring-track: #e8e9ee;
  --ring-progress: #4f46e5;
  --ring-width: 9;

  /* Card radii */
  --card-radius: 14px;
  --addr-card-radius: 16px;
  --copy-btn-radius: 12px;
}

/* ── Topbar ── */
.topbar {
  padding: 16px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--color-text);
  text-decoration: none;
}
.logo span { color: var(--color-primary); }
.menu { width: 20px; height: 20px; opacity: 0.4; }

/* ── Hero / Ring ── */
.hero {
  padding: 32px 24px 16px;
  text-align: center;
}
.hero-label {
  font-size: 13px;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 18px;
}
.ring-wrap {
  position: relative;
  width: 168px;
  height: 168px;
  margin: 0 auto 22px;
  transition: width 0.3s ease, height 0.3s ease;
}
.ring-wrap.email-arrived {
  width: 120px;
  height: 120px;
}
svg.ring { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--ring-track); stroke-width: 9; }
.ring-prog {
  fill: none;
  stroke: var(--ring-progress);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 471;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear;
}
.ring-time {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-time b {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  transition: font-size 0.3s ease;
}
.ring-wrap.email-arrived .ring-time b { font-size: 24px; }
.ring-time small {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.ring-time.warning b { color: var(--color-danger); }

/* ── Address card ── */
.addr-card {
  margin: 0 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--addr-card-radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
}
.addr { flex: 1; min-width: 0; }
.addr .a1 {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.addr .a2 { font-size: 12px; color: var(--color-text-muted); margin-top: 1px; }
.copy-btn {
  background: var(--color-primary);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: var(--copy-btn-radius);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.copy-btn:hover { background: var(--color-primary-hover); transform: translateY(-1px); }

/* ── Actions row ── */
.actions {
  display: flex;
  gap: 10px;
  padding: 12px 20px 0;
}
.actions button {
  flex: 1;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px;
  font-weight: 600;
  font-size: 13px;
  color: #3a3f4b;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}
.actions button:hover { border-color: #c7c9d1; background: #fbfbfd; }
.actions .confirm-wrap { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.actions .confirm-text { font-size: 12px; color: var(--color-text-muted); line-height: 1.4; }
.actions .confirm-btns { display: flex; gap: 8px; }
.actions .confirm-btns button { flex: 1; font-size: 12px; padding: 8px; }
.actions .confirm-btns .btn-confirm {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.actions .confirm-btns .btn-confirm:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }

/* ── Inbox region ── */
.inbox { padding: 20px 20px 0; flex: 1; }

/* ── Waiting state ── */
.waiting { text-align: center; padding: 24px 0; }
.pulse {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #eef0fb;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.pulse::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--color-primary);
  opacity: 0.5;
  animation: ring 1.8s ease-out infinite;
}
@keyframes ring {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}
.pulse span { font-size: 24px; }
.waiting h3 { font-size: 16px; font-weight: 700; margin-bottom: 5px; }
.waiting p { font-size: 13px; color: var(--color-text-muted); max-width: 240px; margin: 0 auto; line-height: 1.5; }

/* ── Reconnect state ── */
.reconnect-state { text-align: center; padding: 8px 0; }
.reconnect-state p { font-size: 13px; color: var(--color-text-muted); }
.reconnect-state button {
  margin-top: 8px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--color-primary);
  cursor: pointer;
  font-family: var(--font-sans);
}

/* ── Mail card ── */
.mail-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--card-radius);
  padding: 15px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
  animation: slideIn 0.4s ease;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.mail-card:hover {
  border-color: #c7c9d1;
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.mail-top {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 8px;
}
.avatar {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #24292f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.mail-from { flex: 1; min-width: 0; }
.mail-from b { font-size: 14px; display: block; font-weight: 700; }
.mail-from small { font-size: 11px; color: var(--color-text-muted); }
.mail-time { font-size: 11px; color: var(--color-primary); font-weight: 600; }
.mail-subj { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.mail-prev { font-size: 13px; color: var(--color-text-muted); line-height: 1.4; }

/* ── OTP chip ── */
.otp-chip {
  background: var(--color-primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-block;
  margin: 4px 0 4px;
  font-family: var(--font-sans);
  transition: background 0.15s ease;
}
.otp-chip:hover { background: var(--color-primary-hover); }

/* ── Ad container ── */
.ad {
  margin: 16px 16px 0;
  border: 1px dashed #d6d8e0;
  border-radius: 14px;
  padding: 16px;
  background: var(--color-surface);
  text-align: center;
  min-height: 120px;
}
.ad-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.ad-box {
  height: 90px;
  background: linear-gradient(135deg, #eef0fb, #f6f0fb);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #a9adba;
  font-size: 12px;
  font-weight: 600;
}

/* ── Read view ── */
.read-hd {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.back {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.back:hover { background: #f3f4f8; }
.read-hd .rt { flex: 1; }
.read-hd .rt b { font-size: 14px; display: block; font-weight: 700; }
.read-hd .rt small { font-size: 11px; color: var(--color-text-muted); }
.read-body {
  padding: 20px;
  flex: 1;
  overflow: auto;
}
.read-subj {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
  line-height: 1.25;
}
.read-body p { font-size: 14px; line-height: 1.65; color: #3a3f4b; margin-bottom: 13px; }
.read-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
  background: var(--color-surface);
}
.read-foot button {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-weight: 600;
  font-size: 13px;
  color: #3a3f4b;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-sans);
}
.read-foot button:hover:not(:disabled) { border-color: #c7c9d1; }
.read-foot button:disabled { opacity: 0.4; cursor: not-allowed; }
.read-foot button:disabled::after { content: ' · soon'; font-size: 10px; }

/* ── Viewer iframe ── */
#viewer {
  width: 100%;
  height: 400px;
  border: none;
  display: block;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111317;
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s ease;
  z-index: 50;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── RTL mirror rules ── */
[dir="rtl"] .addr-card { flex-direction: row-reverse; }
[dir="rtl"] .mail-top  { flex-direction: row-reverse; }
[dir="rtl"] .read-hd   { flex-direction: row-reverse; }
