/* ============================================================
   零知树洞 · 样式表
   设计语言:深空玻璃拟态 + 琥珀/紫罗兰双色辉光
   ============================================================ */

:root {
  --bg-0: #07070f;
  --bg-1: #12122a;
  --surface: rgba(22, 22, 46, 0.72);
  --surface-2: rgba(14, 14, 30, 0.6);
  --stroke: rgba(140, 140, 200, 0.16);
  --stroke-strong: rgba(180, 180, 230, 0.28);
  --text: #ececf6;
  --text-dim: #a4a4c4;
  --text-faint: #74748f;
  --amber: #f5d77a;
  --amber-2: #d9a93a;
  --violet: #8b8bff;
  --violet-2: #b07bff;
  --green: #4ade80;
  --red: #ff6b6b;
  --radius: 22px;
  --radius-lg: 28px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto,
    'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, #1a1538 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 50% 100%, #1f1a12 0%, transparent 55%),
    var(--bg-0);
}

/* 动态背景光晕 */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  pointer-events: none;
}
body::before {
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(120,90,220,0.55), transparent 70%);
  top: -140px; left: -120px;
  animation: drift1 22s var(--ease) infinite alternate;
}
body::after {
  width: 460px; height: 460px;
  background: radial-gradient(circle, rgba(230,180,70,0.42), transparent 70%);
  bottom: -140px; right: -100px;
  animation: drift2 26s var(--ease) infinite alternate;
}
@keyframes drift1 {
  to { transform: translate(140px, 90px) scale(1.2); }
}
@keyframes drift2 {
  to { transform: translate(-110px, -70px) scale(1.15); }
}

/* 星点层 */
.stars {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 35% 85%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1.5px 1.5px at 90% 55%, rgba(255,255,255,0.45), transparent);
  background-size: 100% 100%;
  opacity: 0.6;
}

/* ---------------- 主容器 ---------------- */
.capsule {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  backdrop-filter: blur(34px) saturate(1.4);
  -webkit-backdrop-filter: blur(34px) saturate(1.4);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-lg);
  padding: 2.2rem 1.8rem 1.8rem;
  box-shadow: var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 60px rgba(120, 90, 220, 0.04);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  animation: rise 0.6s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------------- 头部 ---------------- */
.brand-header { text-align: center; }

.brand-logo {
  width: 64px; height: 64px;
  margin: 0 auto 0.6rem;
  display: grid; place-items: center;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(245,215,122,0.18), rgba(139,139,255,0.18));
  border: 1px solid var(--stroke-strong);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.brand-logo svg { width: 34px; height: 34px; }

.brand-name {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(120deg, var(--amber), #fff3cf 40%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.15;
}

.brand-desc {
  font-size: 0.92rem;
  color: var(--text-dim);
  margin-top: 0.35rem;
}

.brand-tags {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}
.tag {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.73rem;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ---------------- 分段选项卡 ---------------- */
.tab-bar {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 5px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 11px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.25s var(--ease), background 0.25s var(--ease);
  background: transparent;
  border: none;
  font-family: inherit;
  position: relative;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(139,139,255,0.35), rgba(176,123,255,0.25));
  box-shadow: 0 4px 14px rgba(123,123,255,0.25),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

/* ---------------- 面板 ---------------- */
.panel {
  display: none;
  flex-direction: column;
  gap: 1.1rem;
}
.panel.active {
  display: flex;
  animation: fade 0.35s var(--ease);
}
@keyframes fade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

/* ---------------- 模式切换 ---------------- */
.mode-row {
  display: inline-flex;
  gap: 4px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 4px;
  align-self: center;
}
.mode-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: 0.25s var(--ease);
}
.mode-btn.active {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ---------------- 输入框 ---------------- */
.field { position: relative; }
.field-label {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-bottom: 6px;
  display: block;
  font-weight: 500;
}
.input-field {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 13px 16px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: 0.2s var(--ease);
  font-family: inherit;
}
.input-field::placeholder { color: var(--text-faint); }
.input-field:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(139,139,255,0.18);
  background: rgba(20,20,42,0.8);
}
textarea.input-field {
  min-height: 130px;
  resize: vertical;
  line-height: 1.65;
  font-size: 0.96rem;
}
.field-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 0.73rem;
  color: var(--text-faint);
}

