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

/* ── AOKO palette ── */
:root {
  --midnight: #05060f;
  --accent:   #3a6fc4;
  --bright:   #6fa3f7;
  --star:     #a8c4ff;
  --text:     #c8d8f0;
  --muted:    #4a6080;
  --white:    #e8f0ff;
}

/* ── YUMA palette ── */
.alice-active {
  --midnight: #07090a;
  --accent:   #4a7c3f;
  --bright:   #8fbc6a;
  --star:     #b8d4a0;
  --text:     #ccdcc0;
  --muted:    #4a6040;
  --white:    #e4f0dc;
}

html, body {
  height: 100%;
  background: var(--midnight);
  color: var(--text);
  font-family: 'Cormorant Garamond', 'Noto Serif JP', serif;
  overflow-x: hidden;
  /* 禁用所有元素的系统鼠标 */
  cursor: none;
  transition: background 0.8s, color 0.6s;
}

/* 所有子元素也禁用系统鼠标 */
*, *::before, *::after {
  cursor: none !important;
}

/* ── Custom cursor ── */
.cursor {
  position: fixed; width: 8px; height: 8px;
  background: var(--bright); border-radius: 50%;
  pointer-events: none; z-index: 9999;
  transform: translate(-50%,-50%);
  mix-blend-mode: screen;
  transition: background 0.6s, width 0.2s, height 0.2s;
}
.cursor-ring {
  position: fixed; width: 28px; height: 28px;
  border: 1px solid rgba(111,163,247,0.35); border-radius: 50%;
  pointer-events: none; z-index: 9998;
  transform: translate(-50%,-50%);
  transition: border-color 0.6s;
}
.alice-active .cursor-ring { border-color: rgba(143,188,106,0.35); }

/* ── Ink transition canvas ── */
#ink-canvas {
  position: fixed; inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0;
}
#ink-canvas.active { pointer-events: all; opacity: 1; }

/* ── Particles ── */
#particles { position: fixed; inset: 0; z-index: 0; }

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  opacity: 0.4; pointer-events: none; z-index: 1;
}

.glow-bg {
  position: fixed; width: 700px; height: 700px;
  border-radius: 50%; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  pointer-events: none; z-index: 1;
  animation: pulse 6s ease-in-out infinite;
  background: radial-gradient(circle, rgba(58,111,196,0.12) 0%, transparent 70%);
  transition: background 1s;
}
.alice-active .glow-bg {
  background: radial-gradient(circle, rgba(74,124,63,0.14) 0%, transparent 70%);
}
@keyframes pulse {
  0%,100% { opacity:.6; transform:translate(-50%,-50%) scale(1); }
  50%      { opacity:1;  transform:translate(-50%,-50%) scale(1.08); }
}

/* ── Pages ── */
.page {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
  padding: 60px;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95); /* 离场时略微缩小 */
  filter: blur(8px);      /* 离场时模糊 */
  transition: opacity 0.4s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
}
.page.active { 
  opacity: 1; 
  pointer-events: all; 
  transform: scale(1);    /* 入场恢复正常大小 */
  filter: blur(0);        /* 入场清晰 */
}

/* ── Portrait area ── */
.portrait-area {
  display: flex; flex-direction: column;
  align-items: flex-start; justify-content: flex-end;
  padding-bottom: 40px;
}
#aoko-page .portrait-area { grid-column:1; grid-row:1; }
#alice-page .portrait-area { grid-column:2; grid-row:1; align-items:flex-end; }

.portrait-frame { width: 300px; }

.portrait-img {
  width: 100%; max-height: 480px;
  object-fit: contain; object-position: bottom;
  display: block;
  filter: brightness(0.92) contrast(1.05) saturate(0.88);
  mask-image:
    linear-gradient(to top,  transparent 0%, black 18%, black 84%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 8%,  black 92%, transparent 100%);
  mask-composite: intersect;
  -webkit-mask-image:
    linear-gradient(to top,  transparent 0%, black 18%, black 84%, transparent 100%),
    linear-gradient(to right, transparent 0%, black 8%,  black 92%, transparent 100%);
  -webkit-mask-composite: source-in;
}

