/* 星络·空间 —— 对话翻译（暗黑简约主题） */

:root {
  --bg: #0b0d10;
  --bg-glow: rgba(124, 156, 255, 0.05);
  --surface: #111419;
  --surface-2: #151920;
  --surface-3: #1a1f27;
  --border: #232a33;
  --border-soft: #1b212a;
  --text: #e8eaee;
  --text-dim: #99a2b0;
  --text-faint: #6a7482;
  --accent: #7c9cff;
  --accent-dim: rgba(124, 156, 255, 0.14);
  --danger: #ff6b6b;
  --danger-dim: rgba(255, 107, 107, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --tr-size: 15px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

body {
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(720px 320px at 12% -8%, var(--bg-glow), transparent 70%),
    radial-gradient(600px 280px at 88% 2%, rgba(124, 156, 255, 0.035), transparent 72%);
  background-repeat: no-repeat;
}

a { color: inherit; text-decoration: none; }

.brand-mark {
  position: relative;
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, #c9d7ff, var(--accent) 62%, #48548c);
  box-shadow: 0 0 12px rgba(124, 156, 255, 0.5);
}

/* ---------------------------------------------------- 顶栏 */

.tr-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 24px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 13, 16, 0.86);
  backdrop-filter: blur(10px);
}

.tr-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.tr-brand .brand-mark { align-self: center; }

.brand-sub {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-faint);
  letter-spacing: 0.5px;
}

.tr-tools {
  display: flex;
  align-items: center;
  gap: 14px;
}

.tr-fontsize {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.tr-fontsize-label {
  font-size: 12px;
  color: var(--text-faint);
}

.tr-fs-btn {
  width: 26px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.tr-fs-btn:hover { color: var(--accent); background: var(--accent-dim); }

.tr-fs-value {
  min-width: 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.tr-btn {
  padding: 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tr-btn:hover { color: var(--text); border-color: var(--accent); }

.tr-link {
  font-size: 13.5px;
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.tr-link:hover { color: var(--accent); }

/* ---------------------------------------------------- 对话区 */

.tr-main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
}

.tr-notice {
  max-width: 860px;
  margin: 20px auto 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 196, 106, 0.28);
  background: rgba(255, 196, 106, 0.08);
  color: #ffd79a;
  font-size: 13.5px;
}

.tr-log {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: var(--tr-size);
  line-height: 1.75;
}

.tr-empty {
  padding: 60px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.92em;
}

.tr-msg {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.tr-role {
  font-size: 0.78em;
  letter-spacing: 1px;
  color: var(--text-faint);
}

.tr-msg.is-assistant .tr-role { color: var(--accent); }

.tr-bubble {
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tr-msg.is-user .tr-bubble {
  border-color: rgba(124, 156, 255, 0.24);
  background: var(--accent-dim);
}

.tr-msg.is-error .tr-bubble {
  border-color: rgba(255, 107, 107, 0.3);
  background: var(--danger-dim);
  color: #ffb4b4;
}

/* ---------------------------------------------------- 输入区 */

.tr-composer {
  flex: 0 0 auto;
  z-index: 15;
  padding: 12px 24px;
  border-top: 1px solid var(--border-soft);
  background: rgba(11, 13, 16, 0.94);
}

.tr-composer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tr-style-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tr-style-label {
  font-size: 12.5px;
  color: var(--text-faint);
  white-space: nowrap;
}

.tr-select {
  flex: 1 1 auto;
  max-width: 260px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tr-select:focus { border-color: var(--accent); color: var(--text); }

.tr-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.tr-input {
  flex: 1 1 auto;
  min-height: 132px;
  max-height: 320px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tr-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.tr-input:disabled { opacity: 0.5; cursor: not-allowed; }

.tr-send {
  flex: 0 0 auto;
  height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #0b0d10;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.tr-send:hover { filter: brightness(1.08); }
.tr-send:disabled { opacity: 0.5; cursor: not-allowed; }

.tr-hint {
  max-width: 860px;
  margin: 8px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text-faint);
}

.tr-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}

.tr-count.is-full { color: #e0846a; }

/* ---------------------------------------------------- 提示 */

.tr-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 80vw;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.tr-toast.is-error {
  border-color: rgba(255, 107, 107, 0.32);
  color: #ffb4b4;
}

.is-hidden { display: none !important; }

/* ---------------------------------------------------- 滚动条（暗黑） */

.tr-input,
.tr-main {
  scrollbar-width: thin;
  scrollbar-color: #2a313c transparent;
}

.tr-input::-webkit-scrollbar,
.tr-main::-webkit-scrollbar { width: 10px; height: 10px; }

.tr-input::-webkit-scrollbar-track,
.tr-main::-webkit-scrollbar-track { background: transparent; }

.tr-input::-webkit-scrollbar-thumb,
.tr-main::-webkit-scrollbar-thumb {
  background: #2a313c;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.tr-input::-webkit-scrollbar-thumb:hover,
.tr-main::-webkit-scrollbar-thumb:hover {
  background: #39424f;
  background-clip: padding-box;
}

/* ---------------------------------------------------- 移动端 */

@media (max-width: 620px) {
  .tr-topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 11px 16px;
  }

  .brand-sub { display: none; }

  .tr-tools { gap: 10px; }

  .tr-fontsize-label { display: none; }

  .tr-log { padding: 18px 16px; }

  .tr-notice { margin-left: 16px; margin-right: 16px; }

  .tr-composer { padding: 12px 16px 10px; }

  .tr-send { padding: 0 18px; }
}
