:root {
  --ink: #141925;
  --muted: #667085;
  --soft: #eef3f8;
  --paper: rgba(255, 255, 255, 0.84);
  --paper-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(23, 37, 84, 0.12);
  --blue: #2563eb;
  --cyan: #14b8a6;
  --rose: #f45b7a;
  --gold: #f5b942;
  --shadow: 0 24px 70px rgba(35, 48, 82, 0.18);
  --radius: 8px;
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 12%, rgba(20, 184, 166, 0.2), transparent 25rem),
    radial-gradient(circle at 86% 10%, rgba(244, 91, 122, 0.16), transparent 24rem),
    linear-gradient(135deg, #f8fbff 0%, #f2f6fb 42%, #eef5f2 100%);
  overflow-x: hidden;
}

button,
select,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.ambient-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.mesh {
  position: absolute;
  width: 36rem;
  height: 36rem;
  border-radius: 999px;
  filter: blur(44px);
  opacity: 0.6;
  animation: drift 16s ease-in-out infinite alternate;
}

.mesh-a {
  top: -16rem;
  left: -9rem;
  background: rgba(56, 189, 248, 0.5);
}

.mesh-b {
  top: 7rem;
  right: -14rem;
  background: rgba(245, 185, 66, 0.34);
  animation-delay: -5s;
}

.mesh-c {
  bottom: -18rem;
  left: 28%;
  background: rgba(244, 91, 122, 0.22);
  animation-delay: -9s;
}

.grid-glow {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(23, 37, 84, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 37, 84, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.62), transparent 80%);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 58px;
  padding: 8px clamp(18px, 4vw, 56px);
  color: white;
  background:
    linear-gradient(90deg, rgba(13, 18, 33, 0.9), rgba(30, 42, 70, 0.76)),
    rgba(16, 24, 40, 0.78);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: white;
  text-decoration: none;
  font-weight: 780;
  letter-spacing: 0;
}

.brand img {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
}

.brand span,
.nav-item span {
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(8px, 1.6vw, 18px);
  min-width: 0;
}

.nav-item {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 54px;
  min-height: 40px;
  padding: 2px 6px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  border-radius: 8px;
  transition:
    transform 180ms ease,
    color 180ms ease,
    background 180ms ease;
}

.nav-item svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 180ms ease;
}

.nav-item span {
  font-size: 12px;
  line-height: 1.1;
}

.nav-item::after {
  position: absolute;
  right: 12px;
  bottom: -3px;
  left: 12px;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, #67e8f9, #f9a8d4);
  border-radius: 999px;
  opacity: 0;
  transform: scaleX(0.45);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  transform: translateY(-4px);
}

.nav-item:hover svg,
.nav-item:focus-visible svg,
.nav-item.active svg {
  transform: translateY(-2px);
}

.nav-item.active::after,
.nav-item:hover::after,
.nav-item:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.avatar-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  width: 58px;
}

.avatar-button {
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.18);
  border: 2px solid rgba(255, 255, 255, 0.84);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease;
}

.avatar-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.avatar-wrap:hover .avatar-button,
.avatar-wrap:focus-within .avatar-button {
  transform: translateY(10px) scale(1.36);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.28);
}

.profile-card {
  position: absolute;
  top: 52px;
  right: 0;
  width: 230px;
  padding: 46px 18px 18px;
  color: var(--ink);
  text-align: center;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.profile-card img {
  position: absolute;
  top: -31px;
  left: 50%;
  width: 62px;
  height: 62px;
  object-fit: cover;
  border: 3px solid white;
  border-radius: 999px;
  transform: translateX(-50%);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.24);
}

.profile-card strong,
.profile-card span {
  display: block;
}

.profile-card strong {
  margin-bottom: 8px;
}

.profile-card span {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.profile-card button {
  width: 100%;
  min-height: 36px;
  color: white;
  cursor: pointer;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  border: 0;
  border-radius: 8px;
}

.avatar-wrap:hover .profile-card,
.avatar-wrap:focus-within .profile-card {
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0) scale(1);
}

.page-shell {
  width: min(1240px, calc(100vw - 36px));
  margin: 18px auto 56px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.service-banner,
.compact-page-banner,
.aside-card,
.tool-panel,
.placeholder-view > div {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.service-banner {
  min-height: 92px;
  padding: 16px 24px;
  margin-bottom: 16px;
}

.compact-page-banner {
  min-height: 92px;
  padding: 16px 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 5px;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.service-banner p:not(.eyebrow),
.aside-card p,
.tool-panel p,
.placeholder-view p {
  color: var(--muted);
  line-height: 1.65;
}

.service-banner p:not(.eyebrow) {
  margin-bottom: 0;
}

.compact-page-banner p:not(.eyebrow) {
  margin-bottom: 0;
}

.service-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.service-aside,
.tool-workspace {
  display: grid;
  gap: 16px;
}

.service-aside {
  position: sticky;
  top: 76px;
}

.aside-card,
.tool-panel {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.aside-card::before,
.tool-panel::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.08), transparent 38%),
    radial-gradient(circle at 100% 0, rgba(245, 185, 66, 0.15), transparent 38%);
  pointer-events: none;
}

.aside-card > *,
.tool-panel > * {
  position: relative;
}

.status-card {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.status-card strong,
.status-card span {
  display: block;
}

.status-card span:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  margin-top: 4px;
  background: #10b981;
  border-radius: 999px;
  box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.12);
}

