:root {
  color-scheme: light;
  --bg: #4c2618;
  --ink: #26160e;
  --muted: #6c5a4c;
  --panel: rgba(245, 228, 202, 0.9);
  --line: rgba(63, 31, 18, 0.2);
  --accent: #9d4321;
  --accent-strong: #6d280f;
  --accent-soft: rgba(157, 67, 33, 0.16);
  --push-bright: #ef4336;
  --push-dark: #8d170f;
  --shadow: 0 20px 40px rgba(22, 10, 6, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Baskerville, Georgia, "Palatino Linotype", serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 214, 170, 0.08), transparent 18%),
    radial-gradient(circle at 80% 18%, rgba(255, 209, 159, 0.06), transparent 22%),
    repeating-linear-gradient(
      96deg,
      #5f2f1d 0,
      #5f2f1d 28px,
      #552818 28px,
      #552818 58px,
      #6a3621 58px,
      #6a3621 92px,
      #4a2416 92px,
      #4a2416 126px
    );
  color: var(--ink);
}

.shell {
  width: min(1100px, calc(100% - 32px));
  margin: 32px auto;
  display: grid;
  gap: 18px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  display: grid;
  gap: 18px;
  grid-template-columns: 1.7fr 1fr;
  align-items: start;
  position: relative;
  overflow: hidden;
}

.hero::before,
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.25), rgba(255, 248, 236, 0)),
    repeating-linear-gradient(
      0deg,
      rgba(124, 86, 54, 0.045),
      rgba(124, 86, 54, 0.045) 2px,
      rgba(255, 255, 255, 0) 2px,
      rgba(255, 255, 255, 0) 6px
    );
}

.eyebrow {
  margin: 0 0 10px;
  color: #7c3214;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
  font-weight: 700;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  max-width: 10ch;
}

h2 {
  font-size: clamp(1.5rem, 2.2vw, 2.3rem);
}

.lede,
.message-meta,
.error,
#statusText,
.empty-panel p,
.auth-status {
  color: var(--muted);
}

.lede {
  margin: 14px 0 0;
  max-width: 44ch;
  font-size: 1.05rem;
  line-height: 1.55;
}

.hero-stats {
  display: grid;
  gap: 12px;
}

.stat-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 248, 236, 0.58);
  border: 1px solid rgba(63, 31, 18, 0.08);
}

.stat-label,
label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-card strong {
  font-size: 2.1rem;
}

.panel {
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.controls,
.access-form,
.reply-box {
  display: grid;
  gap: 16px;
}

.access-panel {
  display: grid;
  gap: 18px;
  grid-template-columns: 1.25fr 1fr;
  align-items: end;
}

.access-copy {
  margin-top: 14px;
}

.auth-row {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.auth-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.auth-status {
  margin: 0;
}

.folder-launch {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px;
  gap: 18px;
  align-items: end;
}

.folder-field {
  min-width: 0;
}

.action-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

select,
button,
input,
textarea {
  border-radius: 14px;
  border: 1px solid rgba(23, 33, 43, 0.14);
  font: inherit;
}

select,
input,
textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 251, 245, 0.88);
  color: var(--ink);
}

button {
  padding: 12px 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(180deg, #ab5630 0%, var(--accent-strong) 100%);
  cursor: pointer;
}

button:hover:not(:disabled) {
  filter: brightness(1.03);
}

.secondary-button {
  color: var(--accent-strong);
  background: rgba(255, 248, 236, 0.68);
  border-color: rgba(63, 31, 18, 0.12);
}

.push-button {
  width: 160px;
  height: 160px;
  padding: 0;
  border: 0;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 232, 228, 0.34), transparent 18%),
    linear-gradient(180deg, var(--push-bright) 0%, var(--push-dark) 100%);
  display: grid;
  place-items: center;
  border-radius: 999px;
  position: relative;
  box-shadow:
    inset 0 -10px 16px rgba(0, 0, 0, 0.18),
    inset 0 10px 14px rgba(255, 255, 255, 0.18),
    0 14px 30px rgba(24, 8, 5, 0.3);
}

