@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800;900&display=swap');

:root {
  color-scheme: dark;
  --bg: #0d0d12;
  --bg-card: rgba(24, 24, 28, 0.75);
  --bg-card-hover: rgba(30, 30, 35, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --line-active: rgba(255, 107, 0, 0.5);
  --text: #ffffff;
  --muted: #8b8f9e;
  --accent-start: #ff4500;
  --accent-end: #ffb800;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  --glow: 0 0 24px rgba(255, 107, 0, 0.4);
  --glass: blur(20px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Inter', "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(255, 69, 0, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(255, 184, 0, 0.05), transparent 25%),
    radial-gradient(circle at 50% -20%, rgba(255, 80, 0, 0.12), transparent 40%);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Floating particles/animations for background */
.bg-particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.5;
}

.page-shell {
  position: relative;
  z-index: 10;
  width: min(800px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 160px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Hero Section */
.hero-bar {
  text-align: center;
  margin-bottom: 20px;
  animation: fadeInDown 0.8s ease-out;
}

.hero-bar .eyebrow {
  font-size: 1rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin: 0 0 12px;
}

.hero-bar h1 {
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

.hero-bar h1 .highlight {
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-start);
  text-shadow: 0 0 30px rgba(255, 107, 0, 0.3);
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 500px;
  margin: 0 auto;
}

/* Panels */
.screen-panel {
  display: none;
  animation: fadeIn 0.4s ease-out;
}
.screen-panel.is-active {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Section Titles (Like 肠胃档案调查 Q1) */
.section-title-wrap {
  text-align: center;
  position: relative;
  margin: 20px 0;
}
.section-title-wrap::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  z-index: -1;
}
.section-title {
  display: inline-block;
  background: var(--bg);
  padding: 0 16px;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

/* Glow Dropzone */
.dropzone-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

.upload-dropzone {
  position: relative;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: rgba(20, 20, 25, 0.8);
  border: 2px dashed rgba(255, 107, 0, 0.4);
  box-shadow: 0 0 40px rgba(255, 69, 0, 0.15), inset 0 0 20px rgba(255, 107, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px;
  overflow: hidden;
}

.upload-dropzone:hover, .upload-dropzone.is-active {
  border-color: var(--accent-end);
  border-style: solid;
  transform: scale(1.05);
  box-shadow: 0 0 60px rgba(255, 69, 0, 0.4), inset 0 0 30px rgba(255, 107, 0, 0.2);
  background: rgba(30, 25, 20, 0.9);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  display: block;
}

.upload-dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
}

.upload-dropzone-meta {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Preview Image within Dropzone */
.preview-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  opacity: 0.9;
  transition: opacity 0.3s;
}

.preview-badge-layer {
  position: absolute;
  bottom: 20px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid rgba(255,255,255,0.2);
  z-index: 10;
}

/* Glass Cards */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Option Cards Grid (Radio Replacements) */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.option-card-label {
  cursor: pointer;
  display: block;
}

.option-card-label input[type="radio"] {
  display: none;
}

.option-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 16px;
  text-align: center;
  transition: all 0.2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.option-icon {
  font-size: 2.2rem;
}

.option-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

.option-desc {
  font-size: 0.85rem;
  color: var(--muted);
}

.option-card-label:hover .option-card {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.option-card-label input[type="radio"]:checked + .option-card {
  background: rgba(255, 107, 0, 0.1);
  border-color: var(--accent-end);
  box-shadow: 0 0 20px rgba(255, 69, 0, 0.15);
}

.option-card-label input[type="radio"]:checked + .option-card .option-title {
  color: var(--accent-end);
}

/* Textarea input */
.input-field {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-field:focus {
  outline: none;
  border-color: var(--accent-end);
  box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.2);
}

/* Gradient Button */
.submit-dock {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.primary-button {
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  border: none;
  border-radius: 999px;
  padding: 18px 48px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(255, 69, 0, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-button:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 15px 40px rgba(255, 69, 0, 0.6);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Tabbar */
.miniapp-tabbar {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  padding: 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
  z-index: 100;
}

.tab-button {
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s;
}

.tab-button:hover {
  color: #fff;
}

.tab-button.is-active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Result Card */
.result-card {
  padding: 24px;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.result-card.result-card-live {
  border-color: rgba(255, 107, 0, 0.4);
  background: linear-gradient(180deg, rgba(30, 20, 15, 0.9), rgba(15, 15, 20, 0.9));
  box-shadow: var(--glow);
}

.result-card-empty {
  text-align: center;
  padding: 60px 20px;
}
.result-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 12px;
}

.result-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

/* History */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.history-item {
  background: rgba(24, 24, 28, 0.5);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  transition: transform 0.2s;
}
.history-item:hover {
  transform: translateY(-2px);
  background: var(--bg-card);
  border-color: rgba(255, 255, 255, 0.15);
}
.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.history-model {
  background: rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
}
.history-token {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 4px 0 0;
}
.history-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.history-copy {
  line-height: 1.6;
}

/* Animations */
.cyber-spinner {
  width: 60px;
  height: 60px;
  margin: 0 auto;
  border: 4px solid rgba(255, 107, 0, 0.2);
  border-top-color: var(--accent-end);
  border-left-color: var(--accent-start);
  border-radius: 50%;
  animation: cyberSpin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  box-shadow: 0 0 20px rgba(255, 69, 0, 0.4);
}

@keyframes cyberSpin {
  0% { transform: rotate(0deg); border-width: 4px; }
  50% { transform: rotate(180deg); border-width: 8px; }
  100% { transform: rotate(360deg); border-width: 4px; }
}

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

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

/* Helper Classes used in review_result */
.result-meta { color: var(--muted); font-size: 0.85rem; }
.review-response { font-size: 1.05rem; line-height: 1.7; }
.review-response p { margin: 0 0 12px; }

/* =========================================
   EXTREME R18 CYBERPUNK EFFECTS
   ========================================= */

/* 1. Custom Pervert Cursor (Desktop Only) */
@media (hover: hover) and (pointer: fine) {
  button, a, label, .upload-dropzone, .tab-button {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="font-size: 24px"><text y="24">👅</text></svg>'), pointer !important;
  }
  body {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" style="font-size: 24px"><text y="24">👁️</text></svg>'), auto;
  }
}

/* 2. Age Gate Overlay */
.age-gate-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  transition: opacity 0.5s ease, visibility 0.5s;
}
.age-gate-content {
  border: 2px solid red;
  background: rgba(40, 0, 0, 0.8);
  padding: 40px;
  box-shadow: 0 0 40px rgba(255, 0, 0, 0.5);
  max-width: 600px;
}
.age-gate-content p {
  color: #ffaaaa;
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 20px 0 40px;
}

/* 3. Glitch Text */
.glitch-text {
  color: red;
  font-size: 2.5rem;
  font-weight: 900;
  text-transform: uppercase;
  position: relative;
  text-shadow: 0.05em 0 0 rgba(255,0,0,0.75), -0.025em -0.05em 0 rgba(0,255,0,0.75), 0.025em 0.05em 0 rgba(0,0,255,0.75);
  animation: glitch 500ms infinite;
}
@keyframes glitch {
  0% { text-shadow: 0.05em 0 0 rgba(255,0,0,0.75), -0.05em -0.025em 0 rgba(0,255,0,0.75), -0.025em 0.05em 0 rgba(0,0,255,0.75); }
  14% { text-shadow: 0.05em 0 0 rgba(255,0,0,0.75), -0.05em -0.025em 0 rgba(0,255,0,0.75), -0.025em 0.05em 0 rgba(0,0,255,0.75); }
  15% { text-shadow: -0.05em -0.025em 0 rgba(255,0,0,0.75), 0.025em 0.025em 0 rgba(0,255,0,0.75), -0.05em -0.05em 0 rgba(0,0,255,0.75); }
  49% { text-shadow: -0.05em -0.025em 0 rgba(255,0,0,0.75), 0.025em 0.025em 0 rgba(0,255,0,0.75), -0.05em -0.05em 0 rgba(0,0,255,0.75); }
  50% { text-shadow: 0.025em 0.05em 0 rgba(255,0,0,0.75), 0.05em 0 0 rgba(0,255,0,0.75), 0 -0.05em 0 rgba(0,0,255,0.75); }
  99% { text-shadow: 0.025em 0.05em 0 rgba(255,0,0,0.75), 0.05em 0 0 rgba(0,255,0,0.75), 0 -0.05em 0 rgba(0,0,255,0.75); }
  100% { text-shadow: -0.025em 0 0 rgba(255,0,0,0.75), -0.025em -0.025em 0 rgba(0,255,0,0.75), -0.025em -0.05em 0 rgba(0,0,255,0.75); }
}

/* 4. HTMX Request Blood Pulse background */
body.htmx-request::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, transparent 50%, rgba(200, 0, 0, 0.6) 100%);
  animation: bloodPulse 0.8s infinite alternate;
  z-index: 9998;
  pointer-events: none;
}
@keyframes bloodPulse {
  from { opacity: 0.3; box-shadow: inset 0 0 10px red; }
  to { opacity: 1; box-shadow: inset 0 0 100px red; }
}

/* 5. Violent Shake for 5 Stars */
.violent-shake {
  animation: earthquake 0.1s infinite;
}
@keyframes earthquake {
  0% { transform: translate(2px, 1px) rotate(0deg); }
  10% { transform: translate(-1px, -2px) rotate(-1deg); }
  20% { transform: translate(-3px, 0px) rotate(1deg); }
  30% { transform: translate(0px, 2px) rotate(0deg); }
  40% { transform: translate(1px, -1px) rotate(1deg); }
  50% { transform: translate(-1px, 2px) rotate(-1deg); }
  60% { transform: translate(-3px, 1px) rotate(0deg); }
  70% { transform: translate(2px, 1px) rotate(-1deg); }
  80% { transform: translate(-1px, -1px) rotate(1deg); }
  90% { transform: translate(2px, 2px) rotate(0deg); }
  100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake-btn {
  animation: earthquake 0.2s infinite;
  background: linear-gradient(90deg, #aa0000, #ff0000);
}

/* 6. Universal Touch/Click Tactile Feedback (打击感优化) */
* {
  -webkit-tap-highlight-color: transparent;
}
button:active, 
.primary-button:active, 
.tab-button:active, 
.upload-dropzone:active {
  transform: scale(0.92) !important;
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.4) !important;
}

/* 7. Perverted Screen Touch Particles (无节操屏幕触摸爆炸) */
.pervert-ripple {
  position: fixed;
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, rgba(255,0,85,0.7) 0%, rgba(255,0,85,0) 70%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1);
  z-index: 10000;
  animation: rippleExplode 0.6s ease-out forwards;
}
@keyframes rippleExplode {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(16); opacity: 0; }
}

.pervert-splash {
  position: fixed;
  font-size: 1.6rem;
  pointer-events: none;
  z-index: 10001;
  transform: translate(-50%, -50%);
  /* 通过 CSS 变量接收来自 JS 的随机抛物线轨迹 */
  animation: splashFly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}
@keyframes splashFly {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(0.4); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) rotate(var(--r)) scale(1.4); opacity: 0; }
}

/* =========================================
   MOBILE RESPONSIVE TWEAKS (手机端优化)
   ========================================= */
@media (max-width: 600px) {
  .page-shell {
    padding: 20px 0 120px;
    width: calc(100% - 24px);
  }
  
  /* 缩小上传区盘面 */
  .upload-dropzone {
    width: 200px;
    height: 200px;
    padding: 12px;
  }
  .upload-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
  }
  .upload-dropzone-title {
    font-size: 0.95rem;
  }
  
  /* 防线层字体与内边距调整 */
  .age-gate-content {
    padding: 24px 16px;
    margin: 0 16px;
  }
  .glitch-text {
    font-size: 1.6rem;
  }
  .age-gate-content p {
    font-size: 0.95rem;
  }
  .primary-button {
    padding: 12px 24px;
    font-size: 1.05rem;
    width: 100%;
    justify-content: center;
  }
  
  /* 底部 Tabbar 排版挤压处理 */
  .miniapp-tabbar {
    width: calc(100% - 32px);
    justify-content: space-between;
    padding: 8px 12px;
  }
  .tab-button {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}
