:root {
  --bg-top: #d9ebff;
  --bg-bottom: #bfdcff;
  --panel: rgba(255, 255, 255, 0.56);
  --panel-strong: rgba(255, 255, 255, 0.7);
  --line: rgba(33, 69, 122, 0.12);
  --text: #15345d;
  --muted: #53739c;
  --red: #2563eb;
  --red-deep: #1d4ed8;
  --green: #38bdf8;
  --green-deep: #0ea5e9;
  --gold: #bfdbfe;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

body[data-theme="blue"] {
  --bg-top: #d9ebff;
  --bg-bottom: #bfdcff;
  --panel: rgba(255, 255, 255, 0.56);
  --panel-strong: rgba(255, 255, 255, 0.7);
  --line: rgba(33, 69, 122, 0.12);
  --text: #15345d;
  --muted: #53739c;
  --red: #2563eb;
  --red-deep: #1d4ed8;
  --green: #38bdf8;
  --green-deep: #0ea5e9;
  --gold: #bfdbfe;
}

body[data-theme="mint"] {
  --bg-top: #e2fff3;
  --bg-bottom: #c6f6e6;
  --panel: rgba(255, 255, 255, 0.6);
  --panel-strong: rgba(255, 255, 255, 0.74);
  --line: rgba(20, 83, 45, 0.12);
  --text: #134e4a;
  --muted: #4b7d76;
  --red: #0f766e;
  --red-deep: #115e59;
  --green: #22c55e;
  --green-deep: #15803d;
  --gold: #bbf7d0;
}

body[data-theme="berry"] {
  --bg-top: #ffe3ec;
  --bg-bottom: #ffd0dc;
  --panel: rgba(255, 255, 255, 0.62);
  --panel-strong: rgba(255, 255, 255, 0.78);
  --line: rgba(157, 23, 77, 0.12);
  --text: #6b2141;
  --muted: #9b4d70;
  --red: #db2777;
  --red-deep: #be185d;
  --green: #f472b6;
  --green-deep: #db2777;
  --gold: #fbcfe8;
}

body[data-theme="twilight"] {
  --bg-top: #eef2ff;
  --bg-bottom: #dbe7ff;
  --panel: rgba(255, 255, 255, 0.58);
  --panel-strong: rgba(255, 255, 255, 0.76);
  --line: rgba(67, 56, 202, 0.12);
  --text: #2e3a8c;
  --muted: #5d69b8;
  --red: #4f46e5;
  --red-deep: #4338ca;
  --green: #818cf8;
  --green-deep: #6366f1;
  --gold: #c7d2fe;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.55), transparent 24%),
    radial-gradient(circle at 20% 18%, rgba(125, 211, 252, 0.2), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  font-family: "Georgia", "Times New Roman", "Microsoft YaHei", serif;
  overflow-x: hidden;
  position: relative;
}

.snow,
.snow::before,
.snow::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.96) 0 2.2px, transparent 3.2px),
    radial-gradient(circle, rgba(219, 234, 254, 0.82) 0 1.7px, transparent 2.7px),
    radial-gradient(circle, rgba(191, 219, 254, 0.55) 0 1.2px, transparent 2.2px);
  background-size: 200px 200px, 150px 150px, 96px 96px;
  animation: snow 20s linear infinite;
  z-index: 0;
}

.snow-a {
  opacity: 0.46;
}

.snow-b,
.snow-b::before,
.snow-b::after {
  animation-duration: 28s;
  opacity: 0.3;
}

.snow::before {
  transform: translateY(-35%);
}

.snow::after {
  transform: translateY(-70%);
}

.lights {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  justify-content: space-around;
  padding: 14px 18px 0;
  pointer-events: none;
}

.bulb {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: 0 0 18px currentColor;
}

.bulb::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 50%;
  width: 2px;
  height: 16px;
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-50%);
}

.bulb.red { color: #ef4444; background: #ef4444; }
.bulb.gold { color: #93c5fd; background: #93c5fd; }
.bulb.green { color: #38bdf8; background: #38bdf8; }
.bulb.white { color: #f8fafc; background: #f8fafc; }

.shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 72px 0 42px;
}

.hero-card,
.summary-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(234, 245, 255, 0.6));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-card {
  padding: 28px;
}

.hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.hero-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow {
  margin: 0;
  color: #3b82f6;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-size: clamp(2.8rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.ornament-group {
  display: flex;
  gap: 10px;
  padding-top: 8px;
}

.ornament {
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.12);
}

.ornament::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 2px;
  height: 10px;
  background: rgba(255, 255, 255, 0.28);
  transform: translateX(-50%);
}

.ornament.red { background: radial-gradient(circle at 35% 30%, #fecaca, var(--red)); }
.ornament.gold { background: radial-gradient(circle at 35% 30%, #eff6ff, var(--gold)); }
.ornament.green { background: radial-gradient(circle at 35% 30%, #e0f2fe, var(--green)); }

label {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 190px;
  padding: 18px;
  border: 1px solid rgba(59, 130, 246, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  font: inherit;
  line-height: 1.7;
  resize: vertical;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

textarea::placeholder {
  color: rgba(83, 115, 156, 0.6);
}

textarea:focus {
  outline: none;
  border-color: rgba(125, 211, 252, 0.45);
  box-shadow: 0 0 0 5px rgba(96, 165, 250, 0.12);
  transform: translateY(-1px);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  box-shadow: 0 14px 28px rgba(29, 78, 216, 0.28);
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.theme-toggle {
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(229, 240, 255, 0.88));
  color: var(--text);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.16);
}

.theme-toggle:hover {
  box-shadow: 0 14px 24px rgba(37, 99, 235, 0.2);
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
  box-shadow: none;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.fatal {
  min-height: 20px;
  margin-top: 14px;
  color: #1d4ed8;
  font-size: 14px;
  line-height: 1.6;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.summary-card {
  padding: 18px 20px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.boxes,
.side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.boxes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

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

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 1.18rem;
}

.panel-head span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(147, 197, 253, 0.14);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 700;
}

.mail-list,
.errors {
  margin: 0;
  padding-left: 0;
}

.mail-item {
  list-style: none;
  margin-bottom: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(59, 130, 246, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.mail-item p {
  margin: 0 0 8px;
  line-height: 1.7;
  word-break: break-word;
}

.mail-item p:last-child {
  margin-bottom: 0;
}

.mail-item span {
  display: inline-flex;
  min-width: 74px;
  margin-right: 10px;
  color: #bfdbfe;
  font-weight: 700;
}

.empty p {
  margin-top: 10px;
  color: var(--muted);
}

.boxes .empty {
  grid-column: 1 / -1;
}

.empty-row {
  color: var(--muted);
}

.errors li {
  list-style: none;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(59, 130, 246, 0.1);
  color: #1e40af;
  line-height: 1.65;
}

.hidden {
  display: none;
}

@keyframes snow {
  from {
    transform: translate3d(0, -100%, 0);
  }
  to {
    transform: translate3d(24px, 100%, 0);
  }
}

@media (max-width: 960px) {
  .summary-strip {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .shell {
    width: min(100% - 18px, 100%);
    padding-top: 64px;
  }

  .hero-card,
  .summary-card,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .hero-top {
    flex-direction: column;
  }

  .hero-tools {
    width: 100%;
    justify-content: space-between;
  }

  h1 {
    font-size: 2.7rem;
  }

  .mail-item span {
    display: block;
    margin-bottom: 4px;
  }
}
