/* WispInbox — modern aerogramme landing */
/* Brand tokens: /brand.css (loaded first). Local aliases kept for dark mode. */

:root {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1420;
    --paper-deep: #071018;
    --surface: #132235;
    --ink: #eaf0f8;
    --ink-soft: #9aadc3;
    --rule: #31485f;
    --rule-soft: #22364d;
    --red: #e5525f;
    --blue: #7aabf5;
    --blue-soft: #17304f;
    --on-blue: #0b1420;
    --hover: #1a2c43;
    --live: #5cc28f;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.28);
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  color: var(--ink);
  font: 400 16px/1.55 var(--font-ui);
  background: linear-gradient(165deg, #f4f8fd 0%, var(--paper) 42%, var(--paper-deep) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

.atmosphere {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(255, 255, 255, 0.75), transparent 62%),
    radial-gradient(520px 320px at 8% 18%, rgba(196, 30, 46, 0.06), transparent 70%),
    radial-gradient(520px 320px at 92% 22%, rgba(21, 72, 146, 0.08), transparent 70%),
    repeating-linear-gradient(
      -45deg,
      transparent 0 18px,
      rgba(21, 72, 146, 0.025) 18px 19px,
      transparent 19px 36px,
      rgba(196, 30, 46, 0.02) 36px 37px
    );
}

body > *:not(.atmosphere) {
  position: relative;
  z-index: 1;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 70%, var(--red));
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  z-index: 10;
}

.skip-link:focus {
  top: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---- top bar ---- */

.topbar {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.btn-signin,
.btn-api-docs,
.btn-extensions,
.btn.btn-signin,
.btn.btn-api-docs,
.btn.btn-extensions,
a.btn-api-docs,
a.btn-extensions,
.lang-switch select {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--ctrl-h) !important;
  height: var(--ctrl-h);
  min-width: 5.5rem;
  padding: 0 var(--ctrl-px) !important;
  border: var(--ctrl-border);
  border-radius: var(--ctrl-radius);
  font-family: var(--font);
  font-size: var(--ctrl-font) !important;
  font-weight: var(--ctrl-weight);
  line-height: 1;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 92%, var(--paper));
  text-decoration: none;
  white-space: nowrap;
  gap: 0;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.btn.btn-signin:hover:not(:disabled),
.btn.btn-api-docs:hover,
.btn.btn-extensions:hover,
a.btn-api-docs:hover,
a.btn-extensions:hover {
  border-color: var(--rule);
  background: var(--blue-soft);
  color: var(--blue);
  text-decoration: none;
  transform: none;
  box-shadow: none;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ctrl-font);
  color: var(--ink-soft);
}

.lang-switch-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lang-switch select {
  appearance: none;
  min-width: 7.25rem;
  cursor: pointer;
  backdrop-filter: blur(8px);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px !important;
}

.lang-switch select:hover {
  border-color: var(--rule);
  background-color: var(--blue-soft);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(220px, 42vw);
  min-height: var(--ctrl-h);
  padding: 4px 10px 4px 4px;
  border: var(--ctrl-border);
  border-radius: var(--ctrl-radius);
  background: color-mix(in srgb, var(--surface) 92%, var(--paper));
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
  -webkit-tap-highlight-color: color-mix(in srgb, var(--blue) 20%, transparent);
  touch-action: manipulation;
  flex: 0 1 auto;
  min-width: 0;
}

.user-chip:hover,
.user-chip:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.user-chip::after {
  content: '';
  width: 0.45em;
  height: 0.45em;
  margin-left: 2px;
  border-right: 2px solid var(--ink-soft);
  border-bottom: 2px solid var(--ink-soft);
  transform: rotate(45deg);
  flex: 0 0 auto;
  opacity: 0.7;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.user-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
  gap: 2px;
}

