:root {
  --bg: #070311;
  --bg-deep: #04020a;
  --panel: #12081f;
  --text: #f2e9ff;
  --dim: #9b8bb8;
  --pink: #ff5ec4;
  --pink-soft: #ff8fd8;
  --cyan: #22e4ff;
  --violet: #7a5cff;
  --lime: #a6ff5e;
  --danger: #ff5f7e;
  --line: rgba(255, 255, 255, 0.09);
  --radius: 18px;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  overflow-x: hidden;
}

/* ---------- background ---------- */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1000px 520px at 12% -8%, rgba(122, 92, 255, 0.28), transparent 70%),
    radial-gradient(900px 520px at 92% 4%, rgba(34, 228, 255, 0.16), transparent 68%),
    radial-gradient(1100px 700px at 50% 110%, rgba(255, 94, 196, 0.2), transparent 70%),
    var(--bg-deep);
}

/* gradient thay cho filter: blur() — không còn re-blur mỗi frame */
.blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  animation: drift 26s ease-in-out infinite;
}

.b1 {
  width: 74vw;
  height: 74vw;
  left: -22vw;
  top: -28vw;
  background: radial-gradient(circle, rgba(255, 47, 179, 0.4) 0%, rgba(255, 47, 179, 0.16) 34%, transparent 66%);
}

.b2 {
  width: 66vw;
  height: 66vw;
  right: -18vw;
  top: 0;
  background: radial-gradient(circle, rgba(35, 213, 255, 0.26) 0%, rgba(35, 213, 255, 0.1) 36%, transparent 66%);
  animation-delay: -9s;
}

.b3 {
  width: 72vw;
  height: 72vw;
  left: 24vw;
  bottom: -38vw;
  background: radial-gradient(circle, rgba(111, 60, 255, 0.32) 0%, rgba(111, 60, 255, 0.13) 36%, transparent 66%);
  animation-delay: -17s;
}

@keyframes drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(3vw, 2.5vh, 0);
  }
}

.grid-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.028) 0px,
    rgba(255, 255, 255, 0.028) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.7;
}

/* ---------- header ---------- */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 26px;
  background: linear-gradient(180deg, rgba(8, 3, 18, 0.96), rgba(8, 3, 18, 0.72));
  border-bottom: 1px solid rgba(255, 94, 196, 0.18);
  box-shadow: 0 12px 40px -22px rgba(255, 94, 196, 0.8);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 15px;
}

.brand-text {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 15px;
  letter-spacing: 0.16em;
}

.brand-text .bw,
.brand-text .bm {
  background-size: 320% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hueSlide 7s linear infinite;
}

.brand-text .bw {
  background-image: linear-gradient(
    92deg,
    #ffffff 0%,
    #ffd8f4 18%,
    #ff5ec4 36%,
    #ffd8f4 54%,
    #22e4ff 72%,
    #ffffff 100%
  );
  filter: drop-shadow(0 0 10px rgba(255, 94, 196, 0.85));
}

.brand-text .bm {
  background-image: linear-gradient(
    92deg,
    #22e4ff 0%,
    #b9f6ff 18%,
    #ffffff 36%,
    #ff8fd8 54%,
    #7a5cff 72%,
    #22e4ff 100%
  );
  animation-direction: reverse;
  animation-duration: 6s;
  filter: drop-shadow(0 0 10px rgba(34, 228, 255, 0.85));
}

@keyframes hueSlide {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 320% 50%;
  }
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan), 0 0 26px var(--cyan);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.7);
  }
}

.tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  border: 1px solid rgba(34, 228, 255, 0.4);
  border-radius: 6px;
  padding: 2px 6px;
  box-shadow: 0 0 14px rgba(34, 228, 255, 0.28) inset;
}

.domain {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--cyan);
  border: 1px solid rgba(34, 228, 255, 0.35);
  background: rgba(34, 228, 255, 0.07);
  border-radius: 999px;
  padding: 6px 14px;
  text-shadow: 0 0 12px rgba(34, 228, 255, 0.8);
  box-shadow: 0 0 22px -6px rgba(34, 228, 255, 0.7);
}

/* ---------- layout ---------- */
.wrap {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(24, 11, 42, 0.94), rgba(7, 3, 16, 0.96)) padding-box,
    linear-gradient(135deg, rgba(255, 94, 196, 0.7), rgba(34, 228, 255, 0.35) 48%, rgba(122, 92, 255, 0.65))
      border-box;
  padding: 20px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.02),
    0 26px 60px -34px rgba(255, 94, 196, 0.75),
    0 26px 60px -40px rgba(34, 228, 255, 0.6);
  overflow: hidden;
}

