/* ===== 全局样式 ===== */
:root {
  color-scheme: dark;
  --ui-page: #0b1220;
  --ui-surface: #151f2e;
  --ui-surface-raised: #1a2637;
  --ui-list-surface: rgba(8, 14, 25, 0.68);
  --ui-border: rgba(148, 163, 184, 0.16);
  --ui-border-strong: rgba(148, 163, 184, 0.26);
  --ui-text: #e2e8f0;
  --ui-muted: #94a3b8;
  --ui-accent: #67e8f9;
  --ui-accent-strong: #22d3ee;
  --ui-success: #34d399;
  --ui-warning: #fbbf24;
  --ui-danger: #f87171;
  --ui-egg: #c4b5fd;
  --ui-focus: rgba(103, 232, 249, 0.72);
  --ui-radius-control: 6px;
  --ui-radius-panel: 8px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #000;
  color: var(--ui-text);
}

/* ===== 显示页面样式 ===== */
.display-container {
  width: 100%;
  height: 100%;
  padding: 20px;
  background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.section {
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid #00d4ff;
  border-radius: 10px;
  padding: 15px;
  overflow: hidden;
}

.section-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  color: #00d4ff;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-bottom: 2px solid #00d4ff;
  padding-bottom: 8px;
}

/* 众筹目标 */
.goal-section {
  flex: 0 0 auto;
}

.goal-info {
  font-size: 14px;
  margin-bottom: 10px;
}

.progress-bar {
  width: 100%;
  height: 25px;
  background: #333;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid #555;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #00ff00, #00d4ff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: bold;
  font-size: 12px;
  transition: width 0.3s ease;
}

/* 列表样式 */
.list-container {
  max-height: 100%;
  overflow: hidden;
}

.list-item {
  padding: 8px;
  margin: 5px 0;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 赞助状态样式 */
.sponsor-item {
  background: rgba(100, 100, 100, 0.3);
  border-left: 4px solid #999;
  padding: 10px;
}

.sponsor-item.completed {
  background: rgba(0, 255, 0, 0.1);
  border-left-color: #00ff00;
}

.sponsor-item.pending {
  background: rgba(255, 165, 0, 0.1);
  border-left-color: #ffa500;
}

.sponsor-item.failed {
  background: rgba(255, 0, 0, 0.1);
  border-left-color: #ff0000;
  text-decoration: line-through;
  opacity: 0.7;
}

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
  margin-left: 10px;
}

.status-badge.completed {
  background: #00ff00;
  color: #000;
}

.status-badge.pending {
  background: #ffa500;
  color: #000;
}

.status-badge.failed {
  background: #ff0000;
  color: #fff;
}

/* 彩蛋样式 */
.egg-item {
  background: rgba(180, 100, 200, 0.2);
  border-left: 4px solid #b464c8;
  padding: 10px;
}

.egg-item.completed {
  background: rgba(100, 200, 255, 0.2);
  border-left-color: #64c8ff;
}

.egg-item.pending {
  background: rgba(255, 200, 100, 0.2);
  border-left-color: #ffc864;
}

.egg-item.failed {
  background: rgba(255, 100, 100, 0.2);
  border-left-color: #ff6464;
  opacity: 0.6;
}

/* 自定义内容 */
.content-item {
  background: rgba(100, 150, 255, 0.1);
  border: 1px dashed #6496ff;
  border-radius: 5px;
  padding: 15px;
  text-align: center;
}

.content-item img {
  max-width: 100%;
  height: auto;
  border-radius: 5px;
  margin-bottom: 10px;
  max-height: 150px;
}

/* 翻页指示器 */
.page-indicator {
  text-align: center;
  font-size: 12px;
  color: #ccc;
  margin-top: 10px;
  height: 20px;
}

/* ===== 编辑页面样式 ===== */
.editor-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 15px 20px;
  background: #0f111a;
  min-height: 100vh;
  color: #e2e8f0;
}

.editor-header {
  margin-bottom: 15px;
  border-bottom: 2px solid rgba(0, 212, 255, 0.2);
  padding-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-header h1 {
  font-size: 22px;
  color: #00d4ff;
  margin-bottom: 0px;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.editor-header p {
  color: #8f9bb3;
  font-size: 13px;
  margin: 0;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.editor-grid .editor-section {
  margin-bottom: 0;
  height: 100%;
}

@media (max-width: 992px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

.editor-section {
  background: #1a1f2e;
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: border-color 0.3s ease;
  margin-bottom: 15px;
}

.editor-section:hover {
  border-color: rgba(0, 212, 255, 0.3);
}

.section-header {
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
}

.section-header h2 {
  font-size: 16px;
  color: #00d4ff;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin: 0;
}

/* ===== 表单布局 ===== */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

.form-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
}

.form-group.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.form-group label {
  margin-bottom: 4px;
  font-weight: 500;
  color: #a0aec0;
  font-size: 12px;
}

.form-group.inline label {
  margin-bottom: 0;
  white-space: nowrap;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 4px;
  color: #f8fafc;
  font-size: 13px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #00d4ff;
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
  background: rgba(15, 23, 42, 0.8);
}

.readonly-input {
  background: rgba(255, 255, 255, 0.03) !important;
  color: #94a3b8 !important;
  border-color: transparent !important;
}

.help-text {
  color: #64748b;
  font-size: 12px;
  margin-top: 4px;
  display: block;
}

/* ===== 按钮样式 ===== */
.button-group {
  display: flex;
  gap: 10px;
}

.align-bottom {
  align-self: flex-end;
  margin-bottom: 16px;
}

.btn {
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-control);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn:focus-visible,
.button-group :is(a, button):focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--ui-accent);
  color: #082f49;
}

.btn-primary:hover {
  background: #a5f3fc;
}

.btn-success {
  background: var(--ui-success);
  color: #052e25;
}

.btn-success:hover {
  background: #6ee7b7;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.28);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.46);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
}

/* ===== 特殊输入高亮 ===== */
.highlight-label {
  color: #34d399 !important;
}
.highlight-input {
  background: rgba(52, 211, 153, 0.05) !important;
  border-color: rgba(52, 211, 153, 0.2) !important;
}
.highlight-input:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.1) !important;
}