/* ── Big kanji below portrait ── */
.portrait-kanji {
  font-family: 'Noto Serif JP', serif;
  font-weight: 200;
  font-size: 48px;
  letter-spacing: 0.25em;
  /* 初始极淡，是彩蛋的一部分 */
  color: rgba(111,163,247,0.18);
  margin-top: 14px;
  position: relative;
  display: inline-block;
  user-select: none;
  transition: color 0.4s;
}
.alice-active .portrait-kanji {
  color: rgba(143,188,106,0.18);
}

/* ── Content area ── */
.content-area {
  display: flex; flex-direction: column; justify-content: center;
}
#aoko-page .content-area { grid-column:2; grid-row:1; padding-left:60px; }
#alice-page .content-area { grid-column:1; grid-row:1; padding-right:60px; align-items:flex-end; text-align:right; }

.label {
  font-family: 'Space Mono', monospace;
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 20px;
  transition: color 0.6s;
}

/* ── Name — 青/有珠 trigger ── */
.name-jp {
  font-family: 'Noto Serif JP', serif;
  font-weight: 200; font-size: clamp(32px,4vw,50px);
  letter-spacing: 0.15em; color: var(--white);
  line-height: 1.2; margin-bottom: 8px;
  /* 用word-spacing和letter-spacing精确控制，不用span插入空隙 */
  transition: color 0.6s;
}
/* trigger span — 不改变任何排版，只增加点击事件 */
.name-trigger {
  display: inline;
  position: relative;
}

.name-en {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300; font-style: italic;
  font-size: clamp(15px,2vw,22px);
  color: var(--muted); letter-spacing: 0.2em;
  margin-bottom: 44px;
  transition: color 0.6s;
}
.divider {
  width: 60px; height: 1px; margin-bottom: 32px;
  background: linear-gradient(to right, var(--accent), transparent);
  transition: background 0.6s;
}
#alice-page .divider {
  background: linear-gradient(to left, var(--accent), transparent);
  align-self: flex-end;
}
.quote {
  font-family: 'IM Fell English', serif;
  font-style: italic; font-size: clamp(14px,1.55vw,17px);
  line-height: 2; color: var(--text);
  max-width: 360px; margin-bottom: 44px;
  position: relative; padding-left: 20px;
  transition: color 0.6s;
}
.quote::before {
  content: ''; position: absolute;
  left:0; top:4px; bottom:4px; width:1px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  transition: background 0.6s;
}
#alice-page .quote { padding-left:0; padding-right:20px; align-self:flex-end; }
#alice-page .quote::before { left:auto; right:0; }

.meta { display:flex; flex-direction:column; gap:10px; margin-bottom:46px; }
.meta-item { display:flex; align-items:baseline; gap:14px; font-size:12px; }
#alice-page .meta-item { flex-direction:row-reverse; }
.meta-key {
  font-family: 'Space Mono', monospace; font-size:9px;
  letter-spacing:0.25em; color:var(--muted);
  min-width:70px; text-transform:uppercase;
  transition: color 0.6s;
}
.meta-val {
  color: var(--star); font-weight:300; letter-spacing:0.05em;
  transition: color 0.6s;
}

/* alias trigger — 无悬停提示，无下划线，只是可点击 */
.alias-trigger {
  position: relative;
}

