:root {
  --paper: #f6ead4;
  --paper-deep: #ead7b5;
  --ink: #192331;
  --muted: #6e604c;
  --wire: #d3b98b;
  --signal: #e54b2a;
  --signal-dark: #9d2b18;
  --mint: #c4f06a;
  --blueprint: #243b55;
  --panel: rgba(255, 249, 236, 0.82);
  --shadow: 0 28px 80px rgba(52, 38, 18, 0.18);
  --radius-xl: 32px;
  --radius-md: 18px;
  --display: "Fraunces", Georgia, serif;
  --body: "Bricolage Grotesque", "Trebuchet MS", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--body);
  background:
    radial-gradient(circle at 15% 10%, rgba(196, 240, 106, 0.5), transparent 24rem),
    radial-gradient(circle at 82% 0%, rgba(229, 75, 42, 0.26), transparent 22rem),
    linear-gradient(135deg, var(--paper), #fff6e4 45%, var(--paper-deep));
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(25, 35, 49, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(25, 35, 49, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000, transparent 84%);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1420px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: end;
  min-height: 240px;
  margin-bottom: 28px;
}

.hero-copy {
  max-width: 880px;
  animation: rise-in 650ms ease both;
}

.eyebrow,
.kicker {
  margin: 0 0 10px;
  color: var(--signal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: var(--display);
  line-height: 0.95;
}

h1 {
  max-width: 760px;
  font-size: clamp(4.2rem, 10vw, 10.8rem);
  letter-spacing: -0.08em;
}

h2 {
  font-size: clamp(2rem, 3vw, 3.2rem);
  letter-spacing: -0.055em;
}

.lede {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(1.04rem, 1.8vw, 1.32rem);
  line-height: 1.45;
}

.signal-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid rgba(25, 35, 49, 0.15);
  border-radius: 999px;
  background: rgba(25, 35, 49, 0.94);
  color: #fff7e5;
  box-shadow: var(--shadow);
  animation: rise-in 700ms ease 120ms both;
}

.signal-card strong,
.signal-card small {
  display: block;
}

.signal-card small {
  color: rgba(255, 247, 229, 0.72);
}

.pulse-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(196, 240, 106, 0.8);
  animation: pulse 1.8s infinite;
}

.workspace {
  display: grid;
  grid-template-columns: 380px minmax(360px, 1fr) minmax(360px, 420px);
  gap: 18px;
  align-items: start;
}

.panel {
  min-height: 420px;
  padding: 22px;
  border: 1px solid rgba(25, 35, 49, 0.14);
  border-radius: var(--radius-xl);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  animation: rise-in 620ms ease both;
}

.panel:nth-child(2) {
  animation-delay: 90ms;
}

.panel:nth-child(3) {
  animation-delay: 180ms;
}

.panel-header {
  margin-bottom: 22px;
}

.split {
  display: flex;
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.mailbox-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(25, 35, 49, 0.18);
  border-radius: 16px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus,
select:focus {
  border-color: var(--signal);
  box-shadow: 0 0 0 4px rgba(229, 75, 42, 0.12);
  transform: translateY(-1px);
}

.address-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(25, 35, 49, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
}

.address-row input {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.address-row select {
  width: auto;
  min-width: 168px;
  border: 0;
  border-left: 1px solid rgba(25, 35, 49, 0.12);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--signal-dark);
  font-weight: 800;
  text-transform: none;
}

.address-row input:focus {
  box-shadow: none;
  transform: none;
}

#domain-select:focus {
  box-shadow: none;
  transform: none;
}

.turnstile-slot {
  display: grid;
  min-height: 66px;
  place-items: center;
  border: 1px dashed rgba(25, 35, 49, 0.22);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.38);
  text-align: center;
}

.turnstile-slot.is-dev {
  color: var(--signal-dark);
}

.primary-action,
.ghost-action {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 54px;
  padding: 0 18px 0 22px;
  background: var(--ink);
  color: #fff7e5;
  box-shadow: 0 16px 36px rgba(25, 35, 49, 0.22);
}

.ghost-action {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(25, 35, 49, 0.16);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
}

.primary-action:hover,
.ghost-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(25, 35, 49, 0.14);
}

.primary-action:disabled,
.ghost-action:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.form-note,
.status,
.message-detail p {
  color: var(--muted);
  line-height: 1.45;
}