.push-label {
  color: #fff7f5;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-shadow: 0 2px 10px rgba(54, 8, 4, 0.45);
}

.push-button:hover:not(:disabled) {
  filter: brightness(1.05);
}

.push-button:active:not(:disabled) {
  transform: translateY(2px);
}

button:disabled,
select:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.progress-wrap {
  display: grid;
  gap: 8px;
}

.progress-bar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(23, 33, 43, 0.08);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #d9a441 0%, var(--accent) 80%);
  transition: width 180ms ease-out;
}

.message-panel {
  display: grid;
  gap: 18px;
  overflow: visible;
}

.message-panel::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 18%;
  height: 36%;
  pointer-events: none;
  opacity: 0;
  z-index: 4;
  background:
    radial-gradient(circle at 26% 76%, rgba(76, 76, 76, 0.58), transparent 24%),
    radial-gradient(circle at 50% 58%, rgba(94, 94, 94, 0.5), transparent 24%),
    radial-gradient(circle at 74% 74%, rgba(110, 110, 110, 0.38), transparent 18%);
  filter: blur(22px);
}

.message-panel.smoke-out .message-body,
.message-panel.smoke-out .message-frame-wrap,
.message-panel.smoke-out .message-header,
.message-panel.smoke-out .actions {
  animation: ashFade 520ms ease-out forwards;
}

.message-panel.smoke-out::after {
  animation: smokeRise 520ms ease-out forwards;
}

.message-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.message-meta {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.queue-chip {
  align-self: start;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-weight: 700;
  color: var(--accent-strong);
}

.message-body {
  padding: 20px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 251, 245, 0.9), rgba(244, 233, 213, 0.92));
  border: 1px solid rgba(63, 31, 18, 0.08);
  white-space: pre-wrap;
  line-height: 1.55;
  min-height: 440px;
  max-height: 72vh;
  overflow: auto;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  position: relative;
  z-index: 1;
}

.message-frame-wrap {
  border-radius: 18px;
  border: 1px solid rgba(63, 31, 18, 0.08);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.9), rgba(244, 233, 213, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  overflow: hidden;
  min-height: 440px;
  position: relative;
  z-index: 1;
}

.message-frame {
  display: block;
  width: 100%;
  min-height: 440px;
  height: 72vh;
  border: 0;
  background: #fffdf9;
}

.message-body a {
  color: #8b2f12;
  font-weight: 700;
  text-decoration-thickness: 2px;
}

.message-body a:hover {
  color: #b13a13;
}

.asset-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.inline-image-card,
.attachment-card {
  border-radius: 16px;
  border: 1px solid rgba(63, 31, 18, 0.1);
  background: rgba(255, 249, 239, 0.88);
  box-shadow: 0 10px 22px rgba(46, 21, 12, 0.08);
}

.inline-image-card {
  margin: 0;
  padding: 10px;
  width: min(100%, 240px);
}

.inline-image-card img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(137, 111, 80, 0.08);
}

.inline-image-card figcaption {
  margin-top: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}

.attachment-card {
  display: grid;
  gap: 4px;
  min-width: 180px;
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
}

.attachment-card span {
  font-size: 0.84rem;
  color: var(--muted);
}

.empty-panel {
  text-align: center;
}

.error {
  margin: 0;
  font-weight: 700;
}

@keyframes ashFade {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: saturate(1);
  }
  40% {
    opacity: 0.75;
    filter: saturate(0.6);
  }
  100% {
    opacity: 0;
    transform: translateY(-18px) scale(0.985);
    filter: saturate(0.2) blur(2px);
  }
}

@keyframes smokeRise {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.85);
  }
  30% {
    opacity: 0.88;
  }
  100% {
    opacity: 0;
    transform: translateY(-110px) scale(1.8);
  }
}

@media (max-width: 840px) {
  .hero,
  .access-panel,
  .folder-launch {
    grid-template-columns: 1fr;
  }

  .message-header {
    flex-direction: column;
  }

  .push-button {
    width: 140px;
    height: 140px;
    justify-self: start;
  }

  .push-label {
    font-size: 1.35rem;
  }
}
