:root {
  --bg: #13151b;
  --bg-elevated: #1a1d26;
  --surface: #1f2430;
  --surface-raised: #262c3a;
  --surface-inset: #171a22;
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(232, 168, 124, 0.28);
  --border-cool: rgba(126, 184, 218, 0.25);
  --text: #eceae6;
  --text-soft: #c5c2ba;
  --muted: #848994;
  --warm: #e8a87c;
  --warm-light: #f5d4b8;
  --warm-dim: rgba(232, 168, 124, 0.16);
  --cool: #7eb8da;
  --cool-light: #b8d8ef;
  --cool-dim: rgba(126, 184, 218, 0.14);
  --accent: var(--warm);
  --gold: #e8c98a;
  --gold-light: #f5e6c4;
  --gold-dim: rgba(232, 201, 138, 0.12);
  --error: #e09a90;
  --shadow-panel: 0 20px 44px rgba(0, 0, 0, 0.32), 0 0 0 1px var(--border);
  --shadow-soft: 0 8px 28px rgba(0, 0, 0, 0.26);
  --radius: 14px;
  --radius-sm: 10px;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", "Segoe UI", sans-serif;
  --font-display: "Noto Sans SC", "PingFang SC", "Microsoft YaHei UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 55% 40% at 8% 0%, var(--warm-dim), transparent 58%),
    radial-gradient(ellipse 45% 35% at 92% 8%, var(--cool-dim), transparent 55%),
    radial-gradient(ellipse 70% 45% at 50% 100%, rgba(0, 0, 0, 0.4), transparent);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.15rem 1.5rem 2.5rem;
}

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  margin-top: 1.5rem;
  padding: 1rem 1rem 0.25rem;
  border-top: 1px solid var(--border);
}

.site-footer-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.site-footer-link {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--warm-light);
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer-link:hover {
  color: var(--warm);
}

.site-footer-tagline {
  margin: 0;
  font-size: 0.58rem;
  font-weight: 400;
  color: var(--cool-light);
  letter-spacing: 0.12em;
  opacity: 0.85;
}

.site-footer-feedback {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.38rem 0.85rem;
  font-size: 0.62rem;
  line-height: 1.4;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.03);
}

.site-footer-label {
  color: var(--muted);
  letter-spacing: 0.04em;
}

.site-footer-feedback a {
  color: var(--warm-light);
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer-feedback a:hover {
  color: var(--warm);
}

/* —— 顶栏 —— */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, transparent 100%);
}

.header {
  margin: 0;
  flex: 0 1 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-soft);
  background: #1a1f28;
  padding: 0;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.brand:hover .brand-mark {
  transform: translateY(-1px) rotate(-1deg);
  box-shadow: 0 10px 28px var(--warm-dim);
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-title {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}

.brand-accent {
  color: var(--warm);
}

.brand-name {
  color: var(--text);
}

.brand-sep {
  margin: 0 0.15em;
  font-size: 0.9em;
  font-weight: 400;
  line-height: 1;
  color: var(--text-soft);
}

.brand-slogan {
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1;
  color: var(--warm-light);
  letter-spacing: 0.05em;
  opacity: 0.92;
}

.brand-domain {
  color: var(--cool);
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* —— Toolbar —— */
.toolbar-card {
  margin: 0;
  padding: 0;
  flex: 1 1 320px;
  background: transparent;
  border: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem 1rem;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.65rem 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}

.field-label-row {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
  min-height: 0.85rem;
}

.field-label {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.detected-lang {
  font-size: 0.58rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
  opacity: 0.72;
}

.detected-lang:not([hidden])::before {
  content: "·";
  margin-right: 0.15rem;
  opacity: 0.45;
}

.select {
  min-width: 132px;
  padding: 0.45rem 1.9rem 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-inset)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23848994' d='M2.5 3.75L5 6.25L7.5 3.75'/%3E%3C/svg%3E")
    no-repeat right 0.75rem center;
  color: var(--text-soft);
  font-size: 0.875rem;
  font-family: inherit;
  appearance: none;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.select:hover {
  border-color: var(--border-accent);
  color: var(--text);
}

.select:focus {
  outline: none;
  border-color: var(--warm);
  box-shadow: 0 0 0 3px var(--warm-dim);
}

.swap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-bottom: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--cool);
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.15s,
    color 0.2s;
}

.swap-btn:hover {
  background: var(--cool-dim);
  border-color: var(--border-cool);
  color: var(--cool-light);
}

.swap-btn:active {
  transform: scale(0.94) rotate(180deg);
}

/* —— Workspace —— */
.workspace {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
}

.workspace > .panel {
  height: min(420px, calc(100vh - 220px));
}

.workspace-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  align-self: center;
}

