/* ================================================================
   AI 读心术 v3 — mind.css
   Matisse Cut-Outs: Jazz / La Gerbe / Blue Nude / Icarus
   Bold opaque shapes, broken axis, paper collage
   v3: Quiz page = living Matisse canvas, hand-drawn shapes,
       desktop dual-column, unified button palette
   ================================================================ */

:root {
  --m-white:   #FFFEF8;
  --m-cream:   #F5EDE0;
  --m-cobalt:  #1B3A8C;
  --m-red:     #E63946;
  --m-coral:   #FF6B4A;
  --m-yellow:  #FFD23F;
  --m-green:   #2D936C;
  --m-black:   #1A1A1A;
  --m-deep:    #0F1F52;
  --m-serif:   'Songti SC', 'Noto Serif CJK SC', 'Source Han Serif SC', Georgia, serif;
  --m-sans:    -apple-system, 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

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

body.mind-page {
  background: var(--m-white);
  color: var(--m-black);
  font-family: var(--m-sans);
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ──────────────────────────────────────── */
.mind-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(27, 58, 140, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.3s ease;
}

.mind-nav.nav-light {
  background: rgba(27, 58, 140, 0.92);
}
.mind-nav.nav-light .mind-nav-logo { color: var(--m-white); }
.mind-nav.nav-light .mind-nav-back { color: var(--m-yellow); }

.mind-nav-logo {
  font-family: var(--m-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--m-white);
  text-decoration: none;
}
.mind-nav-logo:hover { opacity: 0.8; }

.mind-nav-back {
  font-size: 0.8rem;
  color: var(--m-yellow);
  text-decoration: none;
  font-weight: 500;
}
.mind-nav-back:hover { text-decoration: underline; }

/* ── HERO ─────────────────────────────────────── */
.mind-hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--m-cobalt);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 24px 40px;
}

.mind-hero-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.mind-hero-shape { position: absolute; }

/* Hero shapes are now SVG elements positioned by JS, styled here */
.mind-hero-shape {
  position: absolute;
  pointer-events: none;
}

/* ── Hero text ────────────────────────────────── */
.mind-hero-content {
  position: relative;
  z-index: 10;
  max-width: 500px;
}

.mind-hero-title {
  font-family: var(--m-serif);
  font-size: clamp(3.5rem, 14vw, 7rem);
  font-weight: 900;
  line-height: 0.95;
  color: var(--m-white);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  text-align: left;
}

.mind-hero-subtitle {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: clamp(0.65rem, 1.8vw, 0.85rem);
  color: var(--m-yellow);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  font-style: italic;
  margin-bottom: 16px;
  text-align: left;
}

.mind-hero-desc {
  font-size: clamp(0.9rem, 2.4vw, 1.1rem);
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.82);
  max-width: 300px;
  text-align: left;
  margin-bottom: 28px;
}

/* Start button — papercut slab shape, no shadow */
.mind-start-btn {
  display: inline-block;
  background: var(--m-red);
  color: var(--m-white);
  font-family: var(--m-serif);
  font-size: clamp(1.05rem, 2.8vw, 1.25rem);
  font-weight: 900;
  padding: 18px 48px;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  letter-spacing: 0.08em;
  /* clip-path set by JS via papercutPath */
}
.mind-start-btn:hover {
  transform: translate(-2px, -3px) rotate(-0.5deg);
  filter: brightness(1.1);
}
.mind-start-btn:active {
  transform: translate(1px, 1px) rotate(0.3deg);
}

/* ── GAME — v3: Matisse canvas, not quiz app ──── */
.mind-game {
  display: none;
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--m-cobalt);
  overflow: hidden;
}
.mind-game.active { display: flex; flex-direction: column; }

/* Collage canvas — full bleed behind content */
.mind-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.mind-cutout {
  position: absolute;
  transition: all 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
  transform: scale(0.2) rotate(45deg);
}
.mind-cutout.placed {
  opacity: 1;
  transform: scale(1) rotate(var(--rot, 0deg));
}

/* Game UI overlay — v3: centered on mobile, left-column on desktop */
.mind-game-content {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 24px 80px;
}

/* Progress — v3: hand-lettered style on paper strip */
.mind-progress {
  position: absolute;
  top: 56px;
  right: 20px;
  z-index: 20;
}

.mind-step-label {
  display: inline-block;
  background: var(--m-yellow);
  padding: 6px 16px 5px;
  font-family: var(--m-serif);
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--m-black);
  letter-spacing: 0.05em;
}

.mind-step-num {
  font-family: var(--m-serif);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--m-white);
  opacity: 0;
  font-style: italic;
  position: absolute;
  pointer-events: none;
}

.mind-step-bar,
.mind-step-fill { display: none; }

.mind-loading {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--m-cobalt);
  border-top-color: var(--m-yellow);
  clip-path: circle(50%);
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

/* Question — v3: white paper label beneath text, bold serif */
.mind-bubble {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 32px;
  max-width: 88%;
  position: relative;
}
.mind-bubble::after,
.mind-bubble::before { display: none; }

/* Paper backing for question text — papercut slab, clip-path set by JS */
.mind-paper-label {
  position: absolute;
  inset: -12px -16px -10px -14px;
  background: var(--m-white);
  z-index: -1;
  /* clip-path set by JS via papercutPath slab */
}

.mind-bubble-text {
  font-family: var(--m-serif);
  font-size: clamp(1.5rem, 5.5vw, 2.4rem);
  font-weight: 900;
  line-height: 1.4;
  color: var(--m-black);
  display: block;
  opacity: 0;
  animation: fadeInUp 0.4s ease forwards;
}

/* Answer buttons — v3: irregular cutout shapes, unified white text */
.mind-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 380px;
}