.card-head,
.tool-panel-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.card-head {
  margin-bottom: 18px;
}

.compact-head {
  gap: 12px;
}

.tool-panel-head {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.service-icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  color: white;
  font-size: 12px;
  font-weight: 850;
  background: linear-gradient(135deg, #1d4ed8, #14b8a6);
  border-radius: 8px;
  box-shadow: 0 13px 28px rgba(29, 78, 216, 0.22);
}

.tool-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: #047857;
  font-size: 12px;
  font-weight: 760;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.18);
  border-radius: 999px;
}

.muted-badge {
  color: #475467;
  background: rgba(102, 112, 133, 0.12);
  border-color: rgba(102, 112, 133, 0.18);
}

.warn-badge {
  color: #92400e;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.24);
}

.download-box {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 14px;
  margin-bottom: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.download-box img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
}

.download-box strong,
.download-box span {
  display: block;
}

.download-box span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.quick-note ul {
  padding-left: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  color: white;
  text-decoration: none;
  cursor: pointer;
  border: 0;
  border-radius: 8px;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

.primary-button {
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.22);
}

.ghost-button {
  color: #1f2a44;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.full-button {
  width: 100%;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.2);
}

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

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 134px;
  padding: 18px;
  margin-bottom: 16px;
  text-align: center;
  cursor: pointer;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.5)),
    repeating-linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0 10px, transparent 10px 20px);
  border: 1.5px dashed rgba(37, 99, 235, 0.35);
  border-radius: 8px;
  transition:
    border 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.compact-drop-zone {
  min-height: 96px;
}

.drop-zone.dragging,
.drop-zone:hover {
  border-color: rgba(20, 184, 166, 0.82);
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-title {
  display: block;
  font-size: 17px;
  font-weight: 760;
}

.drop-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.translation-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label span,
.stack-field span {
  display: block;
  margin-bottom: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="range"],
textarea {
  width: 100%;
}

select,
textarea {
  color: #182235;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition:
    border 160ms ease,
    box-shadow 160ms ease;
}

select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 250px;
  padding: 13px;
  line-height: 1.55;
  resize: vertical;
}

select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11);
}

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

.tool-message {
  min-height: 24px;
  margin-bottom: 9px;
  color: #475467;
  font-size: 13px;
  line-height: 1.5;
}

.tool-message.error {
  color: #c2410c;
}

.tool-message.success {
  color: #047857;
}

.tts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
  gap: 16px;
  align-items: start;
}

.translation-card textarea {
  min-height: 170px;
}

.stack-field {
  display: block;
}

.tts-card textarea {
  min-height: 180px;
}

.tts-controls {
  display: grid;
  gap: 14px;
}

.fine-print {
  margin: 0;
  color: #667085;
  font-size: 12px;
  line-height: 1.65;
}

.placeholder-view {
  min-height: auto;
}

.placeholder-view > div {
  padding: 16px 24px;
}

.toast-layer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: grid;
  gap: 10px;
}

.toast {
  width: min(360px, calc(100vw - 40px));
  padding: 13px 15px;
  color: white;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 20px 55px rgba(15, 23, 42, 0.25);
  animation: toast-in 220ms ease both;
  backdrop-filter: blur(16px);
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(5rem, 3rem, 0) scale(1.08);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .service-aside {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .control-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .site-header {
    align-items: flex-start;
    padding: 8px 12px;
  }

  .brand span {
    display: none;
  }

  .nav-actions {
    gap: 4px;
    width: 100%;
  }

  .nav-item {
    min-width: 44px;
    padding-inline: 4px;
  }

  .nav-item span {
    font-size: 11px;
  }

  .avatar-wrap {
    width: 44px;
  }

  .profile-card {
    right: -2px;
  }

  .tts-layout {
    grid-template-columns: 1fr;
  }

  .service-aside {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100vw - 24px, 1240px);
    margin-top: 18px;
  }

  .site-header {
    gap: 9px;
  }

  .nav-actions {
    overflow-x: auto;
    padding-bottom: 2px;
  }

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

  .service-banner,
  .compact-page-banner,
  .aside-card,
  .tool-panel {
    padding: 16px;
  }

  .tool-panel-head {
    display: grid;
  }

  h1 {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