.card-glow {
  position: absolute;
  inset: -60% -20% auto -20%;
  height: 200px;
  background: radial-gradient(closest-side, rgba(255, 94, 196, 0.22), transparent);
  pointer-events: none;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding: 8px 6px 0;
  text-align: center;
}

/* quầng sáng tĩnh phía sau tiêu đề — vẽ 1 lần, không filter theo frame */
.hero::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -14px;
  width: min(720px, 92vw);
  height: 150px;
  transform: translateX(-50%);
  background:
    radial-gradient(46% 62% at 32% 50%, rgba(255, 94, 196, 0.36), transparent 72%),
    radial-gradient(46% 62% at 70% 50%, rgba(34, 228, 255, 0.3), transparent 72%);
  filter: blur(22px);
  pointer-events: none;
  z-index: 0;
}

.hero h1,
.hero .sub {
  position: relative;
  z-index: 1;
}

.hero h1 {
  margin: 0;
  display: inline-flex;
  gap: 0.18em;
  font-size: clamp(30px, 5vw, 50px);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.hero h1 .hw,
.hero h1 .hm {
  background-size: 320% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: hueSlide 8s linear infinite;
}

.hero h1 .hw {
  background-image: linear-gradient(
    92deg,
    #ffffff 0%,
    #ffd8f4 16%,
    #ff5ec4 32%,
    #ffd8f4 48%,
    #22e4ff 64%,
    #ffffff 82%,
    #ffffff 100%
  );
}

.hero h1 .hm {
  background-image: linear-gradient(
    92deg,
    #22e4ff 0%,
    #b9f6ff 16%,
    #ffffff 32%,
    #ff8fd8 48%,
    #7a5cff 64%,
    #22e4ff 82%,
    #22e4ff 100%
  );
  animation-direction: reverse;
  animation-duration: 6.5s;
}

.hero .sub {
  margin: 10px 0 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.hero .sub b {
  color: var(--cyan);
  font-weight: 600;
  text-shadow: 0 0 14px rgba(34, 228, 255, 0.8);
}

.lbl {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--pink-soft);
  margin-bottom: 12px;
  text-shadow: 0 0 16px rgba(255, 94, 196, 0.7);
}

.lbl.tiny {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--dim);
  text-shadow: none;
}

.addr-row {
  display: flex;
  gap: 10px;
}

