/* 花靈物語 — base theme. Pastel macaron + gold filigree. Shared classes used by every module. */
:root {
  --pink: #ff86b3; --pink-d: #d4467e; --rose: #7a2e52; --cream: #fff8f0; --cream-2: #fdebe6;
  --gold: #d8a645; --gold-l: #f6dc95; --mint: #7fd6b5; --mint-d: #2f9d78; --lav: #b39cff; --lav-d: #6d54c9;
  --sky: #9fd4ff; --ink: #5d2f48; --ink-2: #8a5a73;
  --font: "Hiragino Maru Gothic ProN", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --hud-h: 56px; --nav-h: 76px;
  --outline: 0 0 2px var(--rose), 0 0 2px var(--rose), 1px 1px 0 var(--rose), -1px -1px 0 var(--rose), 1px -1px 0 var(--rose), -1px 1px 0 var(--rose), 0 2px 0 var(--rose);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2a1830; }
body { font-family: var(--font); color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
#app { position: fixed; inset: 0; overflow: hidden; background: #f7dfe8; }
.hidden { display: none !important; }

/* backgrounds (two layers crossfade) */
#bg, #bg .bg-layer { position: absolute; inset: 0; }
#bg .bg-layer { background-size: cover; background-position: center; opacity: 0; transition: opacity .5s ease; }
#bg .bg-layer.on { opacity: 1; }
#bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,240,248,.10) 0%, rgba(255,240,248,0) 30%, rgba(60,20,50,.10) 100%); pointer-events: none; }

#screen { position: absolute; left: 0; right: 0; top: var(--hud-h); bottom: var(--nav-h); overflow: hidden; z-index: 1; }
#hud { position: absolute; left: 0; right: 0; top: 0; height: var(--hud-h); z-index: 20; }
#nav { position: absolute; left: 0; right: 0; bottom: 0; height: var(--nav-h); z-index: 20; }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
#layer-modal { position: absolute; inset: 0; z-index: 50; pointer-events: none; }
#layer-modal > * { pointer-events: auto; }
#layer-story { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
#layer-story > * { pointer-events: auto; }
#layer-toast { position: absolute; left: 0; right: 0; top: calc(var(--hud-h) + 8px); z-index: 70; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }

/* type */
.outline { color: #fff; text-shadow: var(--outline); font-weight: 900; }
.title-text { font-size: 22px; font-weight: 900; color: #fff; text-shadow: var(--outline); letter-spacing: .02em; }
.sub { font-size: 13px; color: var(--ink-2); }

/* 9-slice panel and button from the generated art */
.panel {
  border-style: solid; border-width: 22px;
  /* the art has wide transparent margins (frame at y 83–424, x 13–500 of 512): slice past them and push them outside */
  border-image: url("assets/ui-panel.webp") 145 70 fill / 54px 26px / 31px 5px stretch;
  padding: 4px; color: var(--ink);
  filter: drop-shadow(0 4px 10px rgba(90, 30, 60, .25));
}
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; min-width: 46px; padding: 0 18px; border: 0; background: none; cursor: pointer;
  /* pill art sits at y 130–250, x 8–378 of 384: slice past the transparent margins and push them outside */
  border-style: solid; border-width: 14px 22px; border-image: url("assets/ui-button.webp") 162 90 fill / 62px 34px / 49px 3px stretch;
  font-family: var(--font); font-size: 16px; font-weight: 900; color: #fff; text-shadow: var(--outline);
  transition: transform .12s cubic-bezier(.3,1.6,.5,1), filter .15s; white-space: nowrap; outline: none;
}
.btn > * { margin: -10px 0; }
.btn:hover, .btn.focus { filter: brightness(1.12) drop-shadow(0 0 6px rgba(255, 220, 140, .9)); transform: scale(1.04); }
.btn:active, .btn.pressed { transform: scale(.92); }
.btn.mint { filter: hue-rotate(-150deg) saturate(.85); }
.btn.mint:hover, .btn.mint.focus { filter: hue-rotate(-150deg) saturate(.85) brightness(1.12) drop-shadow(0 0 6px rgba(255,220,140,.9)); }
.btn.lav { filter: hue-rotate(-60deg); }
.btn.lav:hover, .btn.lav.focus { filter: hue-rotate(-60deg) brightness(1.12) drop-shadow(0 0 6px rgba(255,220,140,.9)); }
.btn.gold { filter: hue-rotate(60deg) saturate(1.2) brightness(1.05); }
.btn.gold:hover, .btn.gold.focus { filter: hue-rotate(60deg) saturate(1.2) brightness(1.18) drop-shadow(0 0 6px rgba(255,220,140,.9)); }
.btn.small { min-height: 44px; font-size: 14px; padding: 0 10px; border-width: 12px 16px; border-image-width: 60px 32px; border-image-outset: 48px 3px; }
.btn[disabled], .btn.disabled { filter: grayscale(.85) brightness(1.05); opacity: .6; cursor: default; transform: none; }
.btn .btn-icon { width: 26px; height: 26px; object-fit: contain; }

/* generic pieces */
.icon { width: 40px; height: 40px; object-fit: contain; pointer-events: none; }
.scroll { overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; overscroll-behavior: contain; }
.scroll::-webkit-scrollbar { display: none; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.85); border: 2px solid var(--gold-l); font-size: 13px; font-weight: 800; color: var(--ink); }
.focus-ring, .focus { outline: 3px solid #ffe28a; outline-offset: 2px; border-radius: 12px; }
.btn.focus { outline: none; }
[data-nav] { cursor: pointer; }
@keyframes pop-in { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.05); opacity: 1; } 100% { transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse { 0%, 100% { opacity: .65; transform: scale(1); } 50% { opacity: 1; transform: scale(1.05); } }
.pop-in { animation: pop-in .28s cubic-bezier(.3,1.5,.5,1) both; }

/* title screen */
#title { position: absolute; inset: 0; z-index: 80; overflow: hidden; background: #fbe3ee; cursor: pointer; }
#title .title-art { position: absolute; inset: 0; background: url("assets/cover-bg.webp") center / cover no-repeat; animation: title-zoom 18s ease-in-out infinite alternate; }
@keyframes title-zoom { from { transform: scale(1.02); } to { transform: scale(1.08); } }
#title .title-logo { position: absolute; left: 50%; top: 7%; width: 82%; max-height: 30%; object-fit: contain; transform: translateX(-50%); filter: drop-shadow(0 6px 12px rgba(122,46,82,.35)); animation: logo-drop .7s cubic-bezier(.3,1.5,.5,1) both, logo-float 4s ease-in-out .7s infinite; }
@keyframes logo-drop { 0% { transform: translate(-50%, -60px) scale(.7); opacity: 0; } 100% { transform: translate(-50%, 0) scale(1); opacity: 1; } }
@keyframes logo-float { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }
#title .title-prompt { position: absolute; left: 12%; right: 12%; bottom: 9%; text-align: center; font-size: 20px; font-weight: 900; color: #fff; text-shadow: var(--outline); animation: pulse 1.8s ease-in-out infinite; }
#title .title-petals { position: absolute; inset: 0; pointer-events: none; }
.petal { position: absolute; top: -20px; width: 14px; height: 10px; border-radius: 70% 0 70% 0; background: linear-gradient(135deg, #ffd1e3, #ff9cc4); opacity: .85; animation: petal-fall linear infinite; }
@keyframes petal-fall { 0% { transform: translate(0, -20px) rotate(0); } 100% { transform: translate(60px, 110vh) rotate(540deg); } }

/* help */
.mn-help { display: flex; flex-direction: column; gap: 10px; padding: 2px 4px; }
.mn-help-row b { display: block; font-size: 16px; color: var(--pink-d); margin-bottom: 2px; }
.mn-help-row p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); }

/* cutscene */
#cutscene { position: absolute; inset: 0; z-index: 90; background: #000 url("assets/cover-bg.webp") center / cover no-repeat; }
#cutscene video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#skip-btn { position: absolute; right: 16px; bottom: 28px; }
