:root {
  --ink: #173349;
  --ink-soft: #42677f;
  --muted: #7392a5;
  --blue: #2a8bd8;
  --blue-deep: #1671bc;
  --blue-soft: #dff3ff;
  --glass: rgba(246, 252, 255, 0.67);
  --glass-strong: rgba(250, 253, 255, 0.84);
  --line: rgba(87, 149, 184, 0.23);
  --danger: #c95e6b;
  --ok: #249870;
  --radius: 22px;
  --shadow: 0 24px 70px rgba(45, 102, 137, 0.18);
  --shadow-soft: 0 10px 30px rgba(45, 102, 137, 0.12);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "DM Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--sans);
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(202, 235, 249, 0.34), rgba(214, 239, 250, 0.08) 48%, rgba(93, 178, 223, 0.08)),
    url("/naruto-sky-clean.png") 55% center / cover no-repeat fixed,
    #9ed9f3;
}

button,
input {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(42, 139, 216, 0.3);
  outline-offset: 2px;
}

a {
  color: var(--blue-deep);
}

.sky,
.sky::before,
.sky::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.sky {
  z-index: -1;
  overflow: hidden;
}

.sky::before {
  content: "";
  background:
    radial-gradient(ellipse at 8% 18%, rgba(255, 255, 255, 0.46) 0 5%, transparent 17%),
    radial-gradient(ellipse at 48% 2%, rgba(255, 255, 255, 0.32) 0 7%, transparent 22%);
  filter: blur(18px);
}

.sky::after {
  content: "";
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(41, 129, 181, 0.08)),
    radial-gradient(circle at 70% 50%, transparent 0 25%, rgba(45, 119, 162, 0.1) 70%);
}

.cloud {
  position: absolute;
  display: block;
  width: 360px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  filter: blur(18px);
  animation: float-cloud 18s ease-in-out infinite alternate;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 170px;
  height: 170px;
  left: 60px;
  bottom: 0;
}

.cloud::after {
  width: 210px;
  height: 145px;
  right: 25px;
  bottom: -8px;
}

.cloud-one { left: 22%; top: 12%; opacity: 0.3; }
.cloud-two { right: -5%; top: 58%; animation-delay: -6s; opacity: 0.24; }
.cloud-three { left: 44%; bottom: -5%; animation-delay: -11s; opacity: 0.22; }

.glow {
  position: absolute;
  width: 420px;
  height: 420px;
  right: 11%;
  top: 8%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  filter: blur(70px);
}

@keyframes float-cloud {
  to { transform: translate3d(28px, -10px, 0) scale(1.06); }
}

.app {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: calc(100vh - 32px);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 32px);
  padding: 24px 18px 18px;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(225, 244, 253, 0.58);
  backdrop-filter: blur(28px) saturate(125%);
  box-shadow: 8px 0 40px rgba(69, 129, 164, 0.1);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 5px;
}

.logo {
  position: relative;
  width: 45px;
  height: 45px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 15px;
  background: linear-gradient(145deg, #50a9e6, #1c80cc);
  box-shadow: 0 10px 24px rgba(32, 132, 201, 0.28), inset 0 1px rgba(255, 255, 255, 0.5);
}

.logo::before {
  content: "";
  position: absolute;
  inset: 13px 10px 12px;
  border: 2px solid white;
  border-radius: 4px;
}

.logo span {
  position: absolute;
  width: 17px;
  height: 17px;
  left: 14px;
  top: 11px;
  border-right: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(45deg);
}

.brand h1 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.tag {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #36b987;
  box-shadow: 0 0 0 4px rgba(54, 185, 135, 0.12);
}

.create-card,
.sidebar-note,
.topbar,
.msg-list,
.msg-view {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(125%);
  box-shadow: var(--shadow-soft);
}

.create-card {
  display: grid;
  gap: 11px;
  padding: 16px;
  border-radius: var(--radius);
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.card-heading h2 {
  margin: 1px 0 0;
  font-size: 1rem;
}

.eyebrow {
  color: var(--blue-deep);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.spark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.66);
}

.create-card label {
  display: grid;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  outline: none;
  transition: 0.18s ease;
}

input::placeholder {
  color: #93acba;
}

input:focus {
  border-color: rgba(42, 139, 216, 0.65);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 4px rgba(42, 139, 216, 0.1);
}

.btn {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.58);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(47, 107, 143, 0.12);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  display: flex;
  justify-content: center;
  gap: 6px;
  border-color: transparent;
  color: white;
  background: linear-gradient(145deg, #39a0e6, #197ec9);
  box-shadow: 0 10px 22px rgba(33, 133, 201, 0.24);
}

.btn.primary:hover {
  background: linear-gradient(145deg, #48aae9, #238bd5);
}

.btn.danger {
  border-color: rgba(201, 94, 107, 0.25);
  color: #a84451;
  background: rgba(255, 235, 238, 0.68);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.4);
}

.btn.sm {
  padding: 5px 9px;
  font-size: 0.7rem;
  font-weight: 600;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.45;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  color: var(--ink-soft);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
}

.check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check-ui {
  position: relative;
  width: 28px;
  height: 16px;
  border-radius: 999px;
  background: rgba(77, 131, 160, 0.24);
  transition: 0.2s ease;
}

.check-ui::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 6px rgba(42, 80, 101, 0.25);
  transition: 0.2s ease;
}

.check input:checked + .check-ui {
  background: var(--blue);
}

.check input:checked + .check-ui::after {
  transform: translateX(12px);
}

.mailbox-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding-right: 3px;
  overflow: auto;
}

