/* ================= Leather & parchment theme =================
   Nothing here stretches art: leather and parchment are seamless tiles repeated at a fixed
   scale, and the clasp corners / book are always drawn at their native aspect ratio. */

:root {
  --leather: url('../assets/ui/leather_tile.jpg');
  --parch: url('../assets/ui/parchment_tile.jpg');
  --stitch: rgba(222, 190, 120, .55);
}

.leather {
  background: var(--leather) repeat; background-size: 32rem;
  box-shadow: inset 0 0 0 .15rem rgba(0, 0, 0, .55), inset 0 0 3rem rgba(0, 0, 0, .55);
}
/* .stitched elements must be positioned themselves (absolute or relative) */
.stitched::after {
  content: ''; position: absolute; inset: .8rem; border: .15rem dashed var(--stitch); border-radius: .6rem; pointer-events: none;
  filter: drop-shadow(0 .1rem 0 rgba(0, 0, 0, .6));
}
.parch {
  background: var(--parch) repeat; background-size: 34rem; color: var(--ink);
  border: .2rem solid #241307; border-radius: .5rem;
  box-shadow: inset 0 0 2.4rem rgba(110, 70, 25, .45), inset 0 0 .4rem rgba(80, 50, 20, .5), 0 .4rem 1.2rem rgba(0, 0, 0, .55);
}

/* metal clasp corners from the PSD (top-right teal gem, bottom-left amber gem), native aspect */
.clasped { position: relative; }
.clasped > .clasp { position: absolute; pointer-events: none; z-index: 3; filter: drop-shadow(0 .2rem .3rem rgba(0, 0, 0, .55)); }
.clasped > .clasp-tr { top: -.4rem; right: -.4rem; width: 7.2rem; aspect-ratio: 263 / 251; background: url('../assets/ui/clasp_tr.png') center / contain no-repeat; }
.clasped > .clasp-bl { bottom: -.4rem; left: -.4rem; width: 7.2rem; aspect-ratio: 250 / 249; background: url('../assets/ui/clasp_bl.png') center / contain no-repeat; }
.clasped.small > .clasp-tr, .clasped.small > .clasp-bl { width: 5rem; }