.mind-btn {
  flex: 1 1 80px;
  min-width: 80px;
  padding: 18px 14px;
  font-family: var(--m-serif);
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  font-weight: 900;
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, filter 0.15s ease;
  color: var(--m-white);
  /* clip-path set by JS via papercutPath slab */
}
.mind-btn:hover {
  transform: translate(-2px, -2px) rotate(-0.8deg);
  filter: brightness(1.1);
}
.mind-btn:active {
  transform: translate(1px, 1px) rotate(0.3deg);
}
.mind-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.mind-btn-yes {
  background: var(--m-red);
  color: var(--m-white);
}
.mind-btn-no {
  background: var(--m-black);
  color: var(--m-white);
}
.mind-btn-unsure {
  background: var(--m-coral);
  color: var(--m-white);
}

/* ── RESULT ───────────────────────────────────── */
.mind-result {
  display: none;
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--m-cobalt);
  overflow: hidden;
}
.mind-result.active { display: block; }

.mind-result-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.mind-result-content {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 24px 80px;
}

.mind-result-title {
  font-family: var(--m-serif);
  font-size: clamp(1.6rem, 6vw, 2.8rem);
  font-weight: 900;
  color: var(--m-yellow);
  margin-bottom: 16px;
}

.mind-result-guess {
  font-family: var(--m-serif);
  font-size: clamp(2rem, 8vw, 4rem);
  font-weight: 900;
  color: var(--m-white);
  margin-bottom: 20px;
  line-height: 1.1;
}

.mind-result-text {
  font-size: 1rem;
  line-height: 1.8;
  max-width: 420px;
  color: var(--m-white);
  opacity: 0.8;
  margin-bottom: 12px;
}

.mind-result-steps {
  font-family: var(--m-serif);
  font-size: 0.85rem;
  color: var(--m-yellow);
  margin-bottom: 32px;
  font-style: italic;
  opacity: 0.6;
}

.mind-reveal-input-row {
  display: flex;
  gap: 8px;
  margin: 16px 0 8px;
  max-width: 340px;
  width: 100%;
}

.mind-reveal-frame {
  flex: 1;
  background: var(--m-white);
  padding: 2px;
  /* clip-path set by JS via papercutPath slab */
}

.mind-reveal-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 1rem;
  border: none;
  background: transparent;
  color: var(--m-black);
  font-family: var(--m-sans);
  font-weight: 700;
  outline: none;
}
.mind-reveal-input::placeholder { color: rgba(26, 26, 26, 0.4); }
.mind-reveal-input:focus { outline: none; }

.mind-reveal-submit {
  padding: 12px 20px;
  background: var(--m-red);
  color: var(--m-white);
  font-family: var(--m-serif);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.15s;
  /* clip-path set by JS via papercutPath slab */
}
.mind-reveal-submit:hover { transform: translate(-1px, -1px); }

.mind-replay-btn {
  display: inline-block;
  background: var(--m-coral);
  color: var(--m-white);
  font-family: var(--m-serif);
  font-size: 1rem;
  font-weight: 900;
  padding: 16px 40px;
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: transform 0.15s ease;
  margin-top: 8px;
  /* clip-path set by JS via papercutPath slab */
}
.mind-replay-btn:hover {
  transform: translate(-2px, -2px) rotate(-0.5deg);
}

/* ── Footer ───────────────────────────────────── */
.mind-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  text-align: center;
  padding: 16px 0;
  font-size: 0.72rem;
  color: var(--m-white);
  opacity: 0.25;
}
.mind-footer a {
  color: var(--m-yellow);
  text-decoration: none;
}
.mind-footer a:hover { text-decoration: underline; }

/* ── Animations ───────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin { to { transform: rotate(360deg); } }

.mind-canvas.reveal .mind-cutout {
  transition: all 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Desktop: true dual-column layout ─────────── */
@media (min-width: 768px) {
  .mind-hero {
    padding: 0 60px 60px;
  }
  .mind-hero-content { max-width: 520px; }

  .mind-nav { padding: 0 32px; }

  /* v3: Game becomes dual-column */
  .mind-game.active {
    display: flex;
    flex-direction: row;
  }

  .mind-game-content {
    padding: 80px 48px;
    width: 42%;
    min-width: 360px;
    max-width: 520px;
    min-height: 100vh;
    min-height: 100dvh;
    flex-shrink: 0;
    z-index: 10;
  }

  .mind-canvas {
    /* Canvas fills the right side and can bleed left */
    left: 38%;
    right: 0;
    width: 62%;
  }

  .mind-bubble-text { font-size: clamp(1.6rem, 2.6vw, 2.4rem); }
  .mind-buttons { max-width: 380px; }
  .mind-btn { padding: 18px 20px; }

  .mind-result-content { padding: 80px 60px; }
  
  .mind-progress {
    position: relative;
    top: auto;
    right: auto;
    margin-bottom: 24px;
  }
}

@media (min-width: 1200px) {
  .mind-hero { padding: 0 100px 80px; }
  .mind-hero-content { max-width: 580px; }
  .mind-game-content {
    padding: 80px 64px;
    width: 38%;
    max-width: 560px;
  }
  .mind-canvas {
    left: 35%;
    width: 65%;
  }
  .mind-result-content { padding: 80px 100px; }
}

/* ── Small phones ─────────────────────────────── */
@media (max-width: 380px) {
  .mind-hero { padding: 0 16px 32px; }
  .mind-buttons { gap: 8px; }
  .mind-btn { padding: 14px 8px; font-size: 0.88rem; min-width: 70px; }
  .mind-game-content { padding: 56px 16px 60px; }
  .mind-step-label { font-size: 0.95rem; padding: 5px 12px 4px; }
}
