/* Paper Petals: cozy, paper-craft UI. Sized in rem off the window's height so it reads the
   same on a 3440x1440 ultrawide at 125% as at 1080p (the root size follows the window). */
:root {
  --ink: #4a2f45; --ink-soft: #7a5a72; --paper: #fffaf3; --paper-2: #fff2f6; --edge: #f2d6e2;
  --pink: #f48fb1; --pink-deep: #e0607e; --mint: #8fd6b4; --lemon: #ffd86a; --sky: #8ec5ef; --lilac: #c3a6ec;
  --shadow: 0 0.35rem 0 rgba(74, 47, 69, 0.12), 0 0.8rem 2rem rgba(74, 47, 69, 0.12);
  font-size: clamp(13px, 1.55vh, 30px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #fde8f0; color: var(--ink); font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; user-select: none; }
#stage { position: fixed; inset: 0; background: linear-gradient(#86c4f2, #fde6f0); }
#stage canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0.14rem solid var(--edge); background: var(--paper); border-radius: 0.8rem; padding: 0.45rem 0.8rem; box-shadow: 0 0.18rem 0 rgba(74, 47, 69, 0.15); transition: transform 0.08s, background 0.15s; }
button:hover { background: #fff; transform: translateY(-0.08rem); }
button:active { transform: translateY(0.1rem); box-shadow: none; }
button.on { background: var(--pink); color: #fff; border-color: var(--pink-deep); }
button.big { font-size: 1.25rem; font-weight: 700; padding: 0.7rem 1.4rem; border-radius: 1.2rem; }
button.play { background: linear-gradient(#ffb0cc, var(--pink)); color: #fff; border-color: var(--pink-deep); text-shadow: 0 0.1rem 0 rgba(160, 40, 80, 0.4); }
button.ghost { background: transparent; box-shadow: none; border-color: transparent; }
input[type=text] { font: inherit; color: var(--ink); background: #fff; border: 0.14rem solid var(--edge); border-radius: 0.7rem; padding: 0.4rem 0.7rem; width: 100%; }
input[type=color] { width: 2.6rem; height: 2.2rem; border: 0.14rem solid var(--edge); border-radius: 0.6rem; padding: 0.1rem; background: #fff; cursor: pointer; }
input[type=range] { width: 100%; }
.card { background: var(--paper); border: 0.16rem solid var(--edge); border-radius: 1.4rem; box-shadow: var(--shadow); }
.loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 2rem 3rem; text-align: center; z-index: 50; }
.loading .title, .brand { font-size: 2rem; font-weight: 800; color: var(--pink-deep); letter-spacing: 0.02em; }
.loading .sub { margin-top: 0.4rem; color: var(--ink-soft); }
.hidden { display: none !important; }

/* top bar */
.topbar { position: fixed; left: 1rem; right: 1rem; top: 0.8rem; display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.8rem; }
.topbar .brand { font-size: 1.5rem; margin-right: 0.6rem; }
.topbar .name { width: 12rem; }
.topbar .spacer { flex: 1; }
.menu { position: relative; }
.menu .drop { position: absolute; top: 110%; right: 0; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.5rem; z-index: 5; min-width: 14rem; }

/* side panels */
.left { position: fixed; left: 1rem; top: 5.2rem; bottom: 1rem; width: 27rem; display: flex; flex-direction: column; padding: 0.8rem; gap: 0.6rem; }
.right { position: fixed; right: 1rem; top: 5.2rem; bottom: 7.2rem; width: 22rem; display: flex; flex-direction: column; padding: 0.8rem; gap: 0.6rem; overflow-y: auto; }
.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tabs button { flex: 1 1 auto; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chips button { font-size: 0.85rem; padding: 0.3rem 0.6rem; border-radius: 1rem; }
.grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; align-content: start; padding: 0.2rem; }
.item { display: flex; flex-direction: column; align-items: center; padding: 0.3rem; border-radius: 1rem; position: relative; }
.item canvas { width: 100%; aspect-ratio: 3 / 4; background: var(--paper-2); border-radius: 0.7rem; }
.item .label { font-size: 0.8rem; margin-top: 0.2rem; text-align: center; line-height: 1.1; }
.item.on { background: #ffe3ee; border-color: var(--pink); color: var(--ink); }
.item.on .label { font-weight: 700; color: var(--pink-deep); }
.item.locked canvas { filter: grayscale(0.85) opacity(0.55); }
.item .lock { position: absolute; top: 0.4rem; right: 0.4rem; background: var(--lemon); border-radius: 0.6rem; font-size: 0.7rem; padding: 0.1rem 0.35rem; font-weight: 700; }
.section { font-weight: 800; font-size: 1rem; margin-top: 0.4rem; color: var(--pink-deep); }
.row { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.swatches { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.swatch { width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 0.14rem solid #fff; box-shadow: 0 0 0 0.12rem var(--edge); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 0.2rem var(--pink-deep); }
.pal { font-size: 0.75rem; color: var(--ink-soft); width: 4.6rem; }
.hint { font-size: 0.85rem; color: var(--ink-soft); }
.layers { display: flex; flex-direction: column; gap: 0.25rem; }
.layers .row { justify-content: space-between; font-size: 0.9rem; }

/* bottom stage bar */
.stagebar { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0.9rem; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 52rem); }
.stagebar .grp { display: flex; gap: 0.25rem; align-items: center; padding: 0 0.4rem; border-right: 0.12rem dashed var(--edge); }
.stagebar .grp:last-child { border-right: 0; }
.stagebar .lbl { font-size: 0.8rem; color: var(--ink-soft); margin-right: 0.2rem; }
.angle { min-width: 4.5rem; text-align: center; font-weight: 700; }
.playbtn { position: fixed; right: 1rem; bottom: 1rem; width: 22rem; }
.playbtn button { width: 100%; font-size: 1.5rem; padding: 1rem; }

/* modals */
.modal-back { position: fixed; inset: 0; background: rgba(74, 47, 69, 0.25); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal { padding: 1.4rem 1.8rem; min-width: 30rem; max-width: 60rem; max-height: 85vh; overflow-y: auto; display: flex; flex-direction: column; gap: 0.7rem; }
.modal h2 { margin: 0; color: var(--pink-deep); }
.closet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem; }

/* play HUD */
.hud-top { position: fixed; left: 1rem; top: 1rem; padding: 0.5rem 1rem; display: flex; gap: 1rem; align-items: center; font-weight: 700; font-size: 1.1rem; }
.hud-prompt { position: fixed; left: 50%; bottom: 18%; transform: translateX(-50%); padding: 0.6rem 1.2rem; font-size: 1.3rem; font-weight: 700; }
.hud-prompt .key { display: inline-block; background: var(--pink); color: #fff; border-radius: 0.5rem; padding: 0 0.5rem; margin-right: 0.5rem; }
.hud-toast { position: fixed; left: 50%; top: 1rem; transform: translateX(-50%); padding: 0.6rem 1.2rem; font-size: 1.15rem; max-width: 50rem; text-align: center; }
.hud-help { position: fixed; left: 1rem; bottom: 1rem; padding: 0.5rem 0.9rem; font-size: 0.9rem; color: var(--ink-soft); line-height: 1.5; }
.hud-menu { position: fixed; right: 1rem; top: 1rem; display: flex; gap: 0.4rem; }
.photo-bar { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); display: flex; gap: 0.5rem; padding: 0.5rem 0.8rem; opacity: 0.92; }
.toast-studio { position: fixed; left: 50%; top: 5.6rem; transform: translateX(-50%); padding: 0.5rem 1.1rem; }