/* gold-on-leather plaque buttons (BG-style) */
.plaque {
  display: flex; align-items: center; justify-content: center; gap: .8rem; width: 100%;
  padding: .7rem 1rem; font-family: var(--f-display); font-size: 2.1rem; color: #e8cf8e;
  background: linear-gradient(#4a2c18, #2a170b); border: .15rem solid rgba(214, 178, 94, .45); border-radius: .5rem;
  box-shadow: inset 0 .1rem 0 rgba(255, 220, 160, .15), 0 .2rem .5rem rgba(0, 0, 0, .6);
  text-shadow: 0 .15rem .2rem #000; transition: border-color .15s, color .15s, filter .15s;
}
.plaque:hover:not(:disabled) { border-color: rgba(245, 220, 147, .9); color: var(--gold-bright); filter: brightness(1.15); }
.plaque:disabled { opacity: .4; cursor: default; }
.plaque.cur { border-color: var(--gold-bright); box-shadow: 0 0 1rem rgba(245, 210, 120, .35), inset 0 0 1.2rem rgba(245, 210, 120, .2); color: #fff3d0; }
.plaque.primary { color: #ffd9a0; border-color: rgba(220, 120, 60, .7); background: linear-gradient(#6a2a18, #3a120a); }
.plaque .step-n { font-family: var(--f-sc); font-size: 1.4rem; color: #b8955a; width: 3rem; text-align: left; }
.plaque .step-name { flex: 1; text-align: left; }
.plaque .step-check { color: #9ed07a; font-size: 1.8rem; }

/* ================= modal card (replaces the stretched card art) ================= */
.card {
  position: relative; width: 62rem; min-height: 22rem; max-height: 66rem;
  padding: 3.2rem 4.4rem 2.6rem;
  background: var(--parch) repeat padding-box, var(--leather) repeat border-box;
  background-size: 34rem, 32rem;
  border: 1.1rem solid transparent; border-radius: 1rem;
  box-shadow: inset 0 0 2.4rem rgba(110, 70, 25, .45), 0 1.5rem 3rem rgba(0, 0, 0, .7);
  filter: none;
  display: flex; flex-direction: column; animation: cardin .28s cubic-bezier(.2, .9, .3, 1.2);
}
.card::before, .card::after { content: ''; position: absolute; pointer-events: none; filter: drop-shadow(0 .2rem .3rem rgba(0, 0, 0, .5)); }
.card::before { top: -1.5rem; right: -1.5rem; width: 7.4rem; aspect-ratio: 263 / 251; background: url('../assets/ui/clasp_tr.png') center / contain no-repeat; }
.card::after { bottom: -1.5rem; left: -1.5rem; width: 7.4rem; aspect-ratio: 250 / 249; background: url('../assets/ui/clasp_bl.png') center / contain no-repeat; }
.card .card-body { overflow-y: auto; }

/* ================= full-screen frame (creation, vault), in the launcher's cover style ================= */
.cframe { position: absolute; inset: 0; animation: fadein .35s ease; overflow: hidden; }
.cframe-bg { position: absolute; inset: 0; border-radius: .3rem; }
.cv-cover { background: radial-gradient(ellipse at 50% 46%, rgba(120, 76, 44, .12), rgba(10, 5, 2, .55) 85%), url('../assets/ui/leather.jpg') center / cover, #3a2416;
  box-shadow: inset 0 0 4rem rgba(0, 0, 0, .55), inset 0 0 0 .2rem rgba(0, 0, 0, .6); }
.cv-cover::before, .cv-cover::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: url('../assets/ui/launcher/cover_grunge.jpg') 0 0 / 100% 100%; }
.cv-cover::before { mix-blend-mode: overlay; opacity: .45; }
.cv-cover::after { mix-blend-mode: multiply; opacity: .15; }
.cv-seam { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.cv-clasp { position: absolute; width: 10.5rem; z-index: 5; pointer-events: none; filter: drop-shadow(0 .4rem .5rem rgba(0, 0, 0, .6)); }
.cv-clasp img { display: block; width: 100%; height: auto; }
.cv-clasp.tr { top: -.2rem; right: -.2rem; } .cv-clasp.bl { bottom: -.2rem; left: -.2rem; }
.cv-clasp .cv-claspgem { position: absolute; width: 11.7%; height: auto; transform: translate(-50%, -50%); }
.cv-clasp.tr .cv-claspgem { left: 90.8%; top: 9%; } .cv-clasp.bl .cv-claspgem { left: 11.5%; top: 89.1%; }
/* gold leaf pressed into the leather, as the launcher's title */
.cf-title { position: absolute; top: 1.4rem; left: 0; right: 0; display: flex; justify-content: center; align-items: center; gap: 2rem; z-index: 2; }
.cv-gold { font-family: var(--f-display); font-size: 3.8rem; line-height: 1.1;
  background: url('../assets/ui/leather.jpg') center / 60rem, linear-gradient(180deg, #f8eab4 0%, #dcbc68 40%, #a48038 68%, #dec474 100%); background-blend-mode: soft-light;
  -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 -.12rem 0 rgba(0, 0, 0, .75)) drop-shadow(0 .12rem 0 rgba(255, 214, 150, .16)); }
.cv-knot { display: block; width: 22rem; height: 1.5rem;
  background: url('../assets/ui/leather.jpg') center / 60rem, linear-gradient(180deg, #f8eab4 0%, #dcbc68 40%, #a48038 68%, #dec474 100%); background-blend-mode: soft-light;
  -webkit-mask: url('../assets/ui/divider.png') center / contain no-repeat; mask: url('../assets/ui/divider.png') center / contain no-repeat; filter: drop-shadow(0 -.1rem 0 rgba(0, 0, 0, .7)); }
.cv-knot.flip { transform: scaleX(-1); }
/* the two cards differ: the summary a little higher and narrower, its clasps flipped to the other diagonal */
.cf-summary { position: absolute; left: 3.6rem; top: 7.6rem; width: 22rem; bottom: 10.2rem; padding: 1.8rem 1.8rem 1.4rem; display: flex; flex-direction: column; z-index: 2; }
.cf-main { position: absolute; left: 27.8rem; top: 7rem; right: 26.6rem; bottom: 9.6rem; padding: 2rem 2.6rem 1.6rem; display: flex; flex-direction: column; z-index: 2; }
.cframe.no-side .cf-main { right: 3.6rem; }
.cframe.no-side .cf-side { display: none; }
.cf-summary > .clasp-tr { right: auto; left: -.4rem; transform: scaleX(-1); }
.cf-summary > .clasp-bl { left: auto; right: -.4rem; transform: scaleX(-1); }
.cf-side { position: absolute; width: 21.4rem; right: 3.4rem; top: 11rem; bottom: 9.6rem; display: flex; flex-direction: column; gap: .7rem; z-index: 3; }
.cf-side .side-spacer { flex: 1; }
.cf-side .side-note { font-size: 1.3rem; color: #d4b484; font-style: italic; text-align: center; padding: 0 .4rem; text-shadow: 0 .1rem .2rem #000; }
/* torn parchment plates pinned by a gem mount (js/core/coverArt.js: platesIn) */
.cv-plate { position: relative; display: block; height: 4.2rem; flex: none; margin-left: 1.6rem; filter: drop-shadow(0 .3rem .3rem rgba(0, 0, 0, .7)); transition: filter .2s; }
.cv-plate:has(> button:not(:disabled):hover), .cv-plate.cur { filter: drop-shadow(0 0 .25rem rgba(255, 200, 90, .9)) drop-shadow(0 0 .8rem rgba(255, 160, 50, .45)) drop-shadow(0 .3rem .3rem rgba(0, 0, 0, .7)); }
.cv-plate > .plaque { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0 1rem; border: 0; border-radius: 0; gap: .6rem; justify-content: center;
  font-size: 2rem; color: #3a2410; text-shadow: 0 1px 0 rgba(255, 240, 210, .35); filter: none;
  background: radial-gradient(ellipse 60% 70% at 50% 50%, transparent 50%, rgba(110, 62, 22, .5) 88%, rgba(60, 30, 8, .8) 100%),
    radial-gradient(circle at 18% 30%, rgba(140, 90, 40, .18), transparent 22%), radial-gradient(circle at 82% 75%, rgba(140, 90, 40, .16), transparent 20%),
    url('../assets/ui/parchment_tile.jpg') center / 22rem, #e8d6aa;
  -webkit-mask-size: 100% 100%; mask-size: 100% 100%; box-shadow: none; }
.cv-plate > .plaque:hover:not(:disabled), .cv-plate > .plaque:focus-visible { color: #7a1a10; filter: none; outline: none; }
.cv-plate > .plaque.cur { color: #7a1a10; }
.cv-plate > .plaque.primary { color: #5a1408; background-color: #e8d6aa; }
.cv-plate > .plaque:disabled { opacity: 1; color: rgba(58, 36, 16, .42); }
.cv-plate.dim .cv-mount { opacity: .7; }
.cv-plate > .plaque .step-n, .cv-plate > .plaque .step-check { display: none; }   /* the gem says it: green done, lit current */
.cv-plate > .plaque .step-name { flex: none; text-align: center; }
.cv-mount { position: absolute; left: -1.6rem; top: 50%; width: 3.9rem; aspect-ratio: 400 / 390; transform: translateY(-50%); pointer-events: none;
  background: url('../assets/ui/launcher/mount_v2.png') center / contain no-repeat;   /* the helper's painted knotwork mount (task 038) */ filter: drop-shadow(0 .2rem .3rem rgba(0, 0, 0, .6)); }
.cv-mount i { position: absolute; left: 38%; top: 49.1%; width: 1.45rem; height: 1.45rem; transform: translate(-50%, -50%); background: center / contain no-repeat; transition: opacity .2s; }
.cv-mount .lit { opacity: 0; } .cv-mount.on .lit { opacity: 1; }

/* compact sheet header inside the summary panel: portrait + identity, stats below */
.cf-summary .sheet-head { grid-template-columns: 18rem 1fr; grid-template-areas: "portrait id" "stats stats"; height: auto; row-gap: 1rem; }
.cf-summary .sh-portrait { grid-area: portrait; }
.cf-summary .sh-id { grid-area: id; text-align: left; }
.cf-summary .sh-stats { grid-area: stats; display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.4rem; }
.cf-summary .quickstats { margin-top: .4rem; }
.cf-summary .saves-mini { margin-top: 1rem; }
.cf-summary .rec-bio { margin-top: 1rem; }
.cf-inner { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; z-index: 1; }
.cf-summary .cf-inner { overflow-y: auto; scrollbar-width: thin; }
.cf-summary .sheet-head { grid-template-columns: 21rem 1fr; }
.cf-summary .sh-portrait { margin: 1.4rem 1.6rem 0; }
.cf-main .rp-title { font-size: 3.4rem; }
.cf-main .rp-help { height: 10.5rem; max-height: none; min-height: 0; }   /* a fixed height: see screens.css */
.cf-main .ab-row { padding: .2rem .6rem; }
.cf-main .ab-totals { margin: .6rem 0 .4rem; }
/* the actions along the bottom, as on the launcher's pages */
.cf-bottom { position: absolute; left: 0; right: 0; top: 64rem; height: 4.4rem; display: flex; justify-content: center; gap: 2.6rem; z-index: 3; }
.cf-bottom .cv-plate { width: 17.5rem; height: 4.4rem; margin-left: 0; }
.cf-bottom .cv-plate > .plaque { font-size: 1.9rem; }
/* the narrow summary card (journal.js: compactSummary) */
.cf-summary .cf-inner { overflow-y: auto; scrollbar-width: thin; }
.cs-portrait { width: 15rem; height: 18.6rem; margin: 0 auto 1rem; border-radius: .6rem; overflow: hidden; border: .2rem solid #3a2412; box-shadow: 0 .3rem .8rem rgba(0, 0, 0, .45), inset 0 0 1rem rgba(0, 0, 0, .4);
  background: rgba(90, 55, 20, .18); display: grid; place-items: center; font-family: var(--f-display); font-size: 5rem; color: rgba(90, 55, 20, .45); flex: none; }
.cs-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cs-name { font-family: var(--f-display); font-size: 2.4rem; text-align: center; color: #7a1a10; line-height: 1.1; }
.cs-id { text-align: center; font-size: 1.55rem; line-height: 1.35; margin-top: .3rem; }
.cs-div { margin: .9rem 0 .7rem; flex: none; }
.cs-abs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 1.6rem; row-gap: .2rem; }
.cs-ab { display: flex; justify-content: space-between; font-size: 1.6rem; }
.cs-ab span { font-family: var(--f-display); } .cs-ab b { font-weight: normal; }
.cs-nums { display: flex; justify-content: space-between; }
.cs-num { display: flex; flex-direction: column; align-items: center; }
.cs-num span { font-family: var(--f-sc, var(--f-display)); font-size: 1.3rem; color: #6a4420; }
.cs-num b { font-family: var(--f-display); font-weight: normal; font-size: 2.2rem; }

/* ---- in-game journal, restyled around the book (21 October) */
/* footer actions: torn parchment plates pinned by a gem mount (platesIn in gameBook.js) */
.gb-foot { gap: 1.2rem; padding: .7rem 0 .3rem; }
.gb-foot .cv-plate { width: 13.6rem; height: 3.6rem; margin-left: 1.9rem; }
.gb-foot .cv-plate > .plaque { font-size: 1.75rem; padding: 0 .6rem 0 1.4rem; }
.gb-foot .cv-plate .cv-mount { width: 3.4rem; left: -1.6rem; }
.gb-foot.gb-foot-btns { justify-content: space-between; gap: .4rem; }
.gb-foot.gb-foot-btns .cv-plate { width: 9.4rem; margin-left: 1.7rem; }
.gb-foot.gb-foot-btns .cv-plate > .plaque { font-size: 1.6rem; padding: 0 .4rem 0 1.2rem; }
/* Options: ruby gem toggles and amber gem slider handles, as on the launcher's Options pages */
.gb-options input[type=checkbox] { appearance: none; -webkit-appearance: none; width: 2.4rem; height: 2.4rem; margin: 0; cursor: pointer; border: 0;
  background: url(../assets/ui/launcher/gems/gem_ruby_off.png) center / contain no-repeat; filter: drop-shadow(0 .1rem .15rem rgba(0,0,0,.4)); }
.gb-options input[type=checkbox]:checked { background-image: url(../assets/ui/launcher/gems/gem_ruby_lit.png); }
.gb-options input[type=checkbox]:hover { filter: brightness(1.15) drop-shadow(0 .1rem .15rem rgba(0,0,0,.4)); }
.gb-options input[type=range] { -webkit-appearance: none; appearance: none; height: 2rem; background: transparent; cursor: pointer; }
.gb-options input[type=range]::-webkit-slider-runnable-track { height: .5rem; border-radius: 99px; background: linear-gradient(90deg, rgba(90,40,16,.35), rgba(138,42,16,.75)); box-shadow: inset 0 1px 2px rgba(0,0,0,.5); }
.gb-options input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 2rem; height: 2rem; margin-top: -.75rem; border: 0; background: url(../assets/ui/launcher/gems/gem_amber_lit.png) center / contain no-repeat; }
.gb-options input[type=range]::-moz-range-track { height: .5rem; border-radius: 99px; background: linear-gradient(90deg, rgba(90,40,16,.35), rgba(138,42,16,.75)); }
.gb-options input[type=range]::-moz-range-thumb { width: 2rem; height: 2rem; border: 0; background: url(../assets/ui/launcher/gems/gem_amber_lit.png) center / contain no-repeat; }

/* ---- merchant window on the launcher's cover (shop.js) */
.shopframe.cover { overflow: hidden; border-radius: .3rem; }
.shopframe.cover .shopframe-bg { border-radius: .3rem; }
.shopframe.cover .cf-title { top: 1.2rem; }
.shopframe.cover .cv-gold { font-size: 3.4rem; }
.shopframe.cover .cv-knot { width: 16rem; }
.shopframe.cover > .sf-left { left: 3.4rem; top: 7.2rem; bottom: 3rem; width: calc(56% - 4.4rem); z-index: 2; }
.shopframe.cover > .sf-right { right: 3.4rem; top: 9.4rem; bottom: 5rem; width: calc(44% - 4.2rem); z-index: 2; }
.sh-act .cv-plate, .sh-rent .cv-plate, .shopframe .sh-donatebtn { flex: none; }
.sh-act .cv-plate, .sh-rent .cv-plate, .shopframe .cv-plate:has(.sh-donatebtn) { width: 13.6rem; height: 3.6rem; margin-left: 1.9rem; }
.sh-act .cv-plate.long, .sh-rent .cv-plate.long { width: 19rem; }
.sh-act .cv-plate > .plaque, .sh-rent .cv-plate > .plaque, .shopframe .cv-plate > .sh-donatebtn { font-size: 1.75rem; padding: 0 .6rem 0 1.4rem; }
.sh-act .cv-plate .cv-mount, .sh-rent .cv-plate .cv-mount, .shopframe .cv-plate:has(.sh-donatebtn) .cv-mount { width: 3.4rem; left: -1.6rem; }

/* ---- dialogs (core/ui.js modal) in the launcher's page style */
.dlg { position: relative; width: 66rem; max-width: 92vw; max-height: 92vh; padding: 2rem 3.4rem 2.4rem; border-radius: .4rem; display: flex; flex-direction: column;
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, .7), inset 0 0 0 .1rem rgba(0, 0, 0, .5); animation: cardin .28s cubic-bezier(.2, .9, .3, 1.2); }
.dlg > .cv-seam { z-index: 0; }
.dlg-title { position: relative; z-index: 2; display: flex; justify-content: center; align-items: center; gap: 1.6rem; margin: .2rem 0 1.4rem; }
.dlg-title .cv-gold { font-size: 3.2rem; text-align: center; }
.dlg-title .cv-knot { width: 12rem; flex: none; }
.dlg > .card { position: relative; z-index: 2; width: auto; min-height: 12rem; max-height: none; flex: 1 1 auto; min-height: 0; border: 0; border-radius: .5rem;
  background: var(--parch) repeat; background-size: 34rem; padding: 2.4rem 3rem 2rem; animation: none;
  box-shadow: inset 0 0 2.4rem rgba(110, 70, 25, .45), 0 .6rem 1.4rem rgba(0, 0, 0, .55); }
.dlg > .card .card-body { max-height: 60vh; }
.dlg-actions { position: relative; z-index: 2; display: flex; justify-content: center; flex-wrap: wrap; gap: 1.6rem 2.4rem; margin-top: 1.8rem; }
.dlg-actions .cv-plate { width: 14.4rem; height: 4rem; margin-left: 1.9rem; }
.dlg-actions .cv-plate.long { width: 20rem; }
.dlg-actions .cv-plate > .plaque { font-size: 1.85rem; padding: 0 .6rem 0 1.4rem; }
.dlg-actions .cv-plate .cv-mount { width: 3.6rem; left: -1.7rem; }
.dlg-clasp { width: 7.6rem; }
.dlg-clasp.tr { top: -.2rem; right: -.2rem; } .dlg-clasp.bl { bottom: -.2rem; left: -.2rem; }

/* ---- HUD (game.js): the original leather, with hand-sewn seams and a gold-leaf area name; plain menu buttons */
.sewn > .cv-seam { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hb-area.cv-gold { font-size: 2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding: .1rem .2rem; }

/* in the game, the merchant window and dialogs use the original leather too (no grunge layers) */
.shopframe.cover .shopframe-bg.cv-cover, .dlg.cv-cover { background: var(--leather) repeat; background-size: 32rem; box-shadow: inset 0 0 0 .15rem rgba(0, 0, 0, .55), inset 0 0 3rem rgba(0, 0, 0, .55), 0 1.5rem 3rem rgba(0, 0, 0, .7); }
.shopframe.cover .shopframe-bg.cv-cover::before, .shopframe.cover .shopframe-bg.cv-cover::after, .dlg.cv-cover::before, .dlg.cv-cover::after { display: none; }

/* ---- the helper's painted torn-parchment plates (task 038) on every plate, composed per button at its
   exact size by coverArt.js (paintPlate): no mask, no drawn parchment once painted */
.cv-plate > .plaque.painted { -webkit-mask-image: none !important; mask-image: none !important; background-color: transparent !important; background-position: center !important; background-size: 100% 100% !important; background-repeat: no-repeat !important; box-shadow: none; }