.user-name {
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.user-plan {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.oauth-icon {
  flex: 0 0 auto;
}

.login-providers {
  display: grid;
  gap: 10px;
  margin: 4px 0 16px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  text-decoration: none;
  font-weight: 600;
  border-radius: 12px;
}

.btn-google {
  background: #fff;
  border-color: #dadce0;
  color: #3c4043;
}

.btn-google:hover {
  background: #f7f8f8;
  border-color: #c6c9ce;
}

.btn-github {
  background: #24292f;
  border-color: #24292f;
  color: #fff;
}

.btn-github:hover {
  filter: brightness(1.08);
}

.account-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 4px 0 18px;
  padding: 14px;
  border: 1px solid var(--rule-soft);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.account-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.account-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 10px;
}

.account-row {
  margin: 0;
  display: grid;
  gap: 2px;
}

.account-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.account-row > span:last-child {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.account-mailboxes {
  margin: 0 0 16px;
}

.account-mailboxes > .account-label {
  display: block;
  margin-bottom: 8px;
}

.account-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.mailbox-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: min(240px, 40vh);
  overflow: auto;
}

.mailbox-item-btn {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}

.mailbox-item-btn:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.mailbox-item.is-current .mailbox-item-btn {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--rule));
  background: color-mix(in srgb, var(--blue-soft) 70%, var(--surface));
}

.mailbox-item-address {
  grid-column: 1;
  font-size: 0.92rem;
  font-weight: 650;
  word-break: break-all;
}

.mailbox-item-until {
  grid-column: 1;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.mailbox-item-badge {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue);
}

.mailbox-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  padding: 0 2px;
}

.mailbox-item-actions .btn {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.82rem;
}

.share-address {
  margin: 0;
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--hover);
  font-family: var(--font-typed);
  font-weight: 700;
  word-break: break-all;
}

.share-address-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
}

.btn-icon-copy {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
}

.btn-icon-copy:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.share-member-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.share-member-actions .btn,
.btn-copy-invite {
  min-height: 36px;
  min-width: 108px;
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
}

.share-member-info {
  min-width: 0;
}

.share-member-locked {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.share-result {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--blue-soft) 70%, var(--surface));
  font-size: 0.9rem;
  line-height: 1.45;
}

.share-result-text {
  margin: 0 0 8px;
}

.share-result-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.share-result-link {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.78rem;
  word-break: break-all;
}

.share-members {
  margin: 14px 0 0;
}

.share-member-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.share-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  font-size: 0.88rem;
}

.share-member-meta {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

#share-dialog,
#join-dialog {
  width: min(480px, calc(100vw - 32px));
}

.join-dialog .join-form {
  text-align: center;
}

.join-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.join-brand .brand-mark {
  width: 28px;
  height: 28px;
}

.join-dialog #join-title {
  margin-bottom: 8px;
}

.join-lead {
  max-width: 34ch;
  margin-left: auto;
  margin-right: auto;
}

.join-email-pill {
  display: inline-block;
  margin: 4px 0 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.join-email-pill:empty {
  display: none;
}

.join-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.join-actions .join-continue {
  width: 100%;
  justify-content: center;
  min-height: 48px;
  font-weight: 700;
}

#share-email {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--hover);
  font: inherit;
}

.plan-cards {
  display: grid;
  gap: 10px;
  margin: 8px 0 14px;
}

@media (min-width: 640px) {
  .plan-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.plan-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--rule-soft);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.plan-card:hover {
  border-color: var(--blue);
}

.plan-card.is-selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--blue) 35%, transparent);
}

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

.plan-card-name {
  font-weight: 750;
  font-size: 1rem;
}