.links { display:flex; flex-wrap:wrap; gap:10px; }
#alice-page .links { justify-content:flex-end; }
.link-btn {
  font-family: 'Space Mono', monospace; font-size:10px;
  letter-spacing:0.2em; text-transform:uppercase;
  color:var(--bright); text-decoration:none;
  padding:9px 18px;
  border:1px solid rgba(111,163,247,0.2);
  background:rgba(15,31,74,0.2);
  position:relative; overflow:hidden;
  transition:color 0.3s, border-color 0.3s;
}
#alice-page .link-btn {
  border-color: rgba(143,188,106,0.2);
  background: rgba(20,31,16,0.25);
}
.link-btn::before {
  content:''; position:absolute; inset:0;
  background:rgba(58,111,196,0.13);
  transform:translateX(-100%);
  transition:transform 0.3s cubic-bezier(0.16,1,0.3,1);
}
#alice-page .link-btn::before { background:rgba(74,124,63,0.16); }
.link-btn:hover { color:var(--white); border-color:var(--accent); }
.link-btn:hover::before { transform:translateX(0); }

/* ── Bottom bar ── */
.bottom-bar {
  grid-column:1/-1; grid-row:2;
  display:flex; justify-content:space-between; align-items:flex-end;
  padding-top:32px;
  border-top:1px solid rgba(111,163,247,0.07);
  transition: border-color 0.6s;
}
.alice-active .bottom-bar { border-top-color: rgba(143,188,106,0.07); }
.origin {
  font-family:'Space Mono',monospace; font-size:9px;
  letter-spacing:0.2em; color:var(--muted); text-transform:uppercase;
  transition: color 0.6s;
}
.sigil {
  font-family:'Noto Serif JP',serif; font-size:24px;
  font-weight:200; letter-spacing:0.3em;
  color:rgba(111,163,247,0.15);
  transition: color 0.6s;
}
.alice-active .sigil { color:rgba(143,188,106,0.15); }