.mailbox-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.mailbox-pill,
.code-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  max-width: 100%;
  border: 0;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff7e5;
  font-weight: 800;
  word-break: break-all;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.mailbox-pill:hover,
.mailbox-pill:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(25, 35, 49, 0.16);
}

.copy-pill-action {
  border-radius: 999px;
  padding: 5px 8px;
  background: var(--mint);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
  white-space: nowrap;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(25, 35, 49, 0.2);
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
}

.message-list {
  display: grid;
  gap: 12px;
}

.message-card {
  width: 100%;
  border: 1px solid rgba(25, 35, 49, 0.14);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.58);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.message-card:hover,
.message-card.is-selected,
.message-card:focus-visible {
  border-color: var(--signal);
  outline: none;
  box-shadow: 0 10px 28px rgba(229, 75, 42, 0.12);
}

.message-card header {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: start;
}

.message-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.03rem;
}

.message-card small {
  color: var(--muted);
}

.unread-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--signal);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.message-meta span,
.meta-pill,
.tag {
  border: 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(25, 35, 49, 0.08);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.meta-pill {
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
  transition: background 160ms ease, transform 160ms ease;
}

.meta-pill:hover,
.meta-pill:focus-visible {
  outline: none;
  background: rgba(196, 240, 106, 0.46);
  transform: translateY(-1px);
}

.code-pill {
  border: 0;
  background: var(--mint);
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.code-pill:hover,
.code-pill:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(25, 35, 49, 0.15);
}

.message-detail {
  display: grid;
  gap: 12px;
}

.message-detail.empty {
  align-content: center;
}

.empty-mark {
  color: var(--signal-dark);
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
}

.reader {
  overflow: hidden;
}

.reader h2 {
  font-size: clamp(2rem, 2.7vw, 2.8rem);
}

.detail-heading {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.detail-heading small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-heading h3 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.65rem, 2.3vw, 2.35rem);
  line-height: 1;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.detail-callout {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid rgba(229, 75, 42, 0.18);
  border-radius: 18px;
  background: rgba(229, 75, 42, 0.08);
  color: var(--signal-dark);
  font-weight: 800;
  line-height: 1.25;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.detail-box {
  min-width: 0;
  padding: 13px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
}

.detail-box--code {
  border: 1px solid rgba(25, 35, 49, 0.08);
  background: rgba(196, 240, 106, 0.22);
}

.detail-box--code.is-copyable {
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.detail-box--code.is-copyable:hover,
.detail-box--code.is-copyable:focus-visible {
  border-color: rgba(25, 35, 49, 0.18);
  outline: none;
  box-shadow: 0 14px 28px rgba(25, 35, 49, 0.12);
  transform: translateY(-1px);
}

.detail-box small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-box strong,
.detail-box p {
  overflow-wrap: anywhere;
}

.detail-secondary {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.detail-box p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.35;
}

.code-detail-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.code-detail-row strong {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.mini-copy {
  display: inline-flex;
  border: 0;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--mint);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
}

.mini-copy:hover,
.mini-copy:focus-visible {
  outline: none;
  box-shadow: 0 8px 18px rgba(25, 35, 49, 0.14);
}

.action-list {
  display: grid;
  gap: 8px;
}

.action-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(25, 35, 49, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.action-link:hover,
.action-link:focus-visible {
  border-color: rgba(229, 75, 42, 0.35);
  outline: none;
  box-shadow: 0 12px 24px rgba(25, 35, 49, 0.1);
  transform: translateY(-1px);
}

.action-link span {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.action-link strong,
.action-link small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-link strong {
  font-size: 0.95rem;
  font-weight: 800;
}

.action-link small {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0;
  text-transform: none;
}

.action-link em {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff7e5;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.detail-empty {
  padding: 12px;
  border: 1px dashed rgba(25, 35, 49, 0.16);
  border-radius: 16px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

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

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 14px rgba(196, 240, 106, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(196, 240, 106, 0);
  }
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .composer {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 20px, 720px);
    padding: 22px 0;
  }

  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(3.4rem, 18vw, 6.2rem);
  }

  .signal-card {
    border-radius: 26px;
  }

  .panel {
    min-height: auto;
    padding: 18px;
    border-radius: 24px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .address-row {
    grid-template-columns: 1fr;
  }

  .address-row select {
    width: 100%;
    border-left: 0;
    border-top: 1px solid rgba(25, 35, 49, 0.12);
    border-radius: 0 0 16px 16px;
  }
}
