:root{
  --bg1: #071a2a;
  --bg2: #030b14;
  --panel: rgba(7, 22, 36, 0.62);
  --stroke: rgba(255,255,255,0.10);
  --text: #eaf3ff;
  --muted: rgba(234,243,255,0.72);

  --card-w: 520px;
  --card-h: 650px;

  --paper: #efe6d3;

  /* �㮾��㵪��椰��嚗� */
  --title-x: 295px;
  --title-y: 300px;
  --title-w: 90px;
  --title-rot: 14deg;
  --title-skewX: 20deg;
  --title-skewY: -28deg;

  /* QR嚗�𢰧��嚗� */
  --qr-x: 180px;
  --qr-y: 285px;
  --qr-size: 85px;
  --qr-rot: -14deg;
  --qr-skewX: -17deg;
  --qr-skewY: 30deg;

  --preview-scale: 1;
  --preview-w: var(--card-w);
  --preview-h: var(--card-h);
}

*{ box-sizing: border-box; }
html,body{ height:100%; }

html{
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 18% 12%, rgba(62, 200, 255, 0.14), transparent 55%),
    radial-gradient(820px 520px at 84% 18%, rgba(255, 210, 120, 0.10), transparent 58%),
    radial-gradient(1200px 760px at 50% -12%, rgba(170, 120, 255, 0.10), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
  overflow-x: hidden;
}

#starfield{
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

body > *{
  position: relative;
  z-index: 1;
}

.pageHeader{
  max-width: 1200px;
  margin: 22px auto 14px;
  padding: 0 18px;
  display:flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}
.pageHeader h1{
  margin:0 0 8px;
  font-size: 28px;
  letter-spacing: .3px;
}
.pageHeader p{
  margin:0;
  color: var(--muted);
}
.pageHeader__right{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.pill{
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(10, 28, 44, 0.55);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
}

.shell{
  max-width: 1200px;
  margin: 0 auto 40px;
  padding: 0 18px;
}

.panel{
  border: 1px solid var(--stroke);
  background: var(--panel);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(12px);
  box-shadow: 0 16px 50px rgba(20, 20, 40, 0.08);
}

h2{ margin: 0 0 10px; font-size: 20px; }
h3{ margin: 0 0 8px; font-size: 16px; }
.muted{ color: var(--muted); }
.small{ font-size: 12px; }
.tip{ margin:10px 0 0; }
.hidden{ display:none !important; }

.btn{
  appearance:none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10, 28, 44, 0.55);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor:pointer;
  color: var(--text);
  transition: transform .12s ease, background .12s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0px); }

.btn.primary{
  background: rgba(140, 130, 255, 0.25);
  border-color: rgba(110, 100, 255, 0.45);
}
.btn.ghost{
  background: rgba(255,255,255,0.10);
}

