/* MMT 服务器数据加密解析工具 - 与 hex_data_parser 统一主题 */
: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: #34d399;
  --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(52, 211, 153, 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(52, 211, 153, 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); }
}

/* 模式切换标签 */
.mode-selector {
  display: flex;
  justify-content: center;
}

.mode-tabs {
  display: inline-flex;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(79, 127, 255, 0.2);
  padding: 4px;
  gap: 4px;
}

.mode-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 28px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(240, 244, 255, 0.6);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
}

.mode-tab:hover {
  color: var(--text);
  background: rgba(79, 127, 255, 0.1);
}

.mode-tab.active {
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.3), rgba(168, 85, 255, 0.2));
  color: var(--text);
  box-shadow: 0 4px 16px rgba(79, 127, 255, 0.2);
}

.mode-tab-icon {
  font-size: 1.1rem;
}

/* 输入组 */
.input-group {
  margin-bottom: 16px;
}

.input-group-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.label-desc {
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 8px;
}

.code-input {
  width: 100%;
  min-height: 100px;
  padding: 14px 16px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(79, 127, 255, 0.3);
  color: #a8e6cf;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.code-input:focus {
  border-color: rgba(79, 127, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 127, 255, 0.15);
}

.code-input::placeholder {
  color: rgba(240, 244, 255, 0.3);
  font-family: inherit;
}

.rsa-key-input {
  min-height: 120px;
}

/* 生成密钥按钮 */
.gen-key-btn {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(52, 211, 153, 0.15));
  border: 2px solid rgba(52, 211, 153, 0.4);
  flex: 0.5;
}

.gen-key-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(52, 211, 153, 0.25);
  border-color: rgba(52, 211, 153, 0.7);
}

.gen-key-btn:active {
  transform: translateY(0);
}

/* 密钥配置 */
.key-config {
  display: flex;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(79, 127, 255, 0.15);
}

.key-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.key-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.key-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(79, 127, 255, 0.3);
  color: #a8e6cf;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.key-input:focus {
  border-color: rgba(79, 127, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(79, 127, 255, 0.15);
}

.key-input::placeholder {
  color: rgba(240, 244, 255, 0.25);
}

/* 输入框（旧选择器，兼容） */
.input-container {
  margin-bottom: 12px;
}

/* 输入操作按钮 */
.input-actions {
  display: flex;
  gap: 12px;
}

.action-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex: 1;
  padding: 14px 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%);
}

.parse-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);
}

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

.parse-btn:active {
  transform: translateY(0);
}

.clear-btn {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.25), rgba(255, 107, 107, 0.15));
  border: 2px solid rgba(255, 107, 107, 0.4);
  flex: 0.4;
}

.clear-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 107, 107, 0.25);
  border-color: rgba(255, 107, 107, 0.7);
}

.clear-btn:active {
  transform: translateY(0);
}

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

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

/* 结果容器 */
.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-body {
  padding: 20px;
}

.json-output {
  margin: 0;
  padding: 16px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(79, 127, 255, 0.15);
  color: #a8e6cf;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* JSON 区块（日志解析结果） */
.json-section {
  margin-top: 16px;
}

.json-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(79, 127, 255, 0.15), transparent);
  border-left: 3px solid var(--accent);
}

.json-block {
  max-height: 400px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.55;
}

/* 元信息行（日志解析结果头部） */
.meta-rows {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(79, 127, 255, 0.12);
}

.meta-rows .meta-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 3px 0;
  font-size: 0.85rem;
}

.meta-rows .meta-label {
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 500;
  min-width: 80px;
}

.meta-rows .meta-value {
  color: var(--text);
  word-break: break-all;
}
/* 隐私声明 */
.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); }
}

/* 滚动条美化 */
.code-input::-webkit-scrollbar,
.json-output::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.code-input::-webkit-scrollbar-track,
.json-output::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.code-input::-webkit-scrollbar-thumb,
.json-output::-webkit-scrollbar-thumb {
  background: rgba(79, 127, 255, 0.3);
  border-radius: 3px;
}

.code-input::-webkit-scrollbar-thumb:hover,
.json-output::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 127, 255, 0.5);
}

/* RSA 密钥输入区滚动条 */
.rsa-key-input::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.rsa-key-input::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.rsa-key-input::-webkit-scrollbar-thumb {
  background: rgba(79, 127, 255, 0.3);
  border-radius: 3px;
}

.rsa-key-input::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 127, 255, 0.5);
}

/* 日志解析区域 */
.log-parser-section {
  margin-bottom: 20px;
  border-radius: 12px;
  border: 1px solid rgba(79, 127, 255, 0.25);
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.log-parser-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  transition: background 180ms ease;
  list-style: none;
}

.log-parser-summary::-webkit-details-marker {
  display: none;
}

.log-parser-summary:hover {
  background: rgba(79, 127, 255, 0.08);
}

.log-parser-summary::before {
  content: '▶';
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 200ms ease;
}

.log-parser-section[open] > .log-parser-summary::before {
  transform: rotate(90deg);
}

.log-parser-icon {
  font-size: 1rem;
}

.log-parser-badge {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: auto;
  white-space: nowrap;
}

.log-parser-body {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(79, 127, 255, 0.12);
}

.log-input {
  min-height: 120px;
}

.log-parser-actions {
  margin-top: 10px;
}

.log-parse-btn {
  background: linear-gradient(135deg, rgba(168, 85, 255, 0.25), rgba(79, 127, 255, 0.15));
  border: 2px solid rgba(168, 85, 255, 0.4);
  flex: none;
  padding: 10px 20px;
  font-size: 0.9rem;
}

.log-parse-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(168, 85, 255, 0.25);
  border-color: rgba(168, 85, 255, 0.7);
}

.log-parsed-meta {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(79, 127, 255, 0.2);
  font-size: 0.82rem;
  line-height: 1.7;
}

.log-parsed-meta .meta-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.log-parsed-meta .meta-label {
  color: var(--muted);
  min-width: 80px;
  flex-shrink: 0;
}

.log-parsed-meta .meta-value {
  color: #a8e6cf;
  font-family: 'Courier New', Courier, monospace;
  word-break: break-all;
}

/* 步骤日志样式 */
.step-log {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(79, 127, 255, 0.2);
}

.step-log-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.step-log-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
  font-size: 0.82rem;
  color: rgba(240, 244, 255, 0.75);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.step-log-item:last-child {
  border-bottom: none;
}

.step-log-step {
  font-family: 'Courier New', Courier, monospace;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  min-width: 80px;
}

.step-log-detail {
  font-family: 'Courier New', Courier, monospace;
  word-break: break-all;
  color: #a8e6cf;
}

/* 错误提示 */
.error-message {
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ff8a8a;
  font-size: 0.9rem;
  font-weight: 500;
}