/* ===== 选项卡与列表容器 ===== */
.mt-15 { margin-top: 15px; }

.event-tabs-container {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.2);
  padding-bottom: 0;
}

.event-tab {
  padding: 10px 20px;
  background: transparent;
  color: #64748b;
  border: none;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  font-weight: 500;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
  position: relative;
  bottom: -1px;
}

.event-tab:hover {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.02);
}

.event-tab.active {
  background: rgba(0, 212, 255, 0.1);
  color: #00d4ff;
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-bottom-color: #1a1f2e;
}

.event-content {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.event-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ===== 数据列表 ===== */
.data-list {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  max-height: 480px;
  overflow-y: auto;
}

.data-list::-webkit-scrollbar {
  width: 6px;
}
.data-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.empty-state {
  padding: 30px;
  text-align: center;
  color: #64748b;
  font-size: 14px;
}

.data-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
  transition: background 0.2s ease;
}

.data-list-item:hover {
  background: rgba(0, 212, 255, 0.05);
}

.data-list-item:last-child {
  border-bottom: none;
}

.item-info {
  flex: 1;
}

.item-nickname {
  font-weight: 600;
  color: #e2e8f0;
}

.item-amount {
  color: #34d399;
  font-weight: 600;
  font-family: monospace;
  font-size: 14px;
}

.item-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin: 0 8px;
}

.item-status.completed {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

.item-status.pending {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.item-status.failed {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.item-actions {
  display: flex;
  gap: 6px;
}

/* ===== 预览框与日志 ===== */
.preview-box {
  background: #000;
  border: 1px solid rgba(0, 212, 255, 0.3);
  border-radius: 8px;
  height: 250px;
  overflow-y: auto;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.log-box {
  background: #0f111a;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  color: #94a3b8;
}

.log-entry {
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry.success {
  color: #34d399;
}
.log-entry.error {
  color: #ef4444;
}
.log-entry.warning {
  color: #fbbf24;
}

/* 预览部分 */
.preview-section {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #00d4ff;
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
}

.preview-section h3 {
  color: #00d4ff;
  margin-bottom: 10px;
  font-size: 14px;
}

.preview-content {
  background: rgba(0, 0, 0, 0.5);
  padding: 10px;
  border-radius: 5px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 13px;
}

/* 加载状态 */
.loading {
  text-align: center;
  padding: 20px;
  color: #00d4ff;
}

.spinner {
  border: 3px solid rgba(0, 212, 255, 0.3);
  border-radius: 50%;
  border-top: 3px solid #00d4ff;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 消息提示 */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 15px 20px;
  border-radius: 5px;
  color: #fff;
  font-weight: bold;
  animation: slideUp 0.3s ease;
  z-index: 1000;
}

.toast.success {
  background: #00ff00;
  color: #000;
}

.toast.error {
  background: #ff0000;
  color: #fff;
}

.toast.info {
  background: #00d4ff;
  color: #000;
}

@keyframes slideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes flashGreen {
  0% { background-color: rgba(52, 211, 153, 0.2); }
  50% { background-color: rgba(52, 211, 153, 0.8); }
  100% { background-color: rgba(52, 211, 153, 0.2); }
}

.ongoing-match-breathe {
  animation: breatheGreen 2s ease-in-out infinite;
}

@keyframes breatheGreen {
  0% {
    box-shadow: 0 0 5px rgba(52, 211, 153, 0.2);
    border-color: rgba(52, 211, 153, 0.4);
    background-color: rgba(52, 211, 153, 0.05);
  }
  50% {
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.6);
    border-color: rgba(52, 211, 153, 0.8);
    background-color: rgba(52, 211, 153, 0.15);
  }
  100% {
    box-shadow: 0 0 5px rgba(52, 211, 153, 0.2);
    border-color: rgba(52, 211, 153, 0.4);
    background-color: rgba(52, 211, 153, 0.05);
  }
}

.ongoing-match-text-breathe {
  animation: breatheTextGreen 2s ease-in-out infinite;
}

.editor-container :is(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid #67e8f9 !important;
  outline-offset: 2px;
}

@keyframes breatheTextGreen {
  0% {
    color: var(--original-color, inherit);
    text-shadow: var(--original-shadow, inherit);
  }
  50% {
    color: #34d399;
    text-shadow: 0 0 8px rgba(52, 211, 153, 0.8);
  }
  100% {
    color: var(--original-color, inherit);
    text-shadow: var(--original-shadow, inherit);
  }
}

/* 响应式适配 */
@media (max-width: 600px) {
  .display-container {
    padding: 10px;
    gap: 10px;
  }

  .section {
    padding: 10px;
  }

  .section-title {
    font-size: 14px;
  }

  .list-item {
    font-size: 12px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-section {
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