.divider-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(180deg, transparent, var(--warm), var(--cool), transparent);
  opacity: 0.55;
}

.divider-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0.85rem;
  color: var(--warm);
  background: var(--warm-dim);
  border: 1px solid var(--border-accent);
  border-radius: 50%;
  opacity: 0.9;
}

/* —— Panels —— */
.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
  position: relative;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--warm) 25%,
    var(--cool) 75%,
    transparent
  );
  opacity: 0.65;
  pointer-events: none;
}

.panel-source::before {
  background: linear-gradient(90deg, transparent, var(--warm) 40%, transparent);
}

.panel-target::before {
  background: linear-gradient(90deg, transparent, var(--cool) 40%, transparent);
}

.panel-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0.75rem 1.2rem;
  min-height: 2.75rem;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-soft);
}

.panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.editor {
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  padding: 1.35rem 1.4rem;
  border: none;
  resize: none;
  background: transparent;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.75;
  font-family: inherit;
  letter-spacing: 0.02em;
}

.editor::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.editor--target {
  color: var(--text-soft);
  background: var(--surface-inset);
}

.editor:focus {
  outline: none;
}

.panel-source:focus-within {
  border-color: var(--border-accent);
  box-shadow:
    var(--shadow-panel),
    0 0 0 1px var(--warm-dim);
}

.panel-target:focus-within {
  border-color: var(--border-cool);
}

.panel-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.1);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-height: 2.75rem;
  height: 2.75rem;
  box-sizing: border-box;
}

.panel-footer--source {
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-footer--target {
  justify-content: flex-start;
  gap: 0.75rem;
}

.panel-footer--target .btn-primary {
  margin-left: auto;
  flex-shrink: 0;
}

.target-hint {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.target-hint--loading {
  color: var(--cool);
  opacity: 0.85;
}

.target-hint--error {
  color: var(--error);
}

.panel-target.is-busy .editor--target {
  opacity: 0.82;
  transition: opacity 0.2s ease;
}

.source-hint {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-hint--guess {
  color: var(--warm-light);
  font-style: italic;
  letter-spacing: 0.02em;
}

.source-hint--pending {
  color: var(--muted);
  opacity: 0.75;
}

.source-hint--loading {
  color: var(--muted);
  opacity: 0.85;
}

.footer-meta {
  font-variant-numeric: tabular-nums;
}

.btn-primary {
  position: relative;
  padding: 0.42rem 1.2rem;
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--warm-dim) 0%, var(--cool-dim) 100%);
  color: var(--warm-light);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.1em;
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s,
    transform 0.15s;
}

.btn-primary::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, transparent 50%);
  pointer-events: none;
}

.btn-primary:hover {
  border-color: var(--warm);
  color: var(--text);
  box-shadow: 0 4px 20px var(--warm-dim);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary--flash {
  border-color: var(--warm);
  color: var(--text);
}

.btn-primary--error {
  border-color: rgba(224, 154, 144, 0.4);
  color: var(--error);
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .workspace-divider {
    flex-direction: row;
    padding: 0;
  }

  .divider-line {
    width: 48px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--warm), var(--cool), transparent);
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 1rem 1rem 2rem;
  }

  .top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-title {
    font-size: 1.15rem;
    white-space: normal;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-group {
    flex-direction: column;
    align-items: stretch;
  }

  .select {
    width: 100%;
  }

  .swap-btn {
    align-self: center;
  }
}