.plan-card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0b7a3e;
  background: color-mix(in srgb, #0b7a3e 12%, #fff);
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.plan-card-tag {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.plan-card-price {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.plan-card-compare {
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-decoration: line-through;
}

.plan-card-amount {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink);
}

.plan-card-period {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.plan-card-note {
  margin: 2px 0 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue);
}

.plan-summary {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

#pro-dialog {
  position: fixed;
  top: max(16px, 3vh);
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  margin: 0;
  width: min(720px, calc(100vw - 24px));
  max-width: 720px;
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

html.dialog-open,
html.dialog-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

html[dir="rtl"] .lang-switch select {
  padding: 0 14px 0 30px;
  background-position: 9px 55%, 14px 55%;
}

html[dir="rtl"] .topbar-right {
  flex-direction: row-reverse;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.brand:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

.brand-mark {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: var(--shadow-soft);
}

.status {
  /* Connection state kept in DOM for JS; not shown in the topbar UI */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rule);
}

.status[data-state="live"] .status-dot {
  background: var(--live);
}

.status[data-state="offline"] .status-dot {
  background: var(--red);
}

@media (prefers-reduced-motion: no-preference) {
  .status[data-state="live"] .status-dot {
    animation: pulse-live 2s ease-in-out infinite;
  }
}

@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 45%, transparent); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

/* ---- page / landing ---- */

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 18px 20px 48px;
}

.landing {
  margin: 8px 0 8px;
  text-align: center;
}

.hero-lead {
  margin: 0 auto 24px;
  max-width: 36ch;
  font-family: var(--font-ui);
  font-size: clamp(1.15rem, 2.8vw, 1.35rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.45;
  color: var(--ink-soft);
}

.shell {
  display: block;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 12px;
  position: relative;
}

.shell .page {
  max-width: none;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-lead {
    animation: rise-in 0.5s ease both;
  }
  .landing .label {
    animation: envelope-in 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: 0.14s;
  }
  .shell .page > .hint,
  .shell .page > .panel {
    animation: rise-in 0.45s ease both;
  }
  .shell .page > .hint { animation-delay: 0.22s; }
  .shell .page > .panel { animation-delay: 0.28s; }
}

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

@keyframes brand-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes envelope-in {
  from {
    opacity: 0;
    transform: translateY(18px) rotate(-0.4deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

.rail {
  display: none;
  z-index: 1 !important;
}

.ad-rail {
  min-height: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  overflow: hidden;
  border: 0;
}

.topbar,
.footer {
  max-width: 1400px;
}

.topbar {
  max-width: 820px;
}

@media (min-width: 1400px) {
  .rail:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: fixed;
    top: 88px;
    width: 300px;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    pointer-events: auto;
    z-index: 1 !important;
  }

  .rail-left:not([hidden]) {
    left: max(8px, calc(50% - 410px - 324px));
    right: auto;
  }

  .rail-right:not([hidden]) {
    right: max(8px, calc(50% - 410px - 324px));
    left: auto;
  }

  .ad-rail:not([hidden]) {
    min-height: 250px;
    max-width: 300px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
  }

  .rail iframe,
  .rail > *,
  .ad-rail > * {
    max-width: 100% !important;
  }
}

@media (max-width: 1399px) {
  .rail {
    display: none !important;
  }
}

/* In-flow banners under inbox — phones/tablets only (side rails need ≥1400px) */
.ad-mobile-row {
  display: none;
  margin: 18px 0 8px;
  width: 100%;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
}

.ad-mobile-row:not([hidden]) {
  display: flex;
}

.ad-mobile {
  display: none;
  margin: 0;
  width: auto;
  max-width: 100%;
  min-height: 0;
  flex: 0 0 auto;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.ad-mobile:not([hidden]) {
  display: flex;
  min-height: 160px;
}

@media (min-width: 1400px) {
  .ad-mobile-row {
    display: none !important;
  }
}

.topbar,
.shell .page,
.label,
.actions,
.notice,
.panel {
  position: relative;
  z-index: 2147483000 !important;
  isolation: isolate;
}

.actions .btn,
#copy-btn,
#new-btn,
#name-btn,
#pro-btn,
.address,
.topbar,
.auth-box,
.user-chip,
.btn-signin,
.lang-switch,
.lang-switch select,
#status {
  position: relative;
  z-index: 2147483001 !important;
  pointer-events: auto !important;
}

.user-chip {
  z-index: 2147483002 !important;
}

dialog {
  z-index: 2147483646 !important;
}

dialog::backdrop {
  z-index: 2147483645 !important;
}

/* ---- address label (hero product visual) ---- */

.label {
  position: relative;
  padding: 8px;
  border-radius: 22px;
  text-align: left;
  background: repeating-linear-gradient(
    -45deg,
    var(--red) 0 11px,
    #fff 11px 18px,
    var(--blue) 18px 29px,
    #fff 29px 36px
  );
  box-shadow: var(--shadow);
}

html[dir="rtl"] .label {
  text-align: right;
}

@media (prefers-reduced-motion: no-preference) {
  .label {
    background-size: 200% 200%;
    animation: stripe-drift 18s linear infinite;
  }
}

@keyframes stripe-drift {
  from { background-position: 0 0; }
  to { background-position: 72px 72px; }
}

.label-body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
  border-radius: 15px;
  padding: 28px 28px 26px;
}

@media (prefers-color-scheme: dark) {
  .label-body {
    background: linear-gradient(180deg, #16263c, #132235);
  }
}

.label-heading {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

button.address {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  padding: 16px 18px;
  border: 1.5px solid color-mix(in srgb, var(--blue) 22%, var(--rule));
  border-radius: 12px;
  background:
    linear-gradient(180deg, #fff, var(--hover));
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

@media (prefers-color-scheme: dark) {
  button.address {
    background: linear-gradient(180deg, #1a2d45, #152538);
  }
}

html[dir="rtl"] button.address {
  text-align: right;
}

button.address:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 20%, transparent);
}

button.address:active:not(:disabled) {
  transform: scale(0.995);
}

button.address.is-copied {
  border-style: solid;
  border-color: var(--live);
  background: color-mix(in srgb, var(--live) 12%, var(--surface));
}

button.address:disabled {
  cursor: default;
  opacity: 0.9;
}

.address {
  min-height: 1.15em;
  font-family: var(--font-typed);
  font-weight: 700;
  font-size: clamp(1.25rem, 4.8vw, 1.95rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
  user-select: all;
  color: var(--ink);
}

.address-domain {
  color: var(--ink-soft);
  font-weight: 600;
}

.address-pending {
  color: var(--ink-soft);
  font-weight: 500;
  font-family: var(--font-ui);
  user-select: none;
}

.copy-hint {
  margin: 0 0 18px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ---- buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--btn-h);
  padding: 0 var(--btn-px);
  border: 1.5px solid var(--rule);
  border-radius: var(--btn-radius);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 600;
  font-size: var(--btn-font);
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.btn .btn-ico {
  width: var(--btn-icon);
  height: var(--btn-icon);
  flex: 0 0 auto;
  display: block;
}

.btn:hover:not(:disabled) {
  border-color: var(--ink-soft);
  transform: translateY(-1px);
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--blue) 92%, #fff), var(--blue));
  border-color: var(--blue);
  color: var(--on-blue);
  min-width: 11em;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--blue) 26%, transparent);
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--blue) 88%, var(--ink));
  border-color: transparent;
}

.btn-primary.is-copied {
  background: var(--live);
  border-color: var(--live);
  box-shadow: none;
}

.btn-secondary {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-color: color-mix(in srgb, var(--blue) 30%, var(--rule));
  color: var(--blue);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.btn-pro {
  background: linear-gradient(135deg, #0f3d73, #1d4f91);
  border-color: #0f3d73;
  color: #fff;
  font-weight: 650;
}

.btn-pro:hover:not(:disabled) {
  filter: brightness(1.06);
}

.pro-badge {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--blue);
  font-weight: 600;
}

.pro-perks {
  margin: 0 0 14px;
  padding-left: 1.2em;
  color: var(--ink-soft);
  line-height: 1.55;
}

.pro-price {
  margin: 0 0 8px;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

body.is-pro .rail,
body.is-pro .ad-mobile-row {
  display: none !important;
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  padding: 0 12px;
  color: var(--blue);
  min-height: 40px;
  box-shadow: none;
}

.btn-quiet:hover:not(:disabled) {
  background: var(--hover);
  border-color: transparent;
  transform: none;
}

.btn-danger {
  color: var(--red);
}

/* ---- hint and notices ---- */

.hint {
  margin: 16px auto 24px;
  max-width: min(720px, 100%);
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  .hint {
    white-space: normal;
  }
}

.hint [data-ttl] {
  font-weight: 600;
  color: var(--ink);
}

.api-quota-promo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin: -8px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-soft);
}

.api-quota-copy {
  min-width: 0;
  flex: 1 1 320px;
}

.api-quota-title {
  margin: 0 0 2px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink);
}

.api-quota-body {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.api-quota-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-api-docs-inline {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.82rem;
  text-decoration: none;
}

.api-quota-promo .btn-pro {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.84rem;
}

.api-quota-promo.is-warning {
  border-color: color-mix(in srgb, #cf8b00 45%, var(--rule));
  background: color-mix(in srgb, #ffefc2 42%, var(--surface));
}

.api-quota-promo.is-reached {
  border-color: color-mix(in srgb, var(--red) 52%, var(--rule));
  background: color-mix(in srgb, var(--red) 10%, var(--surface));
}

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: -8px 0 20px;
  padding: 12px 14px 12px 16px;
  background: var(--surface);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.notice p {
  flex: 1 1 280px;
  margin: 0;
}

/* ---- inbox ---- */

.panel {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--rule-soft);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

.panel:focus {
  outline: none;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 20px;
  border-bottom: 1px solid var(--rule-soft);
  background: color-mix(in srgb, var(--hover) 65%, var(--surface));
}

.panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.count {
  font-weight: 500;
  color: var(--ink-soft);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li + li {
  border-top: 1px solid var(--rule-soft);
}

.row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
  row-gap: 2px;
  width: 100%;
  padding: 15px 20px 16px 34px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.row:hover {
  background: var(--hover);
}

.row.unread::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.row-from,
.row-subject,
.row-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-from {
  font-weight: 500;
}

.row-time {
  font-size: 0.88rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.row-subject {
  grid-column: 1 / -1;
}

.row.unread .row-from,
.row.unread .row-subject {
  font-weight: 700;
}

.row-preview {
  grid-column: 1 / -1;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.row-files {
  color: var(--blue);
  font-weight: 500;
}

@media (prefers-reduced-motion: no-preference) {
  .row.fresh {
    animation: mail-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both, arrive 1.8s ease-out;
  }
}

@keyframes mail-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mail-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}

.row.is-leaving {
  animation: mail-out 0.28s ease forwards;
}

@keyframes address-swap {
  0% { opacity: 0.35; transform: scale(0.98); }
  55% { opacity: 1; transform: scale(1.015); }
  100% { opacity: 1; transform: scale(1); }
}

button.address.is-swapping {
  animation: address-swap 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes arrive {
  from {
    background: color-mix(in srgb, var(--blue) 18%, transparent);
  }
  to {
    background: transparent;
  }
}

.empty {
  padding: 36px 24px 40px;
  text-align: center;
  color: var(--ink-soft);
}

.empty p {
  max-width: 42ch;
  margin: 0 auto;
}

.empty .empty-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.howto {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  list-style: none;
  margin: 22px auto 0;
  padding: 0;
  max-width: 520px;
  counter-reset: step;
}

.howto li {
  position: relative;
  margin: 0;
  padding: 14px 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--hover);
  border: 1px solid var(--rule-soft);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  counter-increment: step;
}

.howto li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--on-blue);
  font-size: 0.75rem;
  font-weight: 700;
}

.listening {
  display: inline-flex;
  gap: 4px;
}

.listening i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0.6;
}

@media (prefers-reduced-motion: no-preference) {
  .listening i {
    animation: listen 1.4s ease-in-out infinite;
  }
  .listening i:nth-child(2) { animation-delay: 0.2s; }
  .listening i:nth-child(3) { animation-delay: 0.4s; }
}

@keyframes listen {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---- message reader ---- */

.reader-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-soft);
  background: color-mix(in srgb, var(--hover) 70%, var(--surface));
}

.reader-head {
  padding: 20px 24px 16px;
  background: var(--surface);
}

.reader-head h2 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.reader-head h2:focus {
  outline: none;
}

.meta {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 12px 14px;
  font-size: 0.92rem;
  background: var(--hover);
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
}

.meta div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
}

.meta dt {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.attachment {
  min-height: 42px;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 500;
  gap: 8px;
  border-radius: 10px;
  background: var(--blue-soft);
  border-color: color-mix(in srgb, var(--blue) 28%, var(--rule));
  color: var(--blue);
}

.attachment:hover:not(:disabled) {
  background: color-mix(in srgb, var(--blue-soft) 70%, var(--surface));
}

.attachment-size {
  color: var(--ink-soft);
  font-weight: 400;
}

.reader-frame {
  display: block;
  width: 100%;
  height: min(72vh, 820px);
  min-height: 420px;
  border: 0;
  border-top: 1px solid var(--rule-soft);
  background: #ffffff;
}

/* ---- dialogs ---- */

dialog {
  position: fixed;
  top: max(16px, 3vh);
  left: 50%;
  right: auto;
  bottom: auto;
  transform: translateX(-50%);
  margin: 0;
  width: min(470px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(8, 20, 40, 0.32);
}

dialog::backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 23, 38, 0.5);
  backdrop-filter: blur(2px);
  overscroll-behavior: none;
}

dialog form {
  padding: 24px;
}

dialog h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dialog-text {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.field-row input,
.field-row select {
  min-height: 46px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--hover);
}

.field-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 12px;
  font-family: var(--font-typed);
  font-weight: 700;
  font-size: 1.05rem;
}