/* ---------------- 附件区 ---------------- */
.attach-card {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 0.9rem;
}
.attach-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}
.attach-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--text-dim);
  font-size: 0.84rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s var(--ease);
}
.attach-btn:hover {
  background: rgba(139,139,255,0.14);
  border-color: var(--stroke-strong);
  color: var(--text);
}
.attach-btn.recording {
  background: linear-gradient(135deg, #e03a3a, #b02828);
  border-color: transparent;
  color: #fff;
  animation: pulse 1.3s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(224,58,58,0.5); }
  70% { box-shadow: 0 0 0 12px rgba(224,58,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(224,58,58,0); }
}
.attach-list { display: flex; flex-direction: column; gap: 6px; }
.attach-list:empty { display: none; }

.attach-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 7px 12px;
  font-size: 0.85rem;
  animation: fade 0.25s var(--ease);
}
.attach-item .info {
  display: flex; align-items: center; gap: 9px; overflow: hidden; min-width: 0;
}
.attach-item .icon { font-size: 1rem; flex-shrink: 0; }
.attach-item .name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.attach-item .size { color: var(--text-faint); font-size: 0.75rem; flex-shrink: 0; }
.attach-item .remove {
  background: none; border: none; color: var(--red);
  cursor: pointer; font-size: 1.05rem; padding: 2px 6px; border-radius: 6px;
  transition: 0.2s;
}
.attach-item .remove:hover { background: rgba(255,107,107,0.15); }
.thumb-small {
  width: 38px; height: 30px; object-fit: cover; border-radius: 7px;
  border: 1px solid var(--stroke);
}

/* ---------------- 按钮 ---------------- */
.btn-primary {
  position: relative;
  background: linear-gradient(135deg, var(--amber), var(--amber-2));
  border: none;
  border-radius: var(--radius);
  padding: 15px;
  font-weight: 700;
  color: #1a1405;
  font-size: 1rem;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(217,169,58,0.3);
  transition: 0.25s var(--ease);
  font-family: inherit;
  overflow: hidden;
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(217,169,58,0.4);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.6; cursor: not-allowed; transform: none;
}
.btn-primary.loading { color: transparent; }
.btn-primary.loading::after {
  content: '';
  position: absolute; top: 50%; left: 50%;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 3px solid rgba(26,20,5,0.3);
  border-top-color: #1a1405;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn-outline {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke-strong);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-outline:hover {
  background: rgba(255,255,255,0.08);
  border-color: var(--violet);
}
.btn-outline.amber { border-color: rgba(245,215,122,0.5); color: var(--amber); }
.btn-outline.amber:hover { background: rgba(245,215,122,0.1); }
.btn-outline.full { width: 100%; }

.action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.action-row > * { flex: 1; min-width: 130px; }

/* ---------------- 结果区(封存) ---------------- */
.result-area {
  background: linear-gradient(160deg, rgba(245,215,122,0.06), rgba(20,20,42,0.5));
  border: 1px solid rgba(245,215,122,0.25);
  border-radius: 18px;
  padding: 1.1rem;
  animation: fade 0.35s var(--ease);
}
.result-title {
  font-size: 0.8rem;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 0.7rem;
  display: flex; align-items: center; gap: 6px;
}

.key-mono {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  letter-spacing: 1px;
}
.key-full {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--amber);
  text-align: center;
  word-break: break-all;
  padding: 0.6rem 0;
  user-select: all;
}

.key-split {
  display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 0.6rem;
}
.key-half {
  flex: 1; min-width: 140px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--stroke-strong);
  border-radius: 14px;
  padding: 0.85rem;
  text-align: center;
}
.key-half .label {
  font-size: 0.74rem; color: var(--text-faint); margin-bottom: 6px;
}
.key-half .value {
  color: var(--amber);
  font-size: 1.15rem;
  font-weight: 700;
  word-break: break-all;
  user-select: all;
}

.warning-text {
  color: #ffb0b0;
  font-size: 0.8rem;
  margin: 0.6rem 0;
  display: flex; align-items: center; gap: 6px;
}
.local-id {
  font-size: 0.74rem; color: var(--text-faint); margin-top: 8px;
  word-break: break-all;
}

