/* 页面基础 */
:root {
  --bg-start: #0a0e27;
  --bg-end: #1a0f3d;
  --card-bg: rgba(15, 18, 45, 0.85);
  --text: #f0f4ff;
  --muted: rgba(240, 244, 255, 0.72);
  --accent: #4f7fff;
  --accent-2: #a855ff;
  --accent-3: #ff6b6b;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  --border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 25%, rgba(79, 127, 255, 0.4), transparent 45%),
    radial-gradient(circle at 80% 35%, rgba(168, 85, 255, 0.35), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(255, 107, 107, 0.2), transparent 50%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  overflow-x: hidden;
}

.page {
  min-height: 100vh;
  width: 100%;
  display: block;
  padding: 0;
}

.scene {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

.glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 35% 40%, rgba(79, 127, 255, 0.3), transparent 50%),
    radial-gradient(circle at 65% 25%, rgba(168, 85, 255, 0.25), transparent 50%),
    radial-gradient(circle at 50% 85%, rgba(255, 107, 107, 0.15), transparent 45%);
  filter: blur(28px);
  animation: drift 20s ease-in-out infinite;
  border-radius: 0;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(8px, -14px) scale(1.03); }
}

.card {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 40px;
  border-radius: 0;
  background: var(--card-bg);
  box-shadow: none;
  border: 0;
  backdrop-filter: blur(16px);
  overflow: hidden;
  z-index: 1;
}

.header {
  position: relative;
  margin-bottom: 32px;
  text-align: center;
  min-height: 40px;
}

.back-button {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(79, 127, 255, 0.45);
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.22), rgba(168, 85, 255, 0.16));
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.back-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(79, 127, 255, 0.28);
  border-color: rgba(79, 127, 255, 0.75);
}

.back-button:active {
  transform: translateY(0);
}

.back-icon {
  font-size: 1rem;
}

.title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.5rem);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4f7fff, #a855ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 8px 0 0;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  color: var(--muted);
}

.section {
  margin-bottom: 24px;
}

/* 提示框 */
.prompt-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.15), rgba(168, 85, 255, 0.1));
  border: 1px solid rgba(79, 127, 255, 0.3);
  animation: pulse-border 3s ease-in-out infinite;
}

.prompt-icon {
  font-size: 1.6rem;
  animation: bounce 2s ease-in-out infinite;
}

.prompt-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 127, 255, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(79, 127, 255, 0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 协议版本选择器 */
.protocol-selector {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(79, 127, 255, 0.2);
}

.protocol-label {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.protocol-options {
  display: flex;
  gap: 8px;
}

.protocol-option {
  position: relative;
  cursor: pointer;
}

.protocol-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.protocol-option-label {
  display: inline-block;
  padding: 6px 18px;
  border-radius: 999px;
  border: 1px solid rgba(79, 127, 255, 0.3);
  background: rgba(79, 127, 255, 0.08);
  color: rgba(240, 244, 255, 0.7);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 180ms ease;
  user-select: none;
}

.protocol-option input:checked + .protocol-option-label {
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.35), rgba(168, 85, 255, 0.25));
  border-color: rgba(79, 127, 255, 0.7);
  color: var(--text);
  box-shadow: 0 0 20px rgba(79, 127, 255, 0.2);
}

.protocol-option input:not(:checked):hover + .protocol-option-label {
  background: rgba(79, 127, 255, 0.15);
  border-color: rgba(79, 127, 255, 0.5);
}

/* 按钮样式 */
.action-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  overflow: hidden;
  color: var(--text);
}

.action-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 300ms ease;
}

.action-button:hover::before {
  transform: translateX(100%);
}

.select-btn {
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.35), rgba(79, 127, 255, 0.2));
  border: 2px solid rgba(79, 127, 255, 0.5);
}

.select-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(79, 127, 255, 0.3);
  border-color: rgba(79, 127, 255, 0.8);
}

.select-btn:active:not(:disabled) {
  transform: translateY(0);
}

.start-btn {
  background: linear-gradient(135deg, var(--accent-2), #ff6b9d);
  border: 2px solid var(--accent-2);
  position: relative;
}

.start-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(168, 85, 255, 0.4);
  border-color: #ff6b9d;
}

.start-btn:not(:disabled):active {
  transform: translateY(0);
}

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

.button-icon {
  font-size: 1.2rem;
}

.button-text {
  position: relative;
  z-index: 2;
}

.button-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { background-position: -1000px 0; }
  100% { background-position: 1000px 0; }
}

/* 文件树容器 */
.file-tree-container {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(79, 127, 255, 0.2);
  overflow: hidden;
  transition: all 300ms ease;
}

.tree-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(79, 127, 255, 0.15), rgba(168, 85, 255, 0.1));
  border-bottom: 1px solid rgba(79, 127, 255, 0.2);
}

.tree-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.tree-count {
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(79, 127, 255, 0.2);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.tree-content {
  padding: 20px;
  max-height: 300px;
  overflow-y: auto;
  min-height: 100px;
}

.empty-state {
  margin: 0;
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 0.95rem;
}

/* 进度条 */
.progress-container {
  margin-top: 32px;
  padding: 24px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), #ff6b9d);
  border-radius: 4px;
  width: 0%;
  transition: width 300ms ease;
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.progress-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.version-info {
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.35);
  border-radius: 10px;
}

/* 结果容器 */
.parse-result-container {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(79, 127, 255, 0.35);
  overflow: hidden;
  animation: slideUp 400ms ease;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(79, 127, 255, 0.15), rgba(168, 85, 255, 0.1));
  border-bottom: 1px solid rgba(79, 127, 255, 0.2);
}

.result-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.result-close {
  cursor: pointer;
  color: rgba(243, 244, 255, 0.6);
  font-size: 1.2rem;
  transition: color 200ms ease, transform 200ms ease;
  user-select: none;
}

.result-close:hover {
  color: var(--text);
  transform: scale(1.2);
}

.result-content {
  padding: 20px;
}

/* 隐私声明 */
.privacy-section {
  margin-top: 8px;
  margin-bottom: 0;
}

.privacy-note {
  margin: 0;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(79, 127, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: rgba(240, 244, 255, 0.66);
  font-size: 0.82rem;
  line-height: 1.55;
  text-align: center;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 滚动条美化 */
.tree-content::-webkit-scrollbar,
.parse-result-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.tree-content::-webkit-scrollbar-track,
.parse-result-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.tree-content::-webkit-scrollbar-thumb,
.parse-result-container::-webkit-scrollbar-thumb {
  background: rgba(79, 127, 255, 0.3);
  border-radius: 3px;
}

.tree-content::-webkit-scrollbar-thumb:hover,
.parse-result-container::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 127, 255, 0.5);
}

/* 响应式 */
@media (max-width: 500px) {
  .card { padding: 32px 24px; }
  .header { min-height: 36px; }
  .back-button { padding: 7px 12px; font-size: 0.82rem; }
  .title { font-size: 1.8rem; }
  .action-button { font-size: 0.95rem; padding: 14px 20px; }
  .protocol-selector { flex-direction: column; align-items: flex-start; gap: 10px; }
  .protocol-options { flex-wrap: wrap; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}