.mailbox-list::-webkit-scrollbar,
.msg-list::-webkit-scrollbar,
.msg-view::-webkit-scrollbar {
  width: 5px;
}

.mailbox-list::-webkit-scrollbar-thumb,
.msg-list::-webkit-scrollbar-thumb,
.msg-view::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: rgba(58, 126, 165, 0.24);
}

.mailbox-item {
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.36);
  cursor: pointer;
  transition: 0.16s ease;
}

.mailbox-item:hover {
  border-color: rgba(71, 151, 198, 0.4);
  background: rgba(255, 255, 255, 0.58);
}

.mailbox-item.active {
  border-color: rgba(42, 139, 216, 0.55);
  background: rgba(244, 251, 255, 0.84);
  box-shadow: 0 8px 22px rgba(42, 124, 174, 0.13), inset 3px 0 var(--blue);
}

.mailbox-item.disabled {
  opacity: 0.55;
}

.mailbox-item .addr {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailbox-item .sub {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.65rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border: 1px solid rgba(73, 137, 174, 0.12);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.62rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.on {
  border-color: rgba(36, 152, 112, 0.16);
  color: var(--ok);
  background: rgba(225, 250, 241, 0.64);
}

.badge.off {
  border-color: rgba(201, 94, 107, 0.14);
  color: #bd5360;
  background: rgba(255, 235, 238, 0.58);
}

.badge.days {
  color: var(--blue-deep);
  background: rgba(220, 243, 255, 0.74);
}

.badge.warn {
  color: #a87319;
  background: rgba(255, 245, 213, 0.72);
}

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 15px;
  color: var(--blue-deep);
}

.sidebar-note > span {
  font-size: 1.1rem;
}

.sidebar-note p {
  display: grid;
  gap: 1px;
  margin: 0;
  color: var(--muted);
  font-size: 0.62rem;
}

.sidebar-note strong {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: calc(100vh - 32px);
  padding: 22px 24px 18px;
  gap: 14px;
}

.topbar {
  min-height: 104px;
  padding: 20px 22px;
  border-radius: 24px;
}

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

.address-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.address-row code,
.meta-row code {
  padding: 5px 8px;
  border: 1px solid rgba(85, 145, 179, 0.18);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.86rem;
  background: rgba(255, 255, 255, 0.52);
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.meta-row .sep {
  opacity: 0.4;
}

.muted-inline {
  color: var(--muted);
  font-size: 0.7rem;
}

.actions {
  display: flex;
  gap: 8px;
}

.empty-state {
  position: relative;
  min-height: calc(100vh - 32px - 44px - 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(30px, 6vw, 90px);
  overflow: hidden;
}

.empty-state h2 {
  position: relative;
  z-index: 2;
  max-width: 680px;
  margin: 10px 0 18px;
  font-size: clamp(2.6rem, 5.3vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: -0.065em;
}

.empty-state h2 em {
  color: var(--blue);
  font-family: Georgia, serif;
  font-weight: 400;
}

.empty-state p {
  position: relative;
  z-index: 2;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.7;
}

.inbox {
  flex: 1;
  min-height: 0;
}

.split {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100%;
  min-height: 0;
  gap: 14px;
}

.msg-list,
.msg-view {
  overflow: auto;
  border-radius: 22px;
}

.msg-item {
  width: 100%;
  padding: 15px 16px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid rgba(91, 147, 178, 0.14);
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.msg-item:hover {
  background: rgba(255, 255, 255, 0.34);
}

.msg-item.active {
  background: rgba(222, 244, 255, 0.72);
  box-shadow: inset 3px 0 var(--blue);
}

.msg-item.unread .subj {
  font-weight: 700;
}

.msg-item .from {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.7rem;
}

.msg-item .subj {
  font-size: 0.87rem;
}

.msg-item .intro {
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-view {
  padding: 24px 26px 40px;
}

.msg-view h3 {
  margin: 0 0 8px;
  font-size: 1.3rem;
  letter-spacing: -0.025em;
}

.msg-view .meta {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.msg-body {
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.6;
}

.msg-body.html {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 16px;
  color: #172b38;
  background: rgba(255, 255, 255, 0.84);
  white-space: normal;
}

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

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 48px;
  padding: 10px 17px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(245, 252, 255, 0.84);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
}

.footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  color: rgba(51, 96, 120, 0.72);
  background: rgba(222, 243, 252, 0.58);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 0.66rem;
}

.footer > span {
  font-weight: 700;
}

.footer i {
  width: 3px;
  height: 3px;
  margin: 0 3px;
  border-radius: 50%;
  background: currentColor;
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

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

  .sidebar,
  .main {
    max-height: none;
  }

  .sidebar {
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.62);
  }

  .mailbox-list {
    max-height: 300px;
  }

  .main {
    min-height: 70vh;
    padding: 14px;
    padding-bottom: 48px;
  }

  .empty-state {
    min-height: 55vh;
    padding: 36px 22px 190px;
  }

  .empty-state h2 {
    font-size: clamp(2.6rem, 12vw, 4rem);
  }

  .split {
    grid-template-columns: 1fr;
    height: auto;
  }

  .msg-list {
    max-height: 290px;
  }

  .msg-view {
    min-height: 360px;
  }
}

@media (max-width: 560px) {
  .sidebar {
    padding: 18px 12px;
  }

  .topbar {
    padding: 16px;
  }

  .box-header,
  .actions {
    width: 100%;
  }

  .actions .btn {
    flex: 1;
  }

  .meta-row .sep {
    display: none;
  }

  .empty-state p br {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cloud,
  .btn {
    animation: none;
    transition: none;
  }
}