.addr {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 19px;
  padding: 15px 16px;
  border-radius: 12px;
  border: 1px solid rgba(34, 228, 255, 0.35);
  background: rgba(4, 2, 10, 0.85);
  color: var(--cyan);
  letter-spacing: 0.03em;
  text-shadow: 0 0 18px rgba(34, 228, 255, 0.85);
  box-shadow:
    inset 0 0 26px rgba(34, 228, 255, 0.12),
    0 0 26px -10px rgba(34, 228, 255, 0.9);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gen-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.field {
  flex: 1;
  min-width: 200px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(122, 92, 255, 0.35);
  background: rgba(4, 2, 10, 0.8);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13.5px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field.narrow {
  flex: 0 0 180px;
  min-width: 150px;
}

.field:focus,
.addr:focus {
  outline: none;
  border-color: rgba(255, 94, 196, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 94, 196, 0.14), 0 0 28px -8px rgba(255, 94, 196, 0.9);
}

select.field {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--pink) 50%),
    linear-gradient(135deg, var(--pink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

/* ---------- buttons ---------- */
.btn {
  position: relative;
  padding: 12px 20px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 800;
  font-size: 13.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #12021c;
  background: linear-gradient(120deg, var(--pink) 0%, #ff9de0 40%, var(--cyan) 100%);
  clip-path: polygon(9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%, 0 9px);
  box-shadow: 0 0 26px -6px rgba(255, 94, 196, 0.9);
  transition: filter 0.16s ease, transform 0.06s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.12) saturate(1.1);
  box-shadow: 0 0 34px -4px rgba(34, 228, 255, 0.95);
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn.ghost {
  color: var(--cyan);
  background: rgba(34, 228, 255, 0.08);
  border: 1px solid rgba(34, 228, 255, 0.45);
  box-shadow: inset 0 0 22px rgba(34, 228, 255, 0.12), 0 0 20px -10px rgba(34, 228, 255, 0.9);
}

.btn.ghost:hover {
  background: rgba(34, 228, 255, 0.16);
}

.btn.danger {
  color: #ffd0d9;
  background: rgba(255, 95, 126, 0.12);
  border: 1px solid rgba(255, 95, 126, 0.5);
  box-shadow: inset 0 0 20px rgba(255, 95, 126, 0.12);
}

.btn.danger:hover {
  background: rgba(255, 95, 126, 0.22);
}

.btn.small {
  padding: 8px 14px;
  font-size: 11.5px;
  letter-spacing: 0.06em;
}

.link-btn {
  background: none;
  border: 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 0;
  text-transform: uppercase;
}

.link-btn:hover {
  color: var(--danger);
  text-shadow: 0 0 14px rgba(255, 95, 126, 0.9);
}

/* ---------- history ---------- */
.hint {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--dim);
}

.hint .sep {
  color: rgba(255, 94, 196, 0.55);
  font-style: normal;
  margin: 0 4px;
}

.hint span {
  color: var(--pink-soft);
  text-shadow: 0 0 12px rgba(255, 94, 196, 0.6);
}

.hist-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.hist-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(122, 92, 255, 0.35);
  background: linear-gradient(180deg, rgba(122, 92, 255, 0.12), rgba(122, 92, 255, 0.05));
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease, transform 0.12s ease;
}

.hist-toggle:hover {
  border-color: rgba(34, 228, 255, 0.65);
  box-shadow: 0 0 26px -10px rgba(34, 228, 255, 0.95);
}

.hist-toggle:active {
  transform: scale(0.995);
}

.hist-toggle[aria-expanded='true'] {
  border-color: rgba(255, 94, 196, 0.65);
  background: linear-gradient(180deg, rgba(255, 94, 196, 0.14), rgba(255, 94, 196, 0.04));
  box-shadow: 0 0 26px -10px rgba(255, 94, 196, 0.95);
}

.ht-left {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.ht-icon {
  display: inline-block;
  color: var(--cyan);
  font-size: 9px;
  text-shadow: 0 0 10px var(--cyan);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.hist-toggle[aria-expanded='true'] .ht-icon {
  transform: rotate(90deg);
  color: var(--pink);
  text-shadow: 0 0 10px var(--pink);
}

.ht-count {
  min-width: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 228, 255, 0.16);
  color: var(--cyan);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-align: center;
}

.hist-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.36s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.28s ease, margin-top 0.28s ease;
}

.hist-panel.open {
  max-height: 520px;
  opacity: 1;
  margin-top: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.history {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hist-empty {
  font-family: var(--mono);
  font-size: 11.5px;
  color: rgba(155, 139, 184, 0.7);
  padding: 14px 4px;
  text-align: center;
}

.hist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  animation: rowIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 26ms);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

.hist-row:hover {
  border-color: rgba(34, 228, 255, 0.5);
  background: rgba(34, 228, 255, 0.055);
  transform: translateX(2px);
}

.hist-row.current {
  border-color: rgba(255, 94, 196, 0.6);
  background: rgba(255, 94, 196, 0.09);
  box-shadow: 0 0 24px -14px rgba(255, 94, 196, 1);
}

.hr-addr {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #ecdcff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hist-row.current .hr-addr {
  color: #ffd6f3;
  text-shadow: 0 0 14px rgba(255, 94, 196, 0.7);
}

.hr-meta {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--dim);
  white-space: nowrap;
}

.hr-btn {
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid rgba(34, 228, 255, 0.35);
  background: rgba(34, 228, 255, 0.08);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.hr-btn:hover {
  background: rgba(34, 228, 255, 0.2);
  box-shadow: 0 0 18px -6px rgba(34, 228, 255, 1);
}

.hr-btn.del {
  border-color: rgba(255, 95, 126, 0.35);
  background: rgba(255, 95, 126, 0.08);
  color: var(--danger);
}

.hr-btn.del:hover {
  background: rgba(255, 95, 126, 0.22);
  box-shadow: 0 0 18px -6px rgba(255, 95, 126, 1);
}

@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}


/* ---------- grid + cards ---------- */
.grid {
  display: grid;
  grid-template-columns: 410px 1fr;
  gap: 20px;
  align-items: stretch;
  /* hai khung cùng một chiều cao, nội dung dài thì cuộn bên trong */
  --pane-h: clamp(380px, calc(100vh - 340px), 640px);
}

.grid > .card {
  display: flex;
  flex-direction: column;
  height: var(--pane-h);
  min-height: 0;
  overflow: hidden;
}

.grid > .card > .card-head,
.grid > .card > .msg-meta {
  flex: 0 0 auto;
}

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

  .grid > .card {
    height: auto;
    overflow: visible;
  }

  .inbox {
    max-height: 58vh;
  }

  .msg-body {
    max-height: 58vh;
    min-height: 240px;
  }
}

/* thanh cuộn mảnh cho hai khung, không choán chỗ hàng thư */
.inbox,
.msg-body {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 94, 196, 0.55) transparent;
}

