/* Title / home: one framed, illustrated menu. Grid: [pack+stats | logo + hero + banners | sidebar], class panel across the bottom.
   Parts: js/ui/titleParts.js, js/ui/classPreview.js. Backdrop = Classic loading-screen art (assets/ui/title-bg-stratholme.webp). */
#app[data-screen="title"] { padding-bottom: 12px; max-width: 1700px; --chrome: 138px; }
@media (min-width: 1300px) { #app[data-screen="title"] { --chrome: 100px; } }
body:has(#app[data-screen="title"]) .set-gear { display: none; }   /* Settings lives in the sidebar */

.title { position: relative; height: calc(100dvh - var(--chrome)); min-height: 560px; text-align: left; overflow: hidden;
  display: grid; grid-template-columns: 310px minmax(0, 1fr) 118px; grid-template-rows: auto 1fr auto; gap: 8px 14px; padding: 8px 10px 8px 12px;
  border: 22px solid transparent; border-image: url(../assets/ui/frame-wood.png) 64 / 22px stretch; border-radius: 0;
  background: radial-gradient(ellipse at 50% 45%, transparent 35%, rgba(30,10,0,.72) 100%), linear-gradient(rgba(25,10,0,.18), rgba(25,10,0,.38)), url(../assets/ui/title-bg-stratholme.webp) center / cover #1a0f06;
  background-clip: padding-box; box-shadow: 0 10px 40px rgba(0,0,0,.7); }

.ts-cap { display: block; font-family: var(--font-head); font-weight: normal; font-size: 15px; letter-spacing: .06em; color: var(--gold); text-shadow: 0 2px 0 #000, 0 0 6px #000; margin-bottom: 4px; }

/* logo */
.ts-logo { grid-column: 2; grid-row: 1; z-index: 3; align-self: start; display: flex; align-items: center; justify-content: center; gap: 14px; pointer-events: none; }
.ts-logo h1 { display: flex; flex-direction: column; align-items: center; margin: 0; line-height: .86; font-size: clamp(34px, 4.6vw, 62px); letter-spacing: .03em; color: #ffd100;
  text-shadow: 0 3px 0 #5a2a00, 0 -1px 0 #fff2a8, 0 0 22px rgba(255,150,0,.55), 0 5px 10px #000; }
.ts-logo h1 span:last-child { font-size: .8em; }
.ts-emblem { width: clamp(34px, 3.6vw, 52px); height: clamp(34px, 3.6vw, 52px); border-radius: 6px; box-shadow: 0 0 0 2px #000, 0 0 0 4px #c9a24a, 0 0 18px rgba(255,170,0,.5); }
.ts-emblem.l { transform: rotate(-8deg); } .ts-emblem.r { transform: rotate(8deg); }

/* starter pack: leather satchel hugging the (cropped) board exactly */
.ts-pack { grid-column: 1; grid-row: 1; align-self: start; justify-self: start; z-index: 2; max-width: 100%; }
.ts-satchel { display: inline-block; max-width: 100%; padding: 12px; overflow: hidden; border-radius: 12px; border: 2px solid #1a0d04; background: linear-gradient(145deg, #7a4a24, #4a2a12 55%, #6a3d1c);
  box-shadow: inset 0 0 0 2px #b07a3c, inset 0 0 14px rgba(0,0,0,.6), 0 6px 14px rgba(0,0,0,.65); }
.ts-satchel .board { display: block; background-color: rgba(10,6,3,.35); border-radius: 6px; }

/* stats parchment */
.ts-stats { grid-column: 1; grid-row: 2; align-self: end; z-index: 2; width: 100%; max-width: 280px; padding: 8px 12px; border: 22px solid transparent; border-image: url(../assets/ui/frame-wood.png) 64 / 22px stretch; border-radius: 0; position: relative; color: #3a2410; }
.ts-stats::before { content: ""; position: absolute; inset: -4px; z-index: -1; background: url(../assets/ui/questbg-parchment.png) center / 100% 100%; }
.ts-statname { display: block; font-family: var(--font-head); font-size: 24px; font-weight: normal; color: var(--cc); text-shadow: 0 1px 0 #000, 0 0 2px #000, 1px 1px 0 #000, -1px -1px 0 #000; line-height: 1.1; }
.ts-blurb { margin: 2px 0 6px; font-size: 12px; line-height: 1.3; color: #4a3218; }
.ts-stat { display: flex; justify-content: space-between; font-size: 14px; border-top: 1px solid rgba(90,58,24,.35); padding: 2px 0; }
.ts-stat b { color: #2a1604; }

/* centre: 3D hero (left) + banners/start (right) */
.ts-mid { grid-column: 2; grid-row: 1 / 3; position: relative; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; padding-top: 92px; z-index: 1; }
.ts-hero { position: relative; min-height: 0; }
.ts-hero::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: 1%; height: 8%; border-radius: 50%; pointer-events: none; background: radial-gradient(ellipse, color-mix(in srgb, var(--cc, #888) 65%, transparent), transparent 70%); }
.ts-hero > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.ts-menu { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; min-width: 0; padding-top: 6px; }

/* red cloth banner + plaque */
.ts-cont { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(240px, 100%); }
.ts-banner { position: relative; width: 100%; padding: 14px 10px 30px; border: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--gold);
  background: linear-gradient(90deg, rgba(0,0,0,.35), transparent 18%, transparent 82%, rgba(0,0,0,.35)), linear-gradient(180deg, #a8241a, #7a130c 70%, #5a0c07);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 16px), 0 100%); transition: filter .15s; }
.ts-banner::before { content: ""; position: absolute; inset: 0 0 auto; height: 8px; background: url(../assets/ui/wood-edge-top.png) left top / auto 100% repeat-x; }
.ts-banner::after { content: ""; position: absolute; inset: 8px 6px 18px; border: 1px solid rgba(255,209,0,.55); pointer-events: none; }
@media (hover: hover) { .ts-banner:hover { filter: brightness(1.18); } }
.ts-banner:focus-visible { outline: 2px solid #ffd100; outline-offset: 3px; }
.bn-title { font-family: var(--font-head); font-size: 22px; text-shadow: 0 2px 0 #000; line-height: 1.1; margin-top: 6px; }
.bn-class { font-size: 14px; text-shadow: 0 1px 0 #000, 0 0 3px #000; }
.bn-stats { display: flex; gap: 12px; margin-top: 2px; }
.bn-stat { display: inline-flex; align-items: center; gap: 4px; font-size: 16px; text-shadow: 0 1px 0 #000; }
.bn-stat img { width: 24px; height: 24px; border-radius: 4px; box-shadow: 0 0 0 1px #000, 0 0 0 2px #c9a24a; display: block; }
.ts-plaque { padding: 3px 16px; border: 2px solid #1a0d04; border-radius: 3px; font-size: 12px; color: #e8d9a8; text-shadow: 0 1px 0 #000;
  background: linear-gradient(#6a4220, #3e2410); box-shadow: inset 0 0 0 1px #b07a3c, 0 3px 5px rgba(0,0,0,.6); }
@media (hover: hover) { .ts-plaque:hover { filter: brightness(1.25); color: #fff; } }

/* START button: WoW 128-redbutton art (same pre-composited 88x64 set as the shop Fight button, 28px caps via border-image) */
.cp-start { box-sizing: border-box; width: min(300px, 100%); height: 64px; min-height: 64px; padding: 0 4px; border-style: solid; border-width: 0 28px; border-color: transparent; border-radius: 0; box-shadow: none; background: none;
  border-image: url(../assets/ui/fightbtn-n.png) 0 28 fill / 0 28px / 0 stretch;
  font-family: var(--font-head); font-size: 24px; line-height: 1; letter-spacing: .02em; color: #ffd100; text-shadow: 0 2px 0 #000, 0 0 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.7)); transition: filter .15s; }
@media (hover: hover) { .cp-start:hover:not(:disabled) { filter: brightness(1.18) drop-shadow(0 0 8px rgba(255,200,70,.5)) drop-shadow(0 3px 3px rgba(0,0,0,.7)); } }
.cp-start:active:not(:disabled) { border-image-source: url(../assets/ui/fightbtn-p.png); filter: brightness(.9) drop-shadow(0 1px 2px rgba(0,0,0,.7)); padding-top: 3px; }
.cp-start:focus-visible { outline: 2px solid #ffd100; outline-offset: 3px; }
.cp-start:disabled { border-image-source: url(../assets/ui/fightbtn-d.png); color: #9a8a60; filter: none; cursor: default; }

/* bottom carved panel: Choose Class + Loadout */
.ts-bottom { grid-column: 1 / 3; grid-row: 3; z-index: 2; display: flex; gap: 14px; align-items: stretch; padding: 8px 14px; border-radius: 8px; border: 2px solid #1a0d04;
  background: linear-gradient(180deg, rgba(58,36,18,.94), rgba(30,18,8,.96)); box-shadow: inset 0 0 0 1px #b07a3c, inset 0 0 18px rgba(0,0,0,.65), 0 6px 14px rgba(0,0,0,.6); }
.ts-classes { flex: 1; min-width: 0; }
.ts-cards { display: flex; align-items: flex-start; gap: 6px; flex-wrap: nowrap; }
.class-card { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 2px; background: none; border: 0; min-width: 0; flex: 1 1 0; max-width: 76px; }
.class-card .portrait { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--cc); transition: box-shadow .15s, transform .15s; }
.class-card .portrait img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); display: block; }
.class-card .cc-name { font-size: 11px; color: #cdbf9c; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 0 #000; }
@media (hover: hover) { .class-card:hover .portrait { transform: scale(1.06); } }
.class-card:focus-visible { outline: 1px dashed var(--gold); outline-offset: 2px; }
.class-card.picked .portrait { box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--gold), 0 0 18px 4px color-mix(in srgb, var(--gold) 60%, transparent); transform: scale(1.1); }
.class-card.picked .cc-name { color: var(--gold); }
.ts-die { flex: none; width: 46px; height: 46px; margin: 7px 0 0 6px; border-radius: 8px; border: 2px solid #1a0d04; font-size: 28px; line-height: 1; color: #ffd100; text-shadow: 0 2px 0 #000;
  background: linear-gradient(#7a4a24, #4a2a12); box-shadow: inset 0 0 0 1px #b07a3c, 0 3px 5px rgba(0,0,0,.6); }
@media (hover: hover) { .ts-die:hover { filter: brightness(1.25); } } .ts-die:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ts-loadout { flex: 0 0 270px; border-left: 1px solid rgba(176,122,60,.5); padding-left: 14px; min-width: 0; }
.ts-kit { display: flex; gap: 9px; align-items: center; padding: 6px 8px; border-radius: 6px; background: rgba(0,0,0,.35); box-shadow: inset 0 0 0 1px rgba(176,122,60,.5); }
.ts-kit::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold); background: radial-gradient(var(--gold) 38%, transparent 42%); }
.ts-kit img { width: 36px; height: 36px; flex: none; border-radius: 5px; box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--cc, #c9a24a); }
.ts-kit b { display: block; color: var(--gold); font-weight: normal; font-size: 14px; }
.ts-kit span { display: block; color: #cdbf9c; font-size: 11.5px; line-height: 1.3; }

/* right wooden sidebar */
.ts-side { grid-column: 3; grid-row: 1 / 4; z-index: 2; display: flex; flex-direction: column; gap: 8px; align-items: stretch; justify-content: flex-start; align-self: stretch; padding: 10px 8px; border-radius: 8px; border: 2px solid #1a0d04;
  background: linear-gradient(90deg, #5a3718, #6e4520 50%, #4a2c12); box-shadow: inset 0 0 0 1px #b07a3c, inset 0 0 16px rgba(0,0,0,.55), 0 6px 14px rgba(0,0,0,.6); }
.sb-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 6px; border: 1px solid transparent; background: rgba(0,0,0,.22); color: #f1dfae; font-size: 12px; text-align: center; text-decoration: none; text-shadow: 0 1px 0 #000; }
@media (hover: hover) { .sb-btn:hover { background: rgba(255,200,70,.18); border-color: #c9a24a; color: #fff; } }
.sb-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.sb-ico { width: 40px; height: 40px; border-radius: 6px; overflow: hidden; display: grid; place-items: center; box-shadow: 0 0 0 1px #000, 0 0 0 2px #c9a24a; background: #1a0f06; }
.sb-ico img { width: 100%; height: 100%; display: block; }
.sb-gear { font-size: 26px; color: var(--gold); }
.ts-ver { margin-top: auto; text-align: center; color: rgba(232,220,192,.6); font-size: 11px; }

/* how-to popover */
.how { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, 92%); display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 12px; background: #120e09; border: 1px solid var(--edge-hi); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.8); z-index: 50; text-align: left; }
.how[hidden] { display: none; }
.how .step { display: flex; gap: 10px; }
.how .art { width: 36px; height: 36px; flex: none; border-radius: 5px; overflow: hidden; box-shadow: 0 0 0 1px #000, 0 0 0 2px var(--edge-hi); }
.how .art img { width: 100%; height: 100%; display: block; }
.how b { color: var(--gold); font-family: var(--font-head); font-size: 17px; font-weight: normal; }
.how p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }

@media (min-width: 861px) and (max-height: 899px) { .ts-blurb { display: none; } .ts-statname { font-size: 22px; } }
@media (max-width: 1080px) { .title { grid-template-columns: 250px minmax(0, 1fr) 100px; } .ts-loadout { flex-basis: 210px; } .class-card .portrait { width: 44px; height: 44px; } }
@media (max-width: 860px) {
  .title { height: auto; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 6px 4px 10px; border-width: 14px; border-image-width: 14px; }
  .ts-logo { order: 1; } .ts-mid { order: 2; display: flex; flex-direction: column-reverse; padding-top: 0; gap: 6px; } .ts-bottom { order: 3; flex-direction: column; }
  .ts-pack { order: 4; } .ts-stats { order: 5; max-width: none; } .ts-side { order: 6; flex-direction: row; align-self: stretch; } .sb-btn { flex: 1; }
  .ts-hero { height: 190px; flex: none; }
  .ts-cards { flex-wrap: wrap; justify-content: center; } .class-card { flex: 0 0 18%; max-width: none; } .class-card .portrait { width: 40px; height: 40px; }
  .ts-loadout { flex: none; border-left: 0; padding-left: 0; border-top: 1px solid rgba(176,122,60,.5); padding-top: 6px; }
  .ts-ver { margin: 0 0 0 auto; align-self: center; }
  .how { grid-template-columns: 1fr; position: fixed; }
}
@media (max-width: 640px) { .cp-start { font-size: 20px; } }
.ts-banner:active, .ts-plaque:active, .ts-die:active, .sb-btn:active { filter: brightness(.9); transform: scale(.96); }
.class-card:active .portrait { transform: scale(.96); }
@media (pointer: coarse) { .cp-start { filter: drop-shadow(0 2px 2px rgba(0,0,0,.7)); } .class-card.picked .portrait { box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--gold), 0 0 10px 2px color-mix(in srgb, var(--gold) 60%, transparent); } }