/* ---------------- 解密结果 ---------------- */
.decrypt-content {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 1.1rem;
  animation: fade 0.35s var(--ease);
}
.decrypt-content p.body-text {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 0.96rem;
}
.decrypt-content img {
  max-width: 100%; border-radius: 12px; margin: 10px 0; display: block;
}
.decrypt-content audio { width: 100%; margin: 10px 0; }
.decrypt-content a.dl-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--violet); text-decoration: none;
  background: rgba(139,139,255,0.1);
  padding: 8px 14px; border-radius: 10px; font-size: 0.88rem;
}
.decrypt-content a.dl-link:hover { background: rgba(139,139,255,0.2); }
.decrypt-meta {
  font-size: 0.72rem; color: var(--text-faint); margin-top: 14px;
  border-top: 1px solid var(--stroke); padding-top: 10px;
}
.error-message {
  color: var(--red); font-size: 0.88rem; margin-top: 0.5rem;
  display: none;
}
.error-message.show { display: block; animation: fade 0.2s var(--ease); }
.status-message {
  color: var(--green); font-size: 0.85rem; margin-top: 0.5rem;
  display: none;
}
.status-message.show { display: block; animation: fade 0.2s var(--ease); }

/* ---------------- 帮助按钮 ---------------- */
.help-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 0.82rem; font-family: inherit;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 8px; transition: 0.2s;
}
.help-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* ---------------- 模态弹窗 ---------------- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center; align-items: center;
  padding: 20px;
}
.modal-overlay.active { display: flex; animation: fade 0.25s var(--ease); }
.modal-box {
  background: linear-gradient(160deg, #1c1c38, #15152a);
  border: 1px solid var(--stroke-strong);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  max-width: 480px; width: 100%;
  box-shadow: 0 30px 60px rgba(0,0,0,0.7);
  animation: rise 0.3s var(--ease);
  position: relative;
}
.modal-x {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 0.85rem; cursor: pointer;
  display: grid; place-items: center;
  transition: 0.2s;
}
.modal-x:hover { background: rgba(255,107,107,0.15); color: var(--red); }
.modal-box h3 {
  font-size: 1.2rem; margin-bottom: 0.9rem;
  color: var(--amber); display: flex; align-items: center; gap: 8px;
}
.modal-box p {
  font-size: 0.88rem; line-height: 1.65; margin-bottom: 0.6rem;
  color: var(--text-dim);
}
.modal-box p strong { color: var(--text); }
.modal-box ul {
  margin: 0.5rem 0 1rem 1.1rem; color: var(--text-dim);
  font-size: 0.86rem; line-height: 1.8;
}
.modal-box ul li { margin-bottom: 3px; }
.modal-close {
  background: linear-gradient(135deg, var(--violet), var(--violet-2));
  border: none; padding: 10px 26px; border-radius: 12px;
  color: #fff; font-weight: 600; cursor: pointer;
  font-family: inherit; font-size: 0.9rem; transition: 0.2s;
}
.modal-close:hover { filter: brightness(1.1); }

/* ---------------- Toast 通知 ---------------- */
.toast-stack {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
  width: max-content; max-width: 90vw;
}
.toast {
  background: rgba(28,28,52,0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--stroke-strong);
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 0.88rem;
  color: var(--text);
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px;
  animation: toastIn 0.3s var(--ease);
}
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
.toast.success { border-color: rgba(74,222,128,0.4); }
.toast.error { border-color: rgba(255,107,107,0.4); }
.toast.info { border-color: rgba(139,139,255,0.4); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-16px); }
}

/* ---------------- 页脚 ---------------- */
.footer-note {
  text-align: center; font-size: 0.72rem; color: var(--text-faint);
  margin-top: 0.3rem; display: flex; align-items: center;
  justify-content: center; gap: 6px;
}
.footer-note a { color: var(--text-dim); text-decoration: none; }
.footer-note a:hover { color: var(--text); }

.hidden { display: none !important; }

input[type="file"] { display: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 560px) {
  .capsule { padding: 1.6rem 1.1rem 1.3rem; border-radius: 22px; }
  .brand-name { font-size: 1.6rem; }
  .key-full { font-size: 1.2rem; }
  .key-half { min-width: 100%; }
  .action-row > * { min-width: 100%; }
  .dual-input-row { flex-direction: column; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