.inbox::-webkit-scrollbar,
.msg-body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.inbox::-webkit-scrollbar-track,
.msg-body::-webkit-scrollbar-track {
  background: transparent;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--pink-soft);
  text-shadow: 0 0 18px rgba(255, 94, 196, 0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- inbox ---------- */
.inbox {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-right: 4px;
  /* chừa chỗ cho thanh cuộn để hàng không nhảy khi thư thứ n vượt khung */
  scrollbar-gutter: stable;
}

.inbox li {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 13px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(160deg, rgba(30, 14, 52, 0.7), rgba(8, 4, 18, 0.85));
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.12s ease, box-shadow 0.16s ease;
}

.inbox li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10%;
  height: 80%;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, transparent, rgba(122, 92, 255, 0.7), transparent);
}

.inbox li:hover {
  border-color: rgba(34, 228, 255, 0.55);
  transform: translateX(2px);
  box-shadow: 0 0 26px -12px rgba(34, 228, 255, 0.9);
}

.inbox li.active {
  border-color: rgba(255, 94, 196, 0.8);
  background: linear-gradient(160deg, rgba(60, 12, 52, 0.85), rgba(14, 4, 26, 0.9));
  box-shadow: 0 0 30px -12px rgba(255, 94, 196, 0.95);
}

.inbox li.active::before {
  background: linear-gradient(180deg, transparent, var(--pink), transparent);
  box-shadow: 0 0 12px var(--pink);
}

.inbox li.empty,
.msg-body .empty {
  cursor: default;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  padding: 34px 12px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 10px;
}

.m-avatar {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
  background:
    linear-gradient(150deg, hsl(var(--h, 300) 85% 62%), hsl(calc(var(--h, 300) + 42) 90% 48%));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 0 18px -8px hsl(var(--h, 300) 90% 60%);
}

.m-main {
  flex: 1 1 auto;
  min-width: 0;
}

.m-from {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-right: 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.m-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-time {
  font-weight: 400;
  color: var(--dim);
  font-size: 10.5px;
  font-family: var(--mono);
  flex-shrink: 0;
}

.m-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 10px var(--pink);
  animation: dotPulse 2.4s ease-in-out infinite;
}

@keyframes dotPulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.82);
  }
}

/* hàng chưa đọc: chữ sáng hơn, thời gian lùi sang trái nhường chỗ cho chấm */
.inbox li .m-name {
  padding-right: 12px;
}

/* ---------- empty state khung xem ---------- */
.viewer-empty {
  flex: 1 1 auto;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--dim);
}

.viewer-empty svg {
  width: 58px;
  height: 58px;
  color: rgba(255, 143, 216, 0.75);
  filter: drop-shadow(0 0 16px rgba(255, 94, 196, 0.55));
  animation: floaty 5.5s ease-in-out infinite;
}

.viewer-empty p {
  margin: 0;
  font-size: 13px;
  color: #e3d5ff;
  letter-spacing: 0.02em;
}