.field-row input[aria-invalid="true"] {
  border-color: var(--red);
}

.field-row select {
  flex: 0 1 auto;
  max-width: 55%;
  padding: 0 8px;
}

.at {
  font-family: var(--font-typed);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.field-error {
  min-height: 1.5em;
  margin: 8px 0 0;
  font-size: 0.88rem;
  color: var(--red);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

/* ---- toast ---- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 2147483640;
  box-shadow: var(--shadow);
}

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

@media (prefers-reduced-motion: reduce) {
  .toast,
  .btn,
  .brand,
  button.address,
  .label,
  .landing-brand,
  .hero-title,
  .hero-sub,
  .landing .label,
  .shell .page > .hint,
  .shell .page > .panel {
    transition: none !important;
    animation: none !important;
  }
}

/* ---- FAQ ---- */

.faq {
  margin-top: 28px;
}

.faq h3 {
  margin: 18px 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.faq p {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ---- footer ---- */

.footer {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px 48px;
  font-size: 0.88rem;
  color: var(--ink-soft);
  text-align: center;
}

.footer p {
  margin: 0 auto;
  max-width: 62ch;
}

.footer-legal {
  margin-top: 10px !important;
  font-size: 0.82rem;
}

.footer-legal a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
}

.footer-legal a:hover {
  text-decoration: underline;
}

/* ---- ads + SEO ---- */

.ad-slot {
  margin: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: transparent;
  border: 0;
}

.ad-sticky {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--rule-soft);
  padding: 6px 10px env(safe-area-inset-bottom, 0);
}

.seo {
  margin: 28px 0 8px;
  padding: 22px 0 4px;
  border-top: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.seo h2 {
  margin: 22px 0 8px;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.seo > h2:first-child {
  margin-top: 0;
}

.seo p {
  margin: 0 0 10px;
  max-width: 66ch;
}

.seo .faq h2 {
  margin-top: 28px;
  font-size: 1.2rem;
}

.seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.seo-links a {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: var(--shadow-soft);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.seo-links a:hover {
  background: var(--blue-soft);
  border-color: color-mix(in srgb, var(--blue) 40%, var(--rule));
  text-decoration: none;
}

.article h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.article .lead {
  font-size: 1.05rem;
  color: var(--ink-soft);
  max-width: 62ch;
}

.article h2 {
  margin: 28px 0 10px;
  font-size: 1.2rem;
  font-weight: 700;
}

.article ul,
.article ol {
  max-width: 62ch;
  color: var(--ink-soft);
}

.article .crumb {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.article .crumb a {
  color: var(--blue);
  text-decoration: none;
}

.article .more-links {
  margin-top: 28px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.article .more-links a {
  color: var(--blue);
}

body.has-sticky-ad {
  padding-bottom: 72px;
}

/* ---- small / mid screens ---- */

@media (max-width: 720px) {
  .topbar {
    padding: 12px 14px 0;
    gap: 8px;
    align-items: flex-start;
  }

  .topbar-right {
    flex-wrap: wrap;
    max-width: min(100%, 420px);
  }

  .btn-api-docs,
  .btn-extensions,
  a.btn-api-docs,
  a.btn-extensions {
    min-width: 0;
    padding: 0 10px !important;
    font-size: 0.8rem !important;
  }

  .lang-switch select {
    min-width: 5.5rem;
    padding-right: 26px !important;
  }

  .user-chip {
    max-width: min(160px, 46vw);
    padding-right: 8px;
  }

  .user-chip::after {
    display: none;
  }

  .user-name {
    max-width: 72px;
  }

  .user-plan {
    max-width: 72px;
  }
}

@media (max-width: 560px) {
  .page {
    padding-top: 10px;
  }
  .landing-brand {
    font-size: clamp(1.85rem, 9vw, 2.4rem);
  }
  .label {
    padding: 6px;
    border-radius: 18px;
  }
  .label-body {
    padding: 20px 16px 18px;
  }
  .actions {
    justify-content: stretch;
  }
  .actions .btn {
    flex: 1 1 auto;
  }
  .btn-primary {
    flex: 1 1 100%;
  }
  .howto {
    grid-template-columns: 1fr;
    max-width: 280px;
  }
  .howto li {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    padding: 12px 14px;
  }
  .howto li::before {
    margin: 0;
    flex: 0 0 auto;
  }
  .row {
    padding-right: 16px;
  }
  .reader-head {
    padding: 16px 16px 14px;
  }
  .meta div {
    grid-template-columns: 72px minmax(0, 1fr);
  }
  .reader-frame {
    height: 64vh;
  }
}