/* START */
.startGrid{
  margin-top: 10px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.startCard{
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 14px;
  backdrop-filter: blur(10px);
}

/* dropdown */
.dd{ position: relative; width: 100%; }
.dd__btn{
  width: 100%;
  text-align: left;
  padding: 12px 42px 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.10);
  color: var(--text);
  cursor: pointer;
}
.dd__chev{
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(234,243,255,0.65);
  border-bottom: 2px solid rgba(234,243,255,0.65);
  transform: translateY(-50%) rotate(45deg);
  pointer-events: none;
  opacity: .9;
}
.dd__panel{
  position: absolute;
  left: 0;
  right: 0;
  margin-top: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(6, 18, 30, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
  display: none;
  z-index: 9999;
}
.dd.is-open .dd__panel{ display: block; }
.dd__group{
  padding: 10px 10px 6px;
  font-size: 13px;
  letter-spacing: .06em;
  color: rgba(234,243,255,0.70);
}
.dd__item{
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: rgba(234,243,255,0.95);
  cursor: pointer;
}
.dd__item:hover,
.dd__item:focus{
  outline: none;
  background: rgba(80, 170, 255, 0.22);
}
.dd__item.is-selected{ background: rgba(80, 170, 255, 0.30); }
.dd__panel::-webkit-scrollbar{ width: 8px; }
.dd__panel::-webkit-scrollbar-thumb{ background: rgba(255,255,255,0.18); border-radius: 99px; }
.dd__panel::-webkit-scrollbar-track{ background: rgba(255,255,255,0.06); border-radius: 99px; }

/* QUIZ */
.quizTop{
  display:flex;
  justify-content: space-between;
  align-items:flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.quizCard{
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 14px;
  backdrop-filter: blur(10px);
}
.quizProgress{
  font-weight: 800;
  color: rgba(234,243,255,0.78);
  margin-bottom: 10px;
}
.qGroup{ font-weight: 900; margin-bottom: 8px; }
.qText{
  font-size: 16px;
  font-weight: 900;
  line-height: 1.35;
  margin-bottom: 12px;
}
.qActions{ display:flex; gap: 10px; flex-wrap: wrap; }

/* RESULT */
.resultHeader{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  align-items:flex-start;
}
.resultScroller{ overflow: visible; padding-bottom: 8px; }
.resultGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 560px 1fr;
  gap: 14px;
  align-items: start;
  min-width: 0;
}
.cardFrame{
  border: 1px solid var(--stroke);
  background: rgba(10, 28, 44, 0.45);
  border-radius: 18px;
  padding: 14px;
  backdrop-filter: blur(10px);
}
.cardPreview{
  position: relative;
  width: var(--preview-w);
  height: var(--preview-h);
  margin: 0 auto;
  overflow: visible;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  border-radius: 0;
}
.shareCardPos{
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.shareCard{
  width: var(--card-w);
  height: var(--card-h);
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 18px 50px rgba(20, 20, 40, 0.18);
  position: relative;
  transform-origin: top center;
  transform: translateZ(0) scale(var(--preview-scale));
  will-change: transform;
  backface-visibility: hidden;
}

.cardArtBg{
  position: absolute;
  inset: 0;
  background-image: url("./../image/book.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  z-index: 0;
}

.typeChip,
.tagline,
.pageTitleLink,
.qrWrap,
.cardFooter{
  z-index: 1;
}

.typeChip{
  position:absolute;
  top: 16px;
  left: 16px;
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(120,120,135,0.55);
  color:#fff;
  font-weight: 900;
  letter-spacing: .5px;
}
.typeChip .dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
}

.tagline{
  position:absolute;
  top: 18px;
  right: 16px;
  max-width: 300px;
  color: rgba(18, 32, 44, 0.88);
  font-weight: 900;
  font-size: 16px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35), 0 6px 18px rgba(0,0,0,0.20);
  background: rgba(255,255,255,0.55);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

/* ========= ��𣈯枤靽格迤嚗𡁏㮾��� transform �函�衤��稲嚗��踹�滚�埝彍/�号��㕑歲雿㵪�� ========= */
.pageTitleLink{
  position:absolute;
  left: var(--title-x);
  top: var(--title-y);
  width: var(--title-w);

  color: rgba(30,30,30,0.95);
  font-weight: 900;
  font-size: 12px;
  line-height: 1.2;
  text-decoration: none;

  background: transparent;
  border: none;
  box-shadow: none;
  outline: none;
  padding: 0;

  transform-origin: left top;
  transform: rotate(var(--title-rot)) skew(var(--title-skewX), var(--title-skewY));
  text-shadow: 0 1px 0 rgba(255,255,255,0.28);

  /* 霈枏�堒�𧢲葡��𤘪凒蝛拙�帋�鈭� */
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.pageTitleLink.is-generating{
  opacity: 0.72;
  filter: blur(0.6px);
  letter-spacing: 0.10em;
}

.pageTitleLink.is-revealed{
  animation: bookReveal 0.45s ease-out both;
}

/* �㺿��𣂼蘨��� opacity/blur嚗䔶�滚�� transform嚗ōransform 撌脣𤐄摰𡁜銁 .pageTitleLink嚗� */
@keyframes bookReveal{
  0%{ opacity: 0; filter: blur(1px); }
  100%{ opacity: 1; filter: blur(0); }
}

/* QR */
.qrWrap{
  position:absolute;
  left: var(--qr-x);
  top: var(--qr-y);
  width: var(--qr-size);
  height: var(--qr-size);
  background: transparent;
  border: none;
  box-shadow: none;
  outline: none;
  transform-origin: center;
  transform: rotate(var(--qr-rot)) skew(var(--qr-skewX), var(--qr-skewY));
}
#qr, #qr canvas, #qr img{
  width:100% !important;
  height:100% !important;
  display:block;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

/* footer */
.cardFooter{
  position:absolute;
  left: 18px;
  right: 18px;
  bottom: 14px;
  color: rgba(110, 100, 255, 0.45);
  text-shadow: 0 2px 14px rgba(0,0,0,0.35);
}
.cardFooter__title{
  font-weight: 900;
  font-size: 20px;
  margin-bottom: 4px;
}
.cardFooter__sub{
  font-weight: 800;
  font-size: 14px;
  opacity: .92;
}
.hashtags{
  display:flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.hashtags span{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.18);
}

/* right side cards */
.infoCard{
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.06);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
  backdrop-filter: blur(10px);
}
.label{
  font-size: 12px;
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 6px;
}
.mbti{
  font-size: 34px;
  font-weight: 1000;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.desc{
  color: rgba(234,243,255,0.82);
  font-weight: 700;
}
.bookLink{
  color: #a9b8ff;
  font-weight: 900;
  text-decoration: none;
}
.bookLink:hover{ text-decoration: underline; }
.bookList{
  margin: 8px 0 0 18px;
  padding: 0;
}
.bookList li{
  margin: 6px 0;
  color: rgba(234,243,255,0.82);
  font-weight: 650;
}
.btnRow{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* QR ����𣂷葉 */
.qrLoading{
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  position: relative;
  border-radius: 6px;
  overflow: hidden;
}
.qrLoading__grid{
  position:absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.10) 1px, transparent 1px) 0 0 / 10px 10px,
    linear-gradient(180deg, rgba(0,0,0,0.10) 1px, transparent 1px) 0 0 / 10px 10px;
  opacity: 0.55;
  filter: blur(0.2px);
  animation: qrPulse 0.8s ease-in-out infinite;
}
.qrLoading__txt{
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 900;
  color: rgba(30,30,30,0.78);
  letter-spacing: .08em;
  background: rgba(255,255,255,0.55);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
@keyframes qrPulse{
  0%,100%{ opacity: .45; transform: scale(1); }
  50%{ opacity: .70; transform: scale(1.02); }
}

@media (max-width: 980px){
  .resultGrid{ grid-template-columns: 1fr; width: 100%; }
  .resultScroller{ overflow-x: hidden; padding-bottom: 0; }
  .leftCol, .rightCol{ min-width: 0; }
  .leftCol, .rightCol, .resultHeader{
    width: 100%;
    max-width: 100%;
    margin: 0;
  }
  .cardFrame, .infoCard{
    width: 100%;
    max-width: 100%;
  }
  .bookLink, .bookList li{
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media (max-width: 520px){
  .infoCard{ padding: 12px; margin-bottom: 10px; }
  .mbti{ font-size: 26px; }
  .desc{ font-size: 13px; line-height: 1.55; }
  .label{ font-size: 11px; }
  .btn{ padding: 9px 12px; font-size: 14px; }
}

@media (max-width: 420px){
  .btnRow{ grid-template-columns: 1fr; }
}

/* Export mode嚗��贝�厩鍂嚗� */
:root[data-export="1"]{
  --preview-scale: 1 !important;
  --preview-w: var(--card-w) !important;
  --preview-h: var(--card-h) !important;
}
:root[data-export="1"] .shareCard{
  transform: none !important;
  transform-origin: top left !important;
}

/* �𥲤�枂����𣈯�匧�閧𧞄嚗��踹�齿⏛����閧𧞄銝剝�枏�嚗� */
:root[data-export="1"] .pageTitleLink{
  animation: none !important;
  filter: none !important;
}

/* =========================
   �嵗��垍雯頝舀�鞾�鍦�讛�𣇉�梹��虾�𤣰���/��𣈯�㚁��虾�漤�见����
========================= */
.netNotice{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none; /* �蘨霈枏�折�冽�厰�訫虾暺� */
}

.netNotice *{
  pointer-events: auto;
}

.netNotice__toggle{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: rgba(6, 18, 30, 0.88);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(0,0,0,0.30);
}

.netNotice__icon{
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 1000;
  background: rgba(140, 130, 255, 0.28);
  border: 1px solid rgba(110, 100, 255, 0.45);
}

.netNotice__title{
  font-weight: 1000;
  letter-spacing: .3px;
}

.netNotice__chev{
  margin-left: auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(234,243,255,0.65);
  border-bottom: 2px solid rgba(234,243,255,0.65);
  transform: rotate(45deg);
  transition: transform .16s ease;
  opacity: .9;
}

.netNotice__body{
  margin-top: 10px;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  background: rgba(7, 22, 36, 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 12px 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.28);
}

.netNotice__text{
  margin: 0 0 10px;
  color: rgba(234,243,255,0.86);
  font-weight: 700;
  line-height: 1.55;
  font-size: 13px;
}

.netNotice__actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.netNotice__btn{
  border-radius: 12px;
}

/* �𤣰������ */
.netNotice.is-collapsed .netNotice__body{
  display: none;
}
.netNotice.is-collapsed .netNotice__chev{
  transform: rotate(-135deg);
}

/* ��𣈯�厩��页�𡁏㟲�钅𢒰�踎�黸��𧶏��蘨��蹱筑��訫�𤩺�厰�� */
.netNotice.is-closed .netNotice__toggle,
.netNotice.is-closed .netNotice__body{
  display: none;
}

.netNotice__fab{
  position: absolute;
  right: 0;
  bottom: 0;
  display: none;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 900;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(10, 28, 44, 0.78);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 14px 40px rgba(0,0,0,0.30);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.netNotice.is-closed .netNotice__fab,
.netNotice.is-collapsed .netNotice__fab{
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ��𧢲�毺���滚凝�𤣰��撠箏站����㛖�� */
@media (max-width: 520px){
  .netNotice{ right: 12px; bottom: 12px; width: min(340px, calc(100vw - 24px)); }
  .netNotice__text{ font-size: 12.5px; }
}

/* =========================
   生成儀式感：召喚遮罩
========================= */
.ritualOverlay{
  position: fixed;
  inset: 0;
  z-index: 999999; /* 一定要高於所有元素（含 netNotice） */
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(900px 520px at 18% 12%, rgba(62, 200, 255, 0.16), transparent 55%),
    radial-gradient(820px 520px at 84% 18%, rgba(255, 210, 120, 0.12), transparent 58%),
    radial-gradient(1200px 760px at 50% -12%, rgba(170, 120, 255, 0.12), transparent 60%),
    rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.ritualOverlay.is-on{
  opacity: 1;
  pointer-events: auto; /* 鎖住底下所有操作 */
}

.ritualOverlay__panel{
  width: min(520px, calc(100vw - 36px));
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(6, 18, 30, 0.80);
  box-shadow: 0 18px 60px rgba(0,0,0,0.40);
  padding: 18px 16px 16px;
  text-align: center;
}

.ritualOverlay__sigil{
  width: 70px;
  height: 70px;
  margin: 4px auto 10px;
  border-radius: 999px;
  border: 1px solid rgba(140, 130, 255, 0.45);
  background:
    radial-gradient(circle at 30% 30%, rgba(140,130,255,0.35), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(80,170,255,0.25), transparent 55%),
    rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
  animation: ritualBreath 1.15s ease-in-out infinite;
}

.ritualOverlay__sigil::before{
  content:"";
  position:absolute;
  inset: -20px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.10) 1px, transparent 1px) 0 0 / 12px 12px,
    linear-gradient(180deg, rgba(255,255,255,0.10) 1px, transparent 1px) 0 0 / 12px 12px;
  opacity: 0.45;
  filter: blur(0.2px);
  animation: ritualScan 1.2s linear infinite;
}

.ritualOverlay__title{
  font-weight: 1000;
  letter-spacing: .3px;
  font-size: 18px;
  color: rgba(234,243,255,0.98);
  margin-bottom: 6px;
}

.ritualOverlay__sub{
  color: rgba(234,243,255,0.74);
  font-weight: 750;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 10px;
}

.ritualOverlay__hint{
  display: inline-block;
  color: rgba(234,243,255,0.70);
  font-size: 12px;
  font-weight: 750;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
}

@keyframes ritualBreath{
  0%,100%{ transform: scale(1); box-shadow: 0 0 0 rgba(140,130,255,0.0); }
  50%{ transform: scale(1.03); box-shadow: 0 0 28px rgba(140,130,255,0.25); }
}

@keyframes ritualScan{
  0%{ transform: translateY(-8px); }
  100%{ transform: translateY(8px); }
}

/* 匯出模式：絕對不顯示遮罩（避免被截圖到） */
:root[data-export="1"] .ritualOverlay{
  display: none !important;
}
