:root {
  --mt-navy: #07101e;
  --mt-panel: rgba(10, 19, 35, .76);
  --mt-panel-strong: rgba(8, 17, 31, .9);
  --mt-gold: #dec294;
  --mt-gold-strong: #fff0ce;
  --mt-line: rgba(231, 193, 133, .54);
  --mt-copy: #e8dfd0;
}
html.metamorph-open,
html.metamorph-open body { overflow: hidden; }
#metamorphApp {
  position: fixed;
  inset: 0 0 0 200px;
  z-index: 85;
  overflow: hidden;
  color: var(--mt-copy);
  background: var(--mt-navy);
  font-family: "STKaiti", "KaiTi", "Noto Serif SC", serif;
}
#metamorphApp *,
#metamorphApp *::before,
#metamorphApp *::after { box-sizing: border-box; }
#metamorphApp[hidden],
#metamorphApp [hidden] { display: none !important; }
.mt-screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: #07101e;
  background-image: linear-gradient(180deg, rgba(5, 11, 24, .2), rgba(5, 10, 20, .16) 55%, rgba(4, 9, 18, .34)), url("./assets/metamorphosis/cosmic-lake-bg.png");
  background-position: center bottom;
  background-size: cover;
  scrollbar-color: rgba(223, 184, 126, .35) transparent;
  scrollbar-width: thin;
}
.mt-screen::before {
  content: "";
  position: fixed;
  inset: 0 0 0 200px;
  pointer-events: none;
  background: radial-gradient(ellipse 62% 70% at 50% 32%, transparent 35%, rgba(2, 7, 17, .32) 100%);
}
.mt-shell {
  position: relative;
  width: min(1020px, calc(100% - 56px));
  min-height: 100%;
  margin: 0 auto;
  padding: 28px 0 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.mt-close {
  position: fixed;
  z-index: 10;
  top: 24px;
  right: 26px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--mt-line);
  border-radius: 50%;
  color: var(--mt-gold-strong);
  background: rgba(6, 14, 28, .78);
  box-shadow: 0 0 14px rgba(227, 183, 121, .12);
  cursor: pointer;
  backdrop-filter: blur(12px);
}
.mt-close:hover,
.mt-close:focus-visible { border-color: #ffe0ac; box-shadow: 0 0 20px rgba(234, 196, 139, .42); }
.mt-heading { position: relative; margin: 5px auto 0; text-align: center; }
.mt-kicker {
  position: relative;
  margin: 0;
  color: var(--mt-gold-strong);
  font: 400 clamp(3.2rem, 5.5vw, 5.3rem)/1.18 "STKaiti", "KaiTi", serif;
  letter-spacing: .18em;
  text-indent: .18em;
  text-shadow: 0 0 12px rgba(249, 218, 173, .58), 0 0 35px rgba(238, 183, 113, .35);
}
.mt-heading::after {
  content: "";
  display: block;
  width: min(370px, 62vw);
  height: 1px;
  margin: 11px auto 0;
  background: linear-gradient(90deg, transparent, rgba(241, 207, 151, .8), transparent);
  box-shadow: 0 0 12px rgba(242, 204, 141, .45);
}
.mt-subtitle {
  margin: 10px 0 0;
  color: #e9cfaa;
  font: 400 clamp(.92rem, 1.35vw, 1.16rem)/1.6 "STKaiti", "KaiTi", serif;
  letter-spacing: .18em;
  text-shadow: 0 2px 12px #020714;
}
.mt-stage-track {
  --mt-art-size: 78px;
  position: relative;
  width: min(880px, 100%);
  margin: 26px auto 32px;
  display: grid;
  grid-template-columns:repeat(7,minmax(0,1fr));
  gap: 8px;
}
.mt-stage-track::before {
  content: "";
  position: absolute;
  top: calc(21px + var(--mt-art-size) + 16px);
  left: 6.8%;
  right: 6.8%;
  height: 2px;
  background: linear-gradient(90deg, rgba(239, 198, 133, .96) 0 calc(var(--mt-progress) * 14.285%), rgba(145, 154, 174, .52) calc(var(--mt-progress) * 14.285%) 100%);
  box-shadow: 0 0 8px rgba(237, 199, 138, .3);
}
.mt-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 0;
  border: 0;
  color: #acb2bd;
  background: transparent;
  text-align: center;
  font-family: "STKaiti", "KaiTi", serif;
}
button.mt-stage { cursor: pointer; }
.mt-stage-number {
  height: 21px;
  color: #f3d5a8;
  font-size: 1.07rem;
  line-height: 21px;
  text-shadow: 0 0 9px rgba(255, 218, 161, .36);
}
.mt-stage-art {
  display: block;
  width: var(--mt-art-size);
  height: var(--mt-art-size);
  overflow: hidden;
  border: 1.5px solid rgba(165, 174, 190, .7);
  border-radius: 50%;
  background: #080f1d;
  box-shadow: 0 0 0 4px rgba(4, 9, 19, .54), inset 0 0 14px #020611;
  filter: grayscale(1) brightness(.52) saturate(.42);
  transition: filter .25s, transform .25s, box-shadow .25s, border-color .25s;
}
.mt-stage-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mt-stage-dot {
  display: block;
  width: 10px;
  height: 10px;
  margin-top: 12px;
  border: 1.5px solid rgba(166, 173, 190, .75);
  border-radius: 50%;
  background: #10192b;
  box-shadow: 0 0 0 2px rgba(6, 13, 26, .8);
}
.mt-stage.is-active .mt-stage-art {
  filter: saturate(.92) brightness(.91);
  border-color: #f0d19b;
  box-shadow: 0 0 0 4px rgba(6, 13, 27, .72), 0 0 18px rgba(239, 193, 120, .52);
}
.mt-stage.is-active .mt-stage-dot {
  border-color: #fff0c4;
  background: #f6ce8d;
  box-shadow: 0 0 0 3px rgba(7, 14, 29, .8), 0 0 13px rgba(250, 207, 138, .8);
}
.mt-stage.is-current .mt-stage-art,
.mt-stage.is-selected .mt-stage-art {
  transform: scale(1.055);
  border-color: #ffe5ae;
  box-shadow: 0 0 0 4px rgba(9, 17, 31, .75), 0 0 26px rgba(251, 207, 142, .75);
}
button.mt-stage:hover .mt-stage-art,
button.mt-stage:focus-visible .mt-stage-art { transform: scale(1.08); border-color: #fff2c5; }
.mt-section-title {
  width: 100%;
  margin: 0 0 16px;
  color: var(--mt-gold-strong);
  font: 400 clamp(1.2rem, 2vw, 1.5rem)/1.3 "STKaiti", "KaiTi", serif;
  letter-spacing: .13em;
  text-align: center;
  text-shadow: 0 0 14px rgba(252, 217, 164, .42);
}
.mt-section-title span { display: inline-block; margin-right: 12px; color: #ebc58c; }
.mt-record-card {
  width: min(690px, 100%);
  margin: 0 auto;
  padding: 23px 28px 18px;
  border: 1px solid rgba(230, 194, 145, .61);
  border-radius: 18px;
  background: linear-gradient(130deg, rgba(19, 29, 49, .76), rgba(12, 21, 39, .82));
  box-shadow: 0 18px 48px rgba(0, 4, 13, .36), inset 0 1px rgba(255, 246, 220, .1);
  backdrop-filter: blur(14px);
}
.mt-record-title { margin-bottom: 13px; }
#metamorphInput {
  display: block;
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 17px 20px;
  border: 1px solid rgba(226, 194, 156, .52);
  border-radius: 14px;
  outline: 0;
  background: rgba(8, 16, 32, .6);
  color: #f5e9d8;
  font: 1rem/1.65 "STKaiti", "KaiTi", serif;
  box-shadow: inset 0 3px 12px rgba(0, 3, 12, .27);
}
#metamorphInput::placeholder { color: rgba(229, 220, 214, .58); }
#metamorphInput:focus { border-color: #f5d4a2; box-shadow: 0 0 0 3px rgba(242, 196, 137, .1); }
.mt-record-actions { display: flex; justify-content: center; margin-top: 18px; }
.mt-primary,
.mt-secondary,
.mt-ghost,
.mt-jump-ai {
  min-height: 44px;
  padding: 9px 24px;
  border: 1px solid rgba(246, 212, 165, .76);
  border-radius: 999px;
  color: #fff0d9;
  background: rgba(22, 30, 46, .82);
  font: 400 1.06rem "STKaiti", "KaiTi", serif;
  letter-spacing: .12em;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, background .18s;
}
.mt-primary,
.mt-jump-ai {
  min-width: 220px;
  background: linear-gradient(105deg, rgba(95, 73, 59, .86), rgba(211, 168, 119, .91) 58%, rgba(248, 218, 174, .94));
  box-shadow: inset 0 1px rgba(255, 248, 225, .36), 0 0 20px rgba(226, 174, 115, .32);
  color: #fff7e8;
  text-shadow: 0 1px 5px #3e2c2b;
}
.mt-primary:hover,
.mt-jump-ai:hover,
.mt-secondary:hover,
.mt-ghost:hover { transform: translateY(-2px); box-shadow: 0 0 24px rgba(237, 191, 132, .45); }
.mt-primary:active,
.mt-jump-ai:active,
.mt-secondary:active,
.mt-ghost:active { transform: translateY(0); }
.mt-primary:disabled { opacity: .55; cursor: default; transform: none; }
.mt-feedback { min-height: 20px; margin: 12px 0 0; color: #e6cba5; font: .85rem/1.4 "STKaiti", "KaiTi", serif; text-align: center; }
.mt-recent {
  width: min(690px, 100%);
  margin: 70px auto 0;
  padding-bottom: 14px;
}
.mt-recent-list { display: grid; gap: 10px; }
.mt-recent-empty { padding: 18px; color: #b8bbc6; text-align: center; background: rgba(10, 19, 36, .6); border: 1px solid rgba(232, 196, 151, .28); border-radius: 14px; }
.mt-recent-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px 16px;
  width: 100%;
  padding: 14px 20px;
  border: 1px solid rgba(232, 196, 151, .42);
  border-radius: 13px;
  background: var(--mt-panel);
  color: var(--mt-copy);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(9px);
}
.mt-recent-item:hover,
.mt-recent-item:focus-visible { border-color: #f4d2a1; box-shadow: 0 0 18px rgba(227, 183, 125, .22); }
.mt-recent-day { color: var(--mt-gold-strong); font: 1.05rem "STKaiti", "KaiTi", serif; }
.mt-recent-date { color: #b3b7c4; font-size: .74rem; }
.mt-recent-text { grid-column: 1 / 3; overflow: hidden; color: #d4d6dc; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.mt-recent-arrow { grid-column: 3; grid-row: 1 / 3; color: var(--mt-gold); font-size: 1.5rem; }
.mt-loading-screen { background: #07101e; }
.mt-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: hue-rotate(125deg) saturate(.52) brightness(.62); }
.mt-video-mask { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4, 10, 22, .32), rgba(4, 10, 22, .67)); }
.mt-loading-copy { position: relative; z-index: 1; display: flex; min-height: 100%; align-items: center; justify-content: flex-end; padding: 40px 6%; }
.mt-loading-panel {
  width: min(360px, 100%);
  padding: 26px;
  border: 1px solid var(--mt-line);
  border-radius: 20px;
  background: var(--mt-panel-strong);
  box-shadow: 0 20px 60px rgba(0, 3, 12, .5);
  text-align: center;
  backdrop-filter: blur(16px);
}
.mt-loading-ornament { display: block; color: var(--mt-gold); font-size: 2.2rem; }
.mt-loading-copy h2 { margin: 3px 0 9px; color: var(--mt-gold-strong); font: 400 clamp(1.9rem, 3vw, 2.65rem) "STKaiti", "KaiTi", serif; }
.mt-loading-copy p { color: #e8dbca; font: 1rem/1.8 "STKaiti", "KaiTi", serif; }
.mt-loading-track { height: 6px; margin: 22px 0 12px; overflow: hidden; border-radius: 9px; background: #18233b; }
.mt-loading-track span { display: block; width: 34%; height: 100%; border-radius: 9px; background: linear-gradient(90deg, #ab8659, #ffe9ba); animation: mt-loading-slide 2.1s ease-in-out infinite alternate; }
.mt-loading-elapsed { font-size: .85rem !important; color: #c3bfd0 !important; }
.mt-loading-error { margin-top: 20px; padding: 15px; border: 1px solid rgba(245, 153, 144, .65); border-radius: 12px; background: rgba(47, 18, 28, .86); }
.mt-loading-error p { margin-bottom: 12px; }
@keyframes mt-loading-slide { from { transform: translateX(-10%); } to { transform: translateX(210%); } }
.mt-result-shell { width: min(980px, calc(100% - 52px)); padding-top: 26px; }
.mt-result-screen .mt-stage-track { margin-top: 22px; margin-bottom: 24px; }
.mt-day-card {
  width: min(600px, 100%);
  padding: 17px 24px 19px;
  border: 1px solid rgba(231, 194, 145, .62);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(18, 28, 49, .86), rgba(19, 25, 44, .7));
  box-shadow: 0 13px 35px rgba(0, 4, 15, .32), inset 0 1px rgba(255, 241, 218, .09);
  backdrop-filter: blur(12px);
}
.mt-day-card h2 { margin: 0 0 10px; padding-bottom: 9px; border-bottom: 1px solid rgba(234, 198, 153, .24); color: var(--mt-gold-strong); font: 400 1.4rem "STKaiti", "KaiTi", serif; }
.mt-day-card p { margin: 0; color: #e4e1df; font: 1rem/1.65 "STKaiti", "KaiTi", serif; white-space: pre-wrap; }
.mt-jump-ai { margin: 20px auto 4px; }
.mt-jump-ai span { margin-left: 12px; font-size: 1.3rem; }
.mt-butterfly-scene { width: min(440px, 60vw); height: 250px; margin: 0 auto; display: grid; place-items: center; }
.mt-butterfly-scene img { display: block; width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 0 24px rgba(245, 201, 145, .46)); }
.mt-ai-section { width: 100%; scroll-margin-top: 24px; }
.mt-ai-section .mt-section-title { position: relative; margin-bottom: 15px; }
.mt-ai-section .mt-section-title::before,
.mt-ai-section .mt-section-title::after { content: ""; display: inline-block; width: min(19%, 120px); height: 1px; margin: 0 17px 6px; background: linear-gradient(90deg, transparent, rgba(240, 199, 139, .75)); }
.mt-ai-section .mt-section-title::after { transform: rotate(180deg); }
.mt-ai-card { display: grid; grid-template-columns: 43% minmax(0, 1fr); gap: 20px; padding: 14px; border: 1px solid var(--mt-line); border-radius: 16px; background: var(--mt-panel-strong); box-shadow: 0 18px 48px rgba(0, 4, 13, .35); backdrop-filter: blur(14px); }
.mt-ai-cover { position: relative; min-height: 190px; overflow: hidden; border: 1px solid rgba(238, 200, 145, .35); border-radius: 11px; background: #0c1725; }
.mt-cover-butterfly { position: absolute; width: 58%; height: 75%; inset: 12% 21%; object-fit: contain; filter: drop-shadow(0 0 17px rgba(247, 206, 154, .45)); }
.mt-ai-detail { min-width: 0; padding: 12px 10px 8px 0; }
.mt-ai-eyebrow { margin: 0 0 9px; color: #d4b588; font-size: .76rem; letter-spacing: .19em; }
.mt-ai-detail h3 { margin: 0 0 10px; color: var(--mt-gold-strong); font: 400 clamp(1.45rem, 2.2vw, 2rem) "STKaiti", "KaiTi", serif; }
.mt-ai-detail > p:not(.mt-ai-eyebrow) { display: -webkit-box; overflow: hidden; color: #d7d5db; line-height: 1.7; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.mt-ai-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.mt-ai-tags span { padding: 4px 10px; border: 1px solid rgba(232, 191, 135, .46); border-radius: 999px; color: #dbbd94; font-size: .68rem; letter-spacing: .05em; }
.mt-result-copy { width: 100%; margin: 16px auto 0; padding: 23px 27px; border: 1px solid rgba(232, 194, 143, .42); border-radius: 15px; background: var(--mt-panel-strong); backdrop-filter: blur(12px); }
.mt-result-copy h3 { margin: 0 0 10px; color: var(--mt-gold-strong); font: 400 1.35rem "STKaiti", "KaiTi", serif; }
.mt-story-body { color: #e6e1de; font-size: .98rem; line-height: 1.95; white-space: pre-wrap; }
.mt-story-body.is-collapsed { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
.mt-result-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.mt-secondary,
.mt-ghost { min-width: 140px; border-color: rgba(237, 198, 143, .5); background: rgba(26, 34, 52, .75); font-size: .91rem; }
.mt-entry-review { position: fixed; z-index: 100001; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3, 8, 18, .75); }
.mt-entry-review-card { width: min(510px, 100%); padding: 25px; border: 1px solid var(--mt-line); border-radius: 17px; background: #101b30; box-shadow: 0 25px 70px #02050e; }
.mt-entry-review-card h3 { margin: 0 0 10px; color: var(--mt-gold-strong); }
.mt-entry-review-card p { margin: 0 0 18px; line-height: 1.8; white-space: pre-wrap; }
.history-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px 12px; border-bottom: 1px solid #2a3a30; }
.history-tabs button { min-height: 38px; border: 1px solid rgba(212, 175, 55, .2); border-radius: 10px; color: #aab9af; background: rgba(255, 255, 255, .025); cursor: pointer; }
.history-tabs button.is-active { color: #ffe79a; border-color: rgba(233, 207, 115, .65); background: rgba(212, 175, 55, .1); }
.mt-collection-list { flex: 1; overflow-y: auto; padding: 14px; }
.mt-collection-list[hidden] { display: none; }
.mt-collection-toolbar { margin-bottom: 12px; padding: 13px; border: 1px solid rgba(212, 175, 55, .25); border-radius: 12px; color: #cdd9d0; background: rgba(255, 255, 255, .025); }
.mt-collection-toolbar p { margin: 0 0 9px; line-height: 1.5; font-size: .82rem; }
.mt-collection-item { display: grid; grid-template-columns: 68px 1fr; gap: 12px; margin-bottom: 11px; padding: 11px; border: 1px solid #24352d; border-radius: 14px; background: #101d17; }
.mt-collection-thumb { width: 68px; height: 68px; border-radius: 10px; object-fit: cover; }
.mt-collection-main { min-width: 0; }
.mt-collection-title { margin: 0; color: #f2e8bf; font-size: .94rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-collection-meta { margin: 5px 0 8px; color: #81948a; font-size: .72rem; }
.mt-collection-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-collection-actions button { padding: 5px 9px; border: 1px solid rgba(157, 230, 109, .26); border-radius: 8px; color: #bfe4ca; background: transparent; font-size: .72rem; cursor: pointer; }
.mt-collection-actions button[data-action=delete] { color: #efaaa6; border-color: rgba(239, 100, 100, .28); }
.mt-novel-item { grid-template-columns: 1fr; }
.mt-empty { padding: 48px 16px; color: #8fa097; text-align: center; line-height: 1.8; }
#metamorphEntry {
  width: 62px;
  height: 62px;
  margin-left: auto;
  padding: 3px;
  border: 1px solid rgba(249, 211, 162, .8);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ffe6bb;
  background: radial-gradient(circle at 45% 30%, rgba(46, 47, 59, .9), rgba(7, 15, 29, .96) 75%);
  box-shadow: 0 0 0 3px rgba(6, 12, 26, .75), 0 0 20px rgba(238, 194, 134, .32);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
#metamorphEntry:hover,
#metamorphEntry:focus-visible { transform: translateY(-2px); box-shadow: 0 0 27px rgba(247, 207, 149, .55); }
#metamorphEntry img { width: 37px; height: 34px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(248, 210, 155, .4)); }
#metamorphEntry span { margin-top: -3px; font: 400 .75rem "STKaiti", "KaiTi", serif; letter-spacing: .16em; text-indent: .16em; }
html.metamorph-open #shareEntry,
html.metamorph-open #pixelTree,
html.metamorph-open #branchEntry { visibility: hidden; pointer-events: none; }
@media(max-width:900px) {
  #metamorphApp{inset:0 auto 0 0;width:100vw;max-width:100vw;z-index:82}
  .mt-screen::before { inset: 0; }
  .mt-shell { width: min(680px, calc(100% - 26px)); padding: 46px 0 80px; }
  .mt-close { top: 13px; right: 13px; width: 35px; height: 35px; }
  .mt-kicker { font-size: clamp(3.3rem, 12vw, 4.2rem); }
  .mt-subtitle { font-size: .96rem; letter-spacing: .08em; }
  .mt-stage-track { --mt-art-size: min(calc((100vw - 54px)/7),54px); width: 100%; gap: 2px; margin: 25px auto 32px; }
  .mt-stage-track::before { top: calc(18px + var(--mt-art-size) + 13px); left: 6.8%; right: 6.8%; }
  .mt-stage-number { height: 18px; font-size: .91rem; line-height: 18px; }
  .mt-stage-art{width:min(calc((100vw - 54px)/7),54px);min-width:0;height:var(--mt-art-size)}
  .mt-stage-dot { width: 7px; height: 7px; margin-top: 10px; }
  .mt-record-card { width: min(560px, calc(100% - 44px)); padding: 20px 16px 16px; }
  .mt-recent { width: min(560px, calc(100% - 44px)); margin-top: 58px; }
  .mt-result-shell { width: min(680px, calc(100% - 24px)); padding-top: 45px; }
  .mt-day-card { width: min(560px, calc(100% - 40px)); }
  .mt-butterfly-scene { width: min(410px, 95vw); height: 210px; }
  .mt-ai-card { grid-template-columns: 1fr; gap: 8px; }
  .mt-ai-cover { min-height: 180px; }
  .mt-ai-detail { padding: 12px; }
  .mt-loading-copy { justify-content: center; padding: 24px; }
  #metamorphEntry { width: 58px; height: 58px; }
  html.metamorph-open .mobile-tabbar { display: none !important; }
  html.metamorph-open .mt-record-card,
  html.metamorph-open .mt-recent,
  html.metamorph-open .mt-day-card,
  html.metamorph-open .mt-ai-section { margin-left: 0; margin-right: 55px; width: calc(100% - 55px); }
}
@media(max-width:430px) {
  .mt-shell { width: calc(100% - 18px); }
  .mt-stage-track { --mt-art-size: calc((100vw - 44px)/7); }
  .mt-stage-art { width: calc((100vw - 44px)/7); }
  .mt-subtitle { font-size: .89rem; }
  #metamorphInput { min-height: 125px; }
  .mt-record-card { padding: 16px 12px; }
  .mt-ai-section .mt-section-title::before,
  .mt-ai-section .mt-section-title::after { width: 10%; margin: 0 8px 6px; }
  .mt-result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-result-actions button { min-width: 0; padding: 8px 5px; font-size: .8rem; }
}
@media(prefers-reduced-motion:reduce) {
  #metamorphApp *, #metamorphApp *::before, #metamorphApp *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

.mt-entry-review[hidden]{display:none!important}
@media(min-width:901px) {
  html.metamorph-open .desktop-nav {
    background: linear-gradient(180deg, rgba(9, 19, 36, .97), rgba(5, 12, 26, .96));
    border-color: rgba(222, 188, 137, .38);
  }
  html.metamorph-open .desktop-nav nav a,
  html.metamorph-open .desktop-nav .nav-feature,
  html.metamorph-open .desktop-nav .nav-muted { color: #c5baaa; }
  html.metamorph-open .desktop-nav-foot { color: #9a92a0; }
}
/* 化蝶 V2：八阶段共用同一条轨道，原始阶段图片不作修改。 */
.mt-stage-track {
  --mt-art-size: 86px;
  width: min(940px, 100%);
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 3px;
}
.mt-stage-track::before {
  left: 6.25%;
  right: 6.25%;
  background: linear-gradient(90deg, rgba(239, 198, 133, .96) 0 calc(var(--mt-progress) * 12.5%), rgba(145, 154, 174, .52) calc(var(--mt-progress) * 12.5%) 100%);
}
.mt-stage-art {
  border: 0;
  box-shadow: 0 0 12px rgba(10, 24, 20, .55);
}
.mt-stage-art img { transform: scale(1.24); }
.mt-stage.is-active .mt-stage-art { border: 0; box-shadow: 0 0 20px rgba(239, 193, 120, .46); }
.mt-stage.is-current .mt-stage-art,
.mt-stage.is-selected .mt-stage-art { border: 0; box-shadow: 0 0 25px rgba(251, 207, 142, .68); }
.mt-stage-unknown .mt-stage-art {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, #193b38, #07131f 70%);
  outline: 1px solid rgba(215, 190, 133, .55);
  outline-offset: -4px;
}
.mt-unknown-mark { color: #f6dfae; font-size: clamp(1.5rem, 3vw, 2.5rem); line-height: 1; }
.mt-stage-count { position: absolute; bottom: 18px; color: #f2d49e; font-size: .63rem; }
.mt-record-actions { gap: 12px; flex-wrap: wrap; }
.mt-record-actions .mt-primary,
.mt-record-actions .mt-secondary { min-width: 150px; }
.mt-secondary:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; transform: none; }
#mtEntryEditInput {
  display: block;
  width: 100%;
  min-height: 145px;
  padding: 12px 14px;
  color: #f5e9d8;
  background: rgba(6, 14, 29, .9);
  border: 1px solid var(--mt-line);
  border-radius: 10px;
  resize: vertical;
  font: 1rem/1.7 "STKaiti", "KaiTi", serif;
}
#mtEntryEditInput[hidden] { display: none; }
.mt-entry-review-card [hidden] { display: none !important; }
.mt-archive-error { margin-top: 15px; padding: 15px; border: 1px solid #d6a470; border-radius: 12px; background: rgba(31, 23, 23, .88); }
.mt-archive-error[hidden] { display: none !important; }
.mt-history-panel { position: fixed; inset: 0; z-index: 100002; display: grid; place-items: center; padding: 18px; background: rgba(3, 8, 18, .8); }
.mt-history-panel[hidden] { display: none !important; }
.mt-history-card { width: min(660px, 100%); max-height: min(82vh, 720px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--mt-line); border-radius: 18px; color: var(--mt-copy); background: #101b30; box-shadow: 0 25px 70px #02050e; }
.mt-history-card header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--mt-line); }
.mt-history-card h2 { margin: 0; color: var(--mt-gold-strong); font: 1.5rem "STKaiti", "KaiTi", serif; }
#mtHistoryClose { border: 0; color: var(--mt-gold-strong); background: transparent; font-size: 1.2rem; cursor: pointer; }
#mtHistoryList { padding: 15px; overflow-y: auto; }
.mt-history-item { margin-bottom: 10px; padding: 14px; border: 1px solid rgba(224, 188, 135, .38); border-radius: 12px; background: rgba(5, 14, 27, .58); }
.mt-history-item h3 { margin: 0 0 5px; color: var(--mt-gold-strong); }
.mt-history-item p { margin: 0 0 10px; color: #b9b7bd; font-size: .83rem; }
.mt-history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mt-history-actions button { padding: 7px 12px; border: 1px solid rgba(224, 188, 135, .5); border-radius: 9px; color: var(--mt-gold-strong); background: transparent; cursor: pointer; }
html.metamorph-open #metamorphEntry span { font-size: .64rem; letter-spacing: 0; text-indent: 0; }
@media(max-width:900px) {
  .mt-stage-track { --mt-art-size: min(calc((100vw - 28px)/8), 52px); width: 100%; gap: 0; }
  .mt-stage-track::before { left: 6.25%; right: 6.25%; top: calc(18px + var(--mt-art-size) + 13px); }
  .mt-stage-art { width: var(--mt-art-size); height: var(--mt-art-size); }
  .mt-stage-dot { width: 7px; height: 7px; margin-top: 10px; }
  .mt-stage-count { bottom: 14px; font-size: .52rem; }
  .mt-record-actions .mt-primary, .mt-record-actions .mt-secondary { min-width: 115px; }
}
@media(max-width:430px) {
  .mt-stage-track { --mt-art-size: calc((100vw - 28px)/8); }
  .mt-stage-art { width: var(--mt-art-size); }
}

/* Metamorphosis becomes available after three valid entries. */
#metamorphGenerate:not(.is-ready) { color: #a8b2b3; border-color: rgba(141,158,158,.36); background: rgba(14,27,31,.5); box-shadow: none; text-shadow: none; }
#metamorphGenerate.is-ready { color: #f5fffa; border-color: rgba(155,224,192,.86); background: linear-gradient(110deg,#174f43,#237962 58%,#286e5c); box-shadow: inset 0 1px rgba(220,255,234,.22),0 0 19px rgba(51,143,105,.27); text-shadow: 0 1px 3px rgba(0,33,21,.7); }
#metamorphGenerate.is-ready:hover:not(:disabled), #metamorphGenerate.is-ready:focus-visible { box-shadow: inset 0 1px rgba(220,255,234,.3),0 0 25px rgba(73,166,122,.4); }
#metamorphGenerate.is-ready:disabled { opacity: .68; cursor: wait; transform: none; }
