:root {
  color-scheme: dark;
  --ink: #21043e;
  --violet: #7b1caf;
  --pink: #f20c91;
  --lavender: #e5c9ff;
  --cyan: #30d2ff;
  --blue: #0873df;
  --gold: #ffc41a;
  --cream: #fff9ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

button, a { touch-action: manipulation; }

body {
  color: white;
  background: var(--ink) url("/assets/menu-background.png") center / cover fixed no-repeat;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(160deg, rgba(25, 0, 55, .45), rgba(121, 15, 152, .28) 48%, rgba(20, 0, 54, .72));
}

.guide-body {
  background-color: transparent;
  background-image: none;
}

.guide-body::before {
  background: linear-gradient(135deg, rgba(30,5,68,.88), rgba(93,20,126,.82) 52%, rgba(28,5,66,.92));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

button, a { font: inherit; }

.screen {
  position: relative;
  z-index: 1;
  width: min(100%, 540px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.eyebrow {
  margin: 0;
  color: rgba(255,255,255,.72);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.page-title {
  margin: 3px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 8vw, 2.7rem);
  font-weight: 900;
  line-height: .98;
  text-shadow: 0 4px 12px rgba(242, 12, 145, .5);
}

.ornate-panel {
  color: #53106f;
  background: linear-gradient(150deg, #fff, #fbf0ff);
  border: 7px solid var(--lavender);
  border-radius: 30px;
  box-shadow: inset 0 0 0 2px rgba(123,28,175,.58), inset 0 0 0 12px white, 0 15px 34px rgba(18,0,40,.52);
}

.glossy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 58px;
  padding: 0 20px;
  border: 4px solid white;
  border-radius: 21px;
  color: white;
  background: linear-gradient(#32dbff, #0873df);
  box-shadow: inset 0 0 0 3px rgba(9,53,140,.35), 0 7px 0 rgba(31,4,67,.6);
  font-weight: 1000;
  letter-spacing: .03em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.glossy-button:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px rgba(9,53,140,.35), 0 3px 0 rgba(31,4,67,.6); }

.ghost-button {
  min-height: 56px;
  padding: 0 18px;
  border: 3px solid white;
  border-radius: 19px;
  color: var(--violet);
  background: rgba(255,255,255,.94);
  font-weight: 950;
  white-space: nowrap;
}

.guide-screen {
  height: 100svh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: calc(env(safe-area-inset-top) + 12px) 22px calc(env(safe-area-inset-bottom) + 18px);
  overflow: hidden;
}

.guide-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.guide-header .page-title {
  font-size: clamp(24px, 7.2vw, 29px);
  line-height: 1;
  white-space: nowrap;
}

.step-dots { display: flex; gap: 7px; padding-bottom: 5px; }
.step-dot { width: 9px; height: 9px; border-radius: 99px; background: rgba(255,255,255,.26); transition: .2s; }
.step-dot.active { width: 28px; background: var(--gold); }

.guide-card {
  display: grid;
  grid-template-rows: clamp(220px, 35.5svh, 310px) minmax(0, 1fr);
  min-height: 0;
}

.guide-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 18px;
  overflow: hidden;
}

.guide-art::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 2px solid rgba(123,28,175,.35);
  border-radius: 19px;
  pointer-events: none;
}

.guide-copy {
  min-height: 0;
  display: grid;
  align-content: start;
  justify-items: center;
  padding: 16px 18px 4px;
  text-align: center;
}
.guide-icon {
  position: relative;
  width: 36px;
  height: 28px;
  color: var(--gold);
}
.guide-icon::before {
  content: "";
  position: absolute;
  inset: 2px 7px 2px 7px;
  border: 2px solid currentColor;
  border-radius: 5px;
  transform: rotate(-7deg);
  box-shadow: 5px 2px 0 -2px #57107c, 5px 2px 0 0 currentColor;
}
.guide-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.icon-rank::after { width: 9px; height: 3px; border-width: 2px 0; transform: translate(-50%, -50%); }
.icon-tools::after { width: 4px; height: 15px; border: 0; border-radius: 4px; background: currentColor; transform: translate(-50%, -50%) rotate(42deg); }
.icon-reward::after { width: 10px; height: 10px; border: 0; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(255,196,26,.24); transform: translate(-50%, -50%); }
.guide-copy h2 { margin: 8px 0 4px; color: white; font: 900 25px/1 Georgia, serif; }
.guide-copy .subtitle { color: var(--lavender); font-size: .78rem; font-weight: 950; letter-spacing: .18em; text-transform: uppercase; }
.guide-copy p { margin: 13px auto 0; max-width: 330px; color: rgba(255,255,255,.9); font-size: 17px; font-weight: 760; line-height: 1.45; }

.guide-actions { display: flex; gap: 12px; }
.guide-actions > * { flex: 1; }
.guide-actions .primary { flex: 1.6; }

.guide-actions .glossy-button,
.guide-actions .ghost-button {
  min-height: 54px;
  border-radius: 19px;
  font-size: 15px;
}

.sprite-art {
  width: 100%;
  max-width: 352px;
  aspect-ratio: 352 / 192;
  background-image: url("/assets/tutorial-art.png");
  background-repeat: no-repeat;
  background-size: 290.91% 316.67%;
}

.sprite-goal { background-position: 0 100%; }
.sprite-rank { background-position: 85.714% 92.308%; }
.sprite-tools { background-position: 85.714% 0; }

.playing-card {
  display: grid;
  place-items: center;
  width: 74px;
  height: 104px;
  border: 3px solid #7b0c45;
  border-radius: 10px;
  color: #7c159e;
  background: white;
  box-shadow: 0 7px 12px rgba(40,0,65,.32);
  font: 900 2.3rem/1 Georgia, serif;
}
.playing-card.red { color: #f01855; }
.playing-card.back { color: white; background: linear-gradient(145deg,#0d2c6f,#0b66d4); border-color: #54103d; }

.pyramid { display: grid; grid-template-columns: repeat(4, 54px); grid-template-rows: repeat(3, 74px); align-items: center; justify-items: center; }
.pyramid .playing-card { width: 58px; height: 81px; font-size: 1.55rem; }
.pyramid .c1 { grid-column: 2 / 4; grid-row: 1; }
.pyramid .c2 { grid-column: 2; grid-row: 2; }
.pyramid .c3 { grid-column: 3; grid-row: 2; }
.pyramid .c4 { grid-column: 1; grid-row: 3; }
.pyramid .c5 { grid-column: 2; grid-row: 3; }
.pyramid .c6 { grid-column: 3; grid-row: 3; }
.pyramid .c7 { grid-column: 4; grid-row: 3; }

.rank-chain { display: flex; align-items: center; gap: 12px; }
.rank-chain .playing-card:nth-child(2) { transform: translateY(-18px) scale(1.08); box-shadow: 0 0 0 5px var(--gold), 0 10px 20px rgba(40,0,65,.34); }
.rank-arrow { color: var(--gold); font-size: 1.7rem; font-weight: 1000; }

.tool-grid, .reward-grid { display: grid; grid-template-columns: repeat(2, minmax(100px, 1fr)); gap: 12px; width: min(100%, 330px); }
.tool, .reward {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 104px;
  padding: 28px 12px 12px;
  border-radius: 20px;
  color: var(--violet);
  background: rgba(229,201,255,.52);
  text-align: center;
  font-weight: 950;
}
.reward strong { font-size: 1.65rem; }
.tool small, .reward small { font-size: .72rem; letter-spacing: .08em; }
.reward::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  width: 18px;
  height: 18px;
  border: 3px solid #9a19bb;
  transform: translateX(-50%) rotate(45deg);
}
.reward-stars::before { border: 0; border-radius: 50%; background: #9a19bb; box-shadow: -9px 0 0 -4px #9a19bb, 9px 0 0 -4px #9a19bb; transform: translateX(-50%); }
.reward-coins::before { border-radius: 50%; transform: translateX(-50%); box-shadow: inset 0 0 0 3px rgba(154,25,187,.2); }
.reward-chapters::before { width: 20px; height: 16px; border-radius: 2px; transform: translateX(-50%); box-shadow: -5px 4px 0 -2px #efd0ff, -5px 4px 0 0 #9a19bb; }

.privacy-screen { padding-left: 14px; padding-right: 14px; }
.privacy-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.privacy-header .hand { font-size: 2rem; }
.privacy-title-wrap { min-width: 0; flex: 1; }
.privacy-title-wrap .page-title { font-size: clamp(1.65rem, 7vw, 2.3rem); white-space: nowrap; }
.close-button {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
  border: 4px solid white;
  border-radius: 50%;
  color: white;
  background: var(--violet);
  font-size: 1.55rem;
  font-weight: 1000;
  line-height: 1;
  text-decoration: none;
}

.privacy-panel { padding: 22px clamp(18px, 5vw, 30px) 28px; }
.privacy-intro { padding: 18px; border-radius: 20px; background: rgba(229,201,255,.38); }
.privacy-intro h2 { margin: 0 0 8px; color: #6c108c; font: 900 1.45rem/1.08 Georgia, serif; }
.privacy-intro p, .policy-section p { margin: 0; color: #4a2560; font-size: 1rem; font-weight: 650; line-height: 1.48; }
.policy-section { margin-top: 22px; }
.policy-section h3 { margin: 0 0 7px; color: var(--pink); font-size: 1rem; font-weight: 1000; letter-spacing: .02em; }
.privacy-ack { margin: 26px 0 0; color: #a44bc0; font-weight: 850; text-align: center; }

.landing { display: grid; place-items: center; text-align: center; }
.landing-card { width: min(100%, 450px); padding: 30px 24px; }
.landing-logo { width: min(100%, 360px); }
.landing-links { display: grid; gap: 14px; margin-top: 22px; }

@media (max-height: 720px) {
  .guide-screen { gap: 9px; padding-top: calc(env(safe-area-inset-top) + 7px); padding-bottom: calc(env(safe-area-inset-bottom) + 10px); }
  .guide-card { grid-template-rows: 205px minmax(0, 1fr); }
  .guide-art { padding: 14px; }
  .guide-copy { padding-top: 9px; }
  .guide-copy h2 { margin-top: 5px; font-size: 21px; }
  .guide-copy p { margin-top: 7px; font-size: 14px; line-height: 1.32; }
  .guide-icon { width: 31px; height: 23px; }
  .guide-actions .glossy-button, .guide-actions .ghost-button { min-height: 48px; font-size: 13px; }
  .tool, .reward { min-height: 78px; padding-top: 22px; }
  .reward::before { top: 7px; width: 14px; height: 14px; border-width: 2px; }
}

@media (max-height: 620px) {
  .guide-card { grid-template-rows: 170px minmax(0, 1fr); }
  .guide-copy .subtitle { font-size: .68rem; }
  .guide-copy p { max-width: 290px; font-size: 13px; }
  .guide-actions .glossy-button, .guide-actions .ghost-button { min-height: 44px; }
}

/* Three-part full-screen guide using the original game artwork. */
.guide-v3 { min-height: 100svh; overflow: hidden; background: #220438 url("/assets/menu-background.png") center / cover no-repeat; }
.guide-v3::before { background: radial-gradient(circle at 50% 24%, rgba(235,79,255,.18), transparent 36%), linear-gradient(180deg, rgba(20,0,46,.28), rgba(20,0,46,.72)); backdrop-filter: none; }
.guide-screen-v3 { position: relative; z-index: 1; display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 10px; width: min(100%,540px); height: 100svh; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 10px) 14px calc(env(safe-area-inset-bottom) + 12px); }
.guide-topbar { display: flex; align-items: end; justify-content: space-between; min-height: 66px; padding: 0 8px 3px; }
.guide-kicker { margin: 0 0 4px; color: #f2cfff; font-size: 12px; font-weight: 900; letter-spacing: .12em; }
.guide-topbar h1 { margin: 0; color: #fff; font: 900 clamp(28px,8vw,38px)/.94 Georgia,"Times New Roman",serif; text-shadow: 0 3px 0 #6e168e,0 0 16px rgba(255,53,199,.7); }
.guide-progress { display: grid; justify-items: end; gap: 6px; }
.guide-count { color: #fff; font-size: 15px; font-weight: 950; }
.guide-progress .step-dots { padding: 0; }
.guide-progress .step-dot { width: 8px; height: 8px; background: rgba(255,255,255,.34); }
.guide-progress .step-dot.active { width: 25px; background: #ffc928; box-shadow: 0 0 8px rgba(255,201,40,.65); }
.spellbook { min-height: 0; overflow: hidden; padding: clamp(22px,4.2svh,38px) clamp(25px,7vw,38px) clamp(28px,4.6svh,40px); color: #4c1766; background: url("/assets/original-panel.png") center / 100% 100% no-repeat; }
.spellbook::-webkit-scrollbar { display: none; }
.lesson-visual { position: relative; display: grid; place-items: center; min-height: clamp(105px,13svh,115px); margin: 0 3px 8px; padding: 10px 14px 38px; overflow: hidden; border: 3px solid #c690e5; border-radius: 20px; background: linear-gradient(135deg,#ded8ff,#acb2ef 48%,#e8c8f7); box-shadow: inset 0 0 0 3px rgba(255,255,255,.68),0 6px 14px rgba(68,14,95,.18); }
.tutorial-scene { width: min(88%,316px); aspect-ratio: 352/192; background-image: url("/assets/tutorial-art.png"); background-repeat: no-repeat; background-size: 290.91% 316.67%; transform: translateY(-7px) scale(.82); transform-origin: center; filter: drop-shadow(0 6px 8px rgba(63,17,86,.22)); }
.scene-goal { background-position: 0 100%; }
.scene-rank { background-position: 85.714% 92.308%; }
.lesson-visual-2 { min-height: 115px; max-height: 115px; }
.visual-ribbon { position: absolute; right: 9px; bottom: 8px; left: 9px; padding: 7px 10px; border: 2px solid white; border-radius: 12px; color: #fff; background: linear-gradient(90deg,rgba(100,20,151,.92),rgba(230,16,145,.92)); font-size: 12px; font-weight: 950; letter-spacing: .06em; text-align: center; }
.combo-badge { position: absolute; right: 12px; bottom: 8px; display: grid; min-width: 104px; padding: 5px 10px; border: 2px solid #fff; border-radius: 13px; color: #fff; background: linear-gradient(#ff35a8,#a819a8); text-align: center; box-shadow: 0 4px 0 rgba(69,9,83,.42); }
.combo-badge strong { font-size: 23px; line-height: 1; }
.combo-badge span { font-size: 10px; font-weight: 950; letter-spacing: .08em; }
.lesson-visual-2 .tutorial-scene { width: 80%; transform: translateY(-30px) scale(.42); }
.lesson-visual-2 .combo-badge { right: 10px; bottom: 7px; left: 10px; display: flex; align-items: center; justify-content: center; gap: 9px; min-width: 0; height: 31px; padding: 3px 10px; border-radius: 11px; }
.lesson-visual-2 .combo-badge strong { font-size: 20px; }
.lesson-visual-2 .combo-badge span { font-size: 11px; }
.medal-art { display: block; width: 104%; height: auto; transform: translate(8%,-12px) scale(.82); transform-origin: center; clip-path: inset(0 20% 0 0); filter: drop-shadow(0 5px 6px rgba(82,24,90,.22)); }
.reward-strip { position: absolute; right: 8px; bottom: 8px; left: 8px; display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.reward-strip span { display: grid; padding: 5px 2px; border: 2px solid white; border-radius: 11px; color: #fff; background: linear-gradient(#6e1f9d,#b119a6); font-size: 10px; font-weight: 900; text-align: center; }
.reward-strip b { color: #ffde3e; font-size: 17px; line-height: 1; }
.lesson-copy { text-align: left; }
.lesson-number { display: inline-block; padding: 5px 10px; border-radius: 99px; color: #fff; background: #a328bd; font-size: 12px; font-weight: 950; letter-spacing: .1em; }
.lesson-copy h2 { margin: 8px 0 3px; color: #8214a9; font: 900 clamp(22px,6.5vw,29px)/1 Georgia,"Times New Roman",serif; letter-spacing: .01em; }
.lesson-lead { margin: 0 0 12px; color: #b34ac3; font-size: 16px; font-weight: 850; line-height: 1.28; }
.rule-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.rule-list li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; }
.rule-gem { width: 11px; height: 11px; margin: 3px 0 0 2px; border: 2px solid #ed1497; background: #ffc4ed; transform: rotate(45deg); box-shadow: 0 0 0 2px #fff; }
.rule-list strong { display: block; color: #6f188f; font-size: 14px; letter-spacing: .025em; }
.rule-list p { margin: 2px 0 0; color: #543362; font-size: 16px; font-weight: 650; line-height: 1.22; }
.magic-tip { display: none; }
.magic-tip strong { margin-right: 8px; color: #e20a8c; font-size: 14px; white-space: nowrap; }
.guide-actions-v3 { display: flex; gap: 10px; padding: 0 8px; }
.guide-actions-v3 button { min-width: 0; height: 54px; border: 4px solid #fff; border-radius: 19px; color: #fff; font-size: 16px; font-weight: 1000; letter-spacing: .05em; white-space: nowrap; box-shadow: inset 0 0 0 3px rgba(7,61,148,.3),0 6px 0 rgba(40,2,68,.72); }
.guide-next { flex: 1.6; background: linear-gradient(#2edaff,#087ce2); }
.guide-back { flex: 1; background: linear-gradient(#dc71f1,#8c25b5); }
.guide-actions-v3 button:active { transform: translateY(3px); box-shadow: inset 0 0 0 3px rgba(7,61,148,.3),0 3px 0 rgba(40,2,68,.72); }
@media (max-height: 760px) {
  .guide-screen-v3 { gap: 7px; padding-top: calc(env(safe-area-inset-top) + 5px); padding-bottom: calc(env(safe-area-inset-bottom) + 8px); }
  .guide-topbar { min-height: 54px; }
  .guide-kicker { font-size: 10px; margin-bottom: 2px; }
  .guide-topbar h1 { font-size: 26px; }
  .spellbook { padding: 20px 25px 28px; }
  .lesson-visual { min-height: 100px; max-height: 108px; margin-bottom: 7px; }
  .lesson-copy h2 { font-size: 21px; margin-top: 6px; }
  .lesson-lead { margin-bottom: 8px; font-size: 14px; }
  .rule-list { gap: 6px; }
  .rule-list p { font-size: 13px; line-height: 1.22; }
  .magic-tip { margin: 7px 0 6px; padding: 6px 9px; font-size: 14px; }
  .guide-actions-v3 button { height: 48px; font-size: 14px; }
}
@media (max-height: 640px) {
  .lesson-visual { min-height: 82px; max-height: 88px; }
  .spellbook { padding-top: 16px; padding-bottom: 22px; }
  .rule-list p { font-size: 12px; }
  .magic-tip { display: none; }
}