.viewer-empty span {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

/* ---------- đèn trạng thái ---------- */
.led {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
  background: var(--lime);
  box-shadow: 0 0 10px var(--lime);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.led.on {
  animation: ledPing 2.6s ease-in-out infinite;
}

.led.off {
  background: var(--danger);
  box-shadow: 0 0 10px var(--danger);
  animation: none;
}

@keyframes ledPing {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.m-sub {
  font-size: 13px;
  color: #e3d5ff;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-pre {
  font-size: 11.5px;
  color: var(--dim);
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-tag {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lime);
  border: 1px solid rgba(166, 255, 94, 0.4);
  background: rgba(166, 255, 94, 0.08);
  border-radius: 999px;
  padding: 3px 9px;
  box-shadow: 0 0 16px -6px rgba(166, 255, 94, 0.9);
}

/* ---------- message view ---------- */
.msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.msg-meta > div {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(160deg, rgba(40, 18, 66, 0.55), rgba(10, 5, 22, 0.7));
  font-family: var(--mono);
  font-size: 11px;
  color: #d9cbff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-meta b {
  flex-shrink: 0;
  color: var(--cyan);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 9.5px;
  opacity: 0.9;
}

.msg-meta > div:first-child {
  border-color: rgba(255, 94, 196, 0.35);
  background: linear-gradient(160deg, rgba(72, 14, 62, 0.5), rgba(16, 5, 24, 0.75));
}

/* tiêu đề thư: to hơn nhãn card, không viết hoa */
#subject {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.005em;
  text-transform: none;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 94, 196, 0.45);
}

.msg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-body iframe {
  flex: 0 0 auto;
  width: 100%;
  min-height: 300px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 0 30px -14px rgba(34, 228, 255, 0.9);
}

.msg-body pre {
  margin: 0;
  padding: 16px;
  background: rgba(4, 2, 10, 0.85);
  border: 1px solid rgba(34, 228, 255, 0.22);
  border-radius: 12px;
  color: #dcd2ff;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.att {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.att a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--lime);
  text-decoration: none;
  border: 1px solid rgba(166, 255, 94, 0.35);
  background: rgba(166, 255, 94, 0.07);
  border-radius: 8px;
  padding: 7px 11px;
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

.att a:hover {
  background: rgba(166, 255, 94, 0.16);
  box-shadow: 0 0 22px -8px rgba(166, 255, 94, 0.95);
}

/* ---------- footer / toast ---------- */
.foot {
  display: flex;
  justify-content: center;
  min-height: 24px;
}

.toast {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(34, 228, 255, 0.9);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.toast.show {
  opacity: 1;
}

/* ---------- mascot ---------- */
.mascot {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  width: 130px;
  height: 120px;
  pointer-events: none;
  will-change: transform;
  transform-origin: 50% 96%;
  contain: layout style;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 12px rgba(255, 94, 196, 0.55))
    drop-shadow(0 0 22px rgba(34, 228, 255, 0.32));
}

.mascot canvas {
  width: 130px;
  height: 120px;
  display: block;
  transform-origin: 50% 96%;
}

.spark {
  position: fixed;
  z-index: 39;
  width: 5px;
  height: 5px;
  background: var(--c, #22e4ff);
  box-shadow: 0 0 12px var(--c, #22e4ff);
  pointer-events: none;
  animation: sparkOut 0.78s ease-out forwards;
}

@keyframes sparkOut {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 0), 26px) scale(0.2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob,
  .dot {
    animation: none;
  }
}

/* ---------- animation layer ---------- */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.994);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes shineSweep {
  from {
    transform: translateX(-130%) skewX(-14deg);
  }
  to {
    transform: translateX(130%) skewX(-14deg);
  }
}

.card {
  animation: cardIn 0.52s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.hero {
  animation: cardIn 0.46s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.grid > .card:nth-child(1) {
  animation-delay: 0.08s;
}

.grid > .card:nth-child(2) {
  animation-delay: 0.16s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 34px 70px -34px rgba(255, 94, 196, 0.85),
    0 34px 70px -40px rgba(34, 228, 255, 0.75);
}

/* input không có pseudo-element -> giữ quầng tĩnh, bỏ animation box-shadow */
.addr {
  box-shadow:
    inset 0 0 30px rgba(34, 228, 255, 0.16),
    0 0 32px -8px rgba(34, 228, 255, 0.95);
}

.addr:focus {
  border-color: rgba(34, 228, 255, 0.75);
  box-shadow:
    inset 0 0 34px rgba(34, 228, 255, 0.24),
    0 0 40px -6px rgba(34, 228, 255, 1);
}

/* pulse bằng opacity trên pseudo -> chỉ tầng composite, không repaint box-shadow */
.domain {
  position: relative;
}

.domain::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 26px -4px rgba(34, 228, 255, 0.95);
  opacity: 0.35;
  animation: glowFade 4.8s ease-in-out infinite;
  pointer-events: none;
  will-change: opacity;
}

@keyframes glowFade {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.85;
  }
}

.inbox li {
  animation: rowIn 0.34s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 34ms);
}

.inbox li.static {
  animation: none;
}

.msg-body > * {
  animation: fadeUp 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.toast {
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.toast.show {
  transform: translateY(0);
}

.btn {
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: -20%;
  left: 0;
  width: 45%;
  height: 140%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  opacity: 0;
  pointer-events: none;
}

.btn:hover::after {
  opacity: 1;
  animation: shineSweep 0.72s ease;
}

.btn.ghost::after,
.btn.danger::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}

.field.narrow.ttl {
  flex: 0 0 122px;
  min-width: 108px;
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .hero,
  .inbox li,
  .msg-body > *,
  .hist-row,
  .domain::after,
  .brand-text .bw,
  .brand-text .bm,
  .hero h1 .hw,
  .hero h1 .hm,
  .blob,
  .dot {
    animation: none !important;
  }
  .btn:hover::after {
    animation: none;
  }
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 94, 196, 0.55), rgba(122, 92, 255, 0.55));
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--pink), var(--cyan));
}