/* ── Flash on click — 只在点击的那个元素上 ── */
.flash-magic {
  animation: magicFlash 0.8s ease forwards;
}
@keyframes magicFlash {
  0%   { text-shadow: none; }
  30%  { text-shadow: 0 0 14px #6fa3f7, 0 0 28px #3a6fc4; }
  60%  { text-shadow: 0 0 22px #a8c4ff, 0 0 44px #6fa3f7; }
  100% { text-shadow: none; }
}
.alice-active .flash-magic {
  animation: magicFlashGreen 0.8s ease forwards;
}
@keyframes magicFlashGreen {
  0%   { text-shadow: none; }
  30%  { text-shadow: 0 0 14px #8fbc6a, 0 0 28px #4a7c3f; }
  60%  { text-shadow: 0 0 22px #b8d4a0, 0 0 44px #8fbc6a; }
  100% { text-shadow: none; }
}

/* ── Page-in animations ── */
.anim-left    { opacity:0; animation: aLeft  1.4s cubic-bezier(0.16,1,0.3,1) 0.15s forwards; }
.anim-right   { opacity:0; animation: aRight 1.4s cubic-bezier(0.16,1,0.3,1) 0.15s forwards; }
.anim-content { opacity:0; animation: aUp    1.4s cubic-bezier(0.16,1,0.3,1) 0.35s forwards; }
.anim-up      { opacity:0; animation: aUp    1.2s ease                        0.55s forwards; }
@keyframes aLeft  { from{opacity:0;transform:translateX(-28px)} to{opacity:1;transform:none} }
@keyframes aRight { from{opacity:0;transform:translateX( 28px)} to{opacity:1;transform:none} }
@keyframes aUp    { from{opacity:0;transform:translateY(18px)}  to{opacity:1;transform:none} }

/* 确保动画在触发时不会冲突 */
.anim-left, .anim-right, .anim-content, .anim-up {
  will-change: transform, opacity;
}

/* ══════════════════════════════════════
   MOBILE ≤ 768px
   上下布局，fixed全屏，不可滚动，全部可见
══════════════════════════════════════ */
@media (max-width: 768px) {

  /* 还原系统鼠标（触摸屏） */
  *, *::before, *::after { cursor: auto !important; }
  .cursor, .cursor-ring  { display: none; }

  /* body 不滚动 */
  body { overflow: hidden; height: 100%; }

  /* 页面：fixed全屏，单列上下 */
  .page {
    position: fixed; inset: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 14px;
    gap: 0;
    transform: none;
    filter: none;
    transition: opacity 0.4s ease;
  }
  .page.active { transform: none; filter: none; }

  /* ── 图片区：flex-shrink控制，占剩余空间的上半 ── */
  .portrait-area {
    grid-column: unset; grid-row: unset;
    order: 1;
    flex: 0 0 34%;        /* 占34%高度 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 0;
  }
  #alice-page .portrait-area { align-items: center; }

  .portrait-frame {
    width: auto;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }

  .portrait-img {
    height: 100%;
    width: auto;
    max-width: 60vw;
    object-fit: contain;
    object-position: bottom center;
    filter: brightness(0.88) contrast(1.05) saturate(0.85);
    mask-image:
      linear-gradient(to top,  transparent 0%, black 12%, black 88%, transparent 100%),
      linear-gradient(to right, transparent 0%, black 5%,  black 95%, transparent 100%);
    -webkit-mask-image:
      linear-gradient(to top,  transparent 0%, black 12%, black 88%, transparent 100%),
      linear-gradient(to right, transparent 0%, black 5%,  black 95%, transparent 100%);
    mask-composite: intersect;
    -webkit-mask-composite: source-in;
  }

  /* kanji 脱离图片区，独立作为图文间隔层 */
  .portrait-kanji {
    position: static;
    transform: none;
    order: 2;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: clamp(40px, 12vw, 60px);
    letter-spacing: 0.4em;
    padding: 4px 0;
    margin: 0;
    white-space: nowrap;
  }

  /* ── 文字区：居中，占中间主体 ── */
  .content-area {
    grid-column: unset; grid-row: unset;
    order: 3;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    text-align: left;
    padding: 10px 4px 0;
    overflow: hidden;
  }
  #alice-page .content-area {
    padding-right: 4px;
    align-items: flex-start;
    text-align: left;
  }

  /* 字号紧凑化，保证全部可见 */
  .label     { font-size: 8px; letter-spacing: 0.2em; margin-bottom: 6px; }
  .name-jp   { font-size: clamp(22px, 6.5vw, 32px); letter-spacing: 0.08em; margin-bottom: 2px; line-height: 1.15; }
  .name-en   { font-size: clamp(11px, 3.2vw, 15px); margin-bottom: 10px; }
  .divider   { margin-bottom: 10px; width: 40px;
               background: linear-gradient(to right, var(--accent), transparent); }
  #alice-page .divider {
    background: linear-gradient(to right, var(--accent), transparent);
    align-self: flex-start;
  }
  .quote {
    font-size: clamp(11px, 3vw, 14px);
    line-height: 1.7;
    max-width: 100%;
    margin-bottom: 10px;
    padding-left: 12px; padding-right: 0;
    align-self: auto;
  }
  .quote::before { left:0; right:auto; }
  #alice-page .quote { padding-left:12px; padding-right:0; align-self:auto; }
  #alice-page .quote::before { left:0; right:auto; }

  .meta { gap: 5px; margin-bottom: 10px; }
  .meta-item { gap: 8px; }
  #alice-page .meta-item { flex-direction: row; }
  .meta-key  { min-width: 48px; font-size: 7px; letter-spacing: 0.18em; }
  .meta-val  { font-size: 10px; }

  .links { gap: 6px; flex-wrap: wrap; }
  #alice-page .links { justify-content: flex-start; }
  .link-btn { font-size: 8px; padding: 7px 11px; letter-spacing: 0.1em; }

  /* ── bottom bar：固定在底部，一排不换行 ── */
  .bottom-bar {
    grid-column: unset; grid-row: unset;
    order: 3;
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid rgba(111,163,247,0.07);
    gap: 8px;
  }
  .origin { font-size: 7px; letter-spacing: 0.13em; flex: 1; }
  .sigil  { font-size: 14px; letter-spacing: 0.18em; white-space: nowrap; flex-shrink: 0; }

  /* 入场动画简化为纯淡入 */
  .anim-left, .anim-right, .anim-content, .anim-up {
    animation-name: aUp;
  }
}