/* Title / login screen (redesign 2026-10-14, owner: "หน้าล็อคอินผมว่าไม่ค่อยสวยเลยออกแบบใหม่ได้ไหม").
   Same house style as the front page (home.css): the painted key visual drifting slowly with gold motes over it, the painted
   logo, and one navy glass panel with gold corner ornaments whose content swaps between views (#title[data-view]):
   boot (art loading) / acc (play now + sign in / sign up) / chars (character cards) / create (name + Novice preview) / offline.
   Logic in src/title.js. Loaded last (index.html), every rule is under #title so nothing leaks into the HUD. */
#title {
  --tx: #eef0f6; --tx2: #b9c1d6; --tx3: #8992ab; --au: #e8c26a; --au2: #f6dc96; --au3: #c99a3c; --okc: #6fe39a; --bad: #ff8f8a;
  --ln: rgba(232, 194, 106, .34); --ln2: rgba(232, 194, 106, .16); --navy: rgba(16, 23, 44, .8); --hue: var(--au);
  position: fixed; inset: 0; z-index: 6; display: block; overflow: hidden auto; overscroll-behavior: contain;
  background: #0b1020; color: var(--tx); font: 400 15px/1.5 Prompt, 'Noto Sans Thai', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased;
}
#title * { box-sizing: border-box; }
#title button, #title input { font: inherit; color: inherit; }
#title button { cursor: pointer; }
/* the title fades out over the world when a character enters (title.js closeTitle) */
#title.ts-out { opacity: 0; transition: opacity .7s ease; pointer-events: none; }

/* ---------- background: key visual (slow drift + pointer parallax on PC), motes, shade ---------- */
.ts-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.ts-kb { position: absolute; inset: -3%; animation: tsKen 46s ease-in-out infinite alternate; will-change: transform; }
.ts-kb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 66% 38%; image-rendering: auto;
  opacity: 0; transform: translate3d(var(--px, 0px), var(--py, 0px), 0); transition: opacity 1.4s ease, transform 1.2s cubic-bezier(.2, .7, .2, 1); }
#title.ts-key .ts-kb img { opacity: 1; }
@keyframes tsKen { from { transform: scale(1); } to { transform: scale(1.07) translate3d(-1.2%, -.6%, 0); } }
#tsMotes { position: absolute; inset: 0; width: 100%; height: 100%; }
/* text side darker so the panel reads; the heroes on the right stay bright */
.ts-shade { position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(9, 13, 26, .78) 0%, rgba(9, 13, 26, .45) 32%, rgba(9, 13, 26, 0) 56%),
    linear-gradient(180deg, rgba(9, 13, 26, .25) 0%, rgba(9, 13, 26, 0) 22%, rgba(9, 13, 26, 0) 72%, rgba(9, 13, 26, .7) 100%); }
#title[data-view="chars"] .ts-shade, #title[data-view="create"] .ts-shade {
  background: radial-gradient(ellipse at 50% 55%, rgba(9, 13, 26, .35), rgba(9, 13, 26, .78) 75%); }

/* ---------- stage: brand + panel ---------- */
.ts-stage { position: relative; min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 14px;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(5.5vw, 24px, env(safe-area-inset-left)); }
#title[data-view="chars"] .ts-stage, #title[data-view="create"] .ts-stage { align-items: center; padding-left: max(24px, env(safe-area-inset-left)); }
.ts-brand { width: min(440px, 100%); text-align: center; }
.ts-logo { margin: 0; line-height: 0; }
.ts-logo img { width: min(420px, 100%); height: auto; image-rendering: auto; filter: drop-shadow(0 8px 26px rgba(0, 0, 0, .6)); }
.ts-tag { margin: 2px 0 0; color: var(--tx); font-size: 15px; font-weight: 500; text-shadow: 0 1px 8px rgba(0, 0, 0, .95); }
.ts-live { display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 3px 12px; border-radius: 999px; font-size: 13px; color: var(--tx2);
  background: rgba(9, 13, 26, .62); border: 1px solid var(--ln2); }
.ts-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--okc); box-shadow: 0 0 8px var(--okc); animation: tsPulse 2.4s ease-in-out infinite; }
@keyframes tsPulse { 50% { opacity: .45; } }
#title[data-view="chars"] .ts-brand, #title[data-view="create"] .ts-brand { width: min(320px, 100%); }
#title[data-view="chars"] .ts-tag, #title[data-view="create"] .ts-tag, #title[data-view="chars"] .ts-live, #title[data-view="create"] .ts-live { display: none; }

/* the glass panel: navy, gold hairlines, painted corner ornaments (front page art) */
.ts-panel { position: relative; width: min(440px, 100%); padding: 24px 24px 18px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(24, 34, 62, .8), rgba(11, 16, 31, .88)); border: 1px solid var(--ln);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .07); backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15); }
.ts-panel::before { content: ''; position: absolute; inset: 5px; border-radius: 14px; border: 1px solid var(--ln2); pointer-events: none; }
#title[data-view="chars"] .ts-panel { width: min(860px, 100%); }
#title[data-view="create"] .ts-panel { width: min(720px, 100%); }
.ts-c { position: absolute; width: 54px; height: 54px; pointer-events: none; background: url(assets/ui/home/art/corner.webp) center / contain no-repeat; }
.ts-c.tl { left: -7px; top: -7px; } .ts-c.tr { right: -7px; top: -7px; transform: scaleX(-1); }
.ts-c.bl { left: -7px; bottom: -7px; transform: scaleY(-1); } .ts-c.br { right: -7px; bottom: -7px; transform: scale(-1, -1); }
/* phones: blur over a moving picture costs every frame there, so a deeper colour instead */
@media (pointer: coarse) { .ts-panel { backdrop-filter: none; -webkit-backdrop-filter: none; background: linear-gradient(180deg, rgba(22, 31, 58, .93), rgba(10, 15, 29, .96)); } }

.ts-view.in { animation: tsIn .34s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes tsIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- loading (art still coming in) ---------- */
#title #loading { padding: 6px 0 2px; text-align: center; }
#title #loading small { color: var(--tx2); font-size: 13px; }
#title .lb { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .45); overflow: hidden; margin: 0 0 8px; box-shadow: inset 0 0 0 1px rgba(232, 194, 106, .18); }
#title .lb i { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #b98a34, #f6dc96); box-shadow: 0 0 10px rgba(246, 220, 150, .6); transition: width .25s; }

/* ---------- buttons ---------- */
.ts-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 0; padding: 6px 16px;
  border-radius: 12px; border: 1px solid var(--ln); background: rgba(255, 255, 255, .045); color: var(--au2) !important; font-size: 16px !important; font-weight: 600;
  overflow: hidden; transition: transform .14s, box-shadow .18s, filter .18s, background .18s; touch-action: manipulation; }
.ts-btn:hover { background: rgba(255, 255, 255, .08); }
.ts-btn:active { transform: translateY(1px) scale(.99); }
.ts-btn.gold { color: #2a1d05 !important; border-color: #f3d48a; background: linear-gradient(#f9e4a6, #d4a547 60%, #b98a34);
  box-shadow: 0 6px 22px rgba(232, 194, 106, .3), inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(120, 80, 20, .35); }
.ts-btn.gold:hover { filter: brightness(1.07); box-shadow: 0 8px 30px rgba(232, 194, 106, .45), inset 0 1px 0 rgba(255, 255, 255, .7); }
.ts-btn.ts-big { min-height: 66px; }
.ts-btn.ts-big b { font-size: 21px; font-weight: 700; line-height: 1.2; letter-spacing: .02em; }
.ts-btn.ts-big small { font-size: 12.5px; font-weight: 500; opacity: .78; }
/* a slow light sweep over the main button */
.ts-btn.ts-big::after { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; transform: skewX(-20deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: tsShine 4.5s ease-in-out 1.2s infinite; }
@keyframes tsShine { 0%, 70% { left: -40%; } 100% { left: 130%; } }
.ts-btn.ghost { color: var(--tx2) !important; border-color: rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .03); }
.ts-btn.danger { color: #fff !important; border-color: #ff8f8a; background: linear-gradient(#e0574f, #a8302b); }
.ts-btn:disabled { opacity: .45; cursor: default; filter: saturate(.6); }
.ts-btn.busy { pointer-events: none; color: transparent !important; }
.ts-btn.busy > * { visibility: hidden; }
.ts-btn.busy::before { content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .25); border-top-color: currentColor; color: var(--au2); animation: tsSpin .8s linear infinite; }
.ts-btn.gold.busy::before { color: #3a2808; border-color: rgba(58, 40, 8, .25); border-top-color: #3a2808; }
@keyframes tsSpin { to { transform: rotate(360deg); } }
.ts-btn:focus-visible, .ts-link:focus-visible, .ts-tabs button:focus-visible, .ts-card:focus-visible, .ts-del:focus-visible, .ts-eye:focus-visible {
  outline: 2px solid var(--au2); outline-offset: 2px; }
.ts-link { min-height: 44px; padding: 0 10px; border: 0; background: none; color: var(--tx2) !important; font-size: 14px !important; font-weight: 500; text-decoration: underline;
  text-decoration-color: rgba(185, 193, 214, .4); text-underline-offset: 3px; }
.ts-link:hover { color: var(--au2) !important; }

/* ---------- account view ---------- */
.ts-or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--tx3); font-size: 13px; }
.ts-or::before, .ts-or::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--ln)); }
.ts-or::after { background: linear-gradient(90deg, var(--ln), transparent); }
/* Sign in with Google (feat/google-login): Google's light button (branding guidelines: white fill, #747775 1px edge, #1F1F1F
   text, the four-colour G at 18 px, Roboto Medium 14 px, pill), not restyled into the game's look on purpose */
#title .ts-gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 44px; margin: 0 0 12px; padding: 0 12px;
  border: 1px solid #747775; border-radius: 22px; background: #fff; color: #1f1f1f !important; cursor: pointer;
  font: 500 14px/20px Roboto, 'Prompt', Arial, sans-serif; letter-spacing: .25px; transition: background .15s, box-shadow .15s; }
#title .ts-gbtn[hidden] { display: none; }
#title .ts-gbtn:hover { background: #f8faff; box-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15); }
#title .ts-gbtn:active { background: #eef3fd; }
#title .ts-gbtn:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 2px; }
#title .ts-gbtn.busy { opacity: .6; pointer-events: none; }
#title .ts-glogo { width: 18px; height: 18px; flex: none; }
.ts-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 12px; background: rgba(0, 0, 0, .32); border: 1px solid rgba(255, 255, 255, .06); }
.ts-tabs button { min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--tx2); font-size: 15px; font-weight: 500; transition: background .2s, color .2s; }
.ts-tabs button[aria-selected="true"] { background: linear-gradient(180deg, rgba(232, 194, 106, .26), rgba(232, 194, 106, .12)); color: var(--au2); box-shadow: inset 0 0 0 1px var(--ln); }
#accForm, .ts-cform { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.ts-field { position: relative; display: block; margin: 0; }
.ts-field > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } /* screen readers; the placeholder shows it */
.ts-field input { display: block; width: 100%; height: 50px; margin: 0; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(232, 194, 106, .26);
  background: rgba(4, 7, 16, .55); color: var(--tx); font-size: 16px !important; /* 16 px: iOS zooms into anything smaller */ outline: none;
  transition: border-color .2s, box-shadow .2s; }
.ts-field input::placeholder { color: var(--tx3); }
.ts-field input:focus { border-color: var(--au); box-shadow: 0 0 0 3px rgba(232, 194, 106, .18); }
.ts-field.bad input { border-color: var(--bad); }
.ts-field.good input { border-color: rgba(111, 227, 154, .7); }
.ts-field.pw input { padding-right: 52px; }
.ts-eye { position: absolute; right: 3px; top: 3px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; opacity: .75; }
.ts-eye::before { content: ''; position: absolute; inset: 11px; background: var(--tx2);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / contain no-repeat; }
.ts-eye[aria-pressed="true"]::before { background: var(--au2);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.9 17.9A10.1 10.1 0 0 1 12 19c-7 0-11-7-11-7a18.5 18.5 0 0 1 5.1-5.9M9.9 5.2A9.1 9.1 0 0 1 12 5c7 0 11 7 11 7a18.5 18.5 0 0 1-2.2 3.2M14.1 14.1a3 3 0 1 1-4.2-4.2'/%3E%3Cpath d='M1 1l22 22'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.9 17.9A10.1 10.1 0 0 1 12 19c-7 0-11-7-11-7a18.5 18.5 0 0 1 5.1-5.9M9.9 5.2A9.1 9.1 0 0 1 12 5c7 0 11 7 11 7a18.5 18.5 0 0 1-2.2 3.2M14.1 14.1a3 3 0 1 1-4.2-4.2'/%3E%3Cpath d='M1 1l22 22'/%3E%3C/svg%3E"); }
.ts-rule { margin: -2px 2px 0; color: var(--tx3); font-size: 12.5px; line-height: 1.45; }
.ts-rule b { color: var(--tx2); font-weight: 500; }
.ts-rule .ts-ok { color: var(--okc); }
#btnLogin, #btnReg { margin-top: 2px; }
#btnLogin:not(:disabled), #btnReg:not(:disabled) { color: #2a1d05 !important; border-color: #f3d48a; background: linear-gradient(#f9e4a6, #d4a547 60%, #b98a34);
  box-shadow: 0 4px 16px rgba(232, 194, 106, .22), inset 0 1px 0 rgba(255, 255, 255, .7); }
.ts-msg { min-height: 0; margin: 10px 0 0; color: var(--bad); font-size: 14px; line-height: 1.45; text-align: center; }
.ts-msg:empty { display: none; }
.ts-msg.info { color: var(--tx2); }
.ts-notice { margin: 0 0 14px; padding: 10px 12px; border-radius: 10px; font-size: 14px; line-height: 1.45; color: #ffd9d6;
  background: rgba(150, 40, 36, .35); border: 1px solid rgba(255, 143, 138, .45); }
.ts-hint { margin: 10px 0 0; color: var(--tx3); font-size: 13px; text-align: center; }
#titleBtns { display: flex; flex-direction: column; gap: 10px; }
#titleBtns:not([hidden]) { display: flex; }
#titleBtns[hidden], #netBox[hidden], .ts-view[hidden] { display: none !important; }
#btnContinue { font-size: 18px !important; }

/* ---------- character cards ---------- */
.ts-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: -4px 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--ln2); }
.ts-head h2, .ts-cform h2 { margin: 0; font-size: 22px; font-weight: 600; color: var(--au2); letter-spacing: .02em; }
.ts-who { display: flex; align-items: center; gap: 4px; margin: 0; color: var(--tx3); font-size: 13.5px; min-width: 0; }
.ts-who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-who b { color: var(--tx2); font-weight: 500; }
.ts-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.ts-card { --hue: var(--au); position: relative; display: flex; flex-direction: column; min-width: 0; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, rgba(30, 42, 76, .9), rgba(12, 17, 33, .95)); border: 1px solid rgba(232, 194, 106, .26);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35); transition: transform .2s, box-shadow .2s, border-color .2s; }
.ts-card:hover { transform: translateY(-3px); border-color: var(--hue); box-shadow: 0 14px 34px rgba(0, 0, 0, .45), 0 0 0 1px var(--hue), 0 0 26px color-mix(in srgb, var(--hue) 30%, transparent); }
.ts-card.is-new { border-color: var(--au2); box-shadow: 0 0 0 2px rgba(246, 220, 150, .5), 0 0 30px rgba(246, 220, 150, .3); }
.ts-art { position: relative; height: 214px; overflow: hidden;
  background: radial-gradient(ellipse 70% 26% at 50% 92%, color-mix(in srgb, var(--hue) 45%, transparent), transparent 70%),
    radial-gradient(ellipse at 50% 30%, rgba(255, 255, 255, .07), transparent 65%), linear-gradient(180deg, rgba(12, 18, 36, .2), rgba(0, 0, 0, .25)); }
.ts-art canvas { position: absolute; left: 50%; bottom: 4px; height: 206px; width: auto; aspect-ratio: 195 / 200; transform: translateX(-50%);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .55)); }
.ts-crest { position: absolute; left: 8px; top: 8px; width: 36px; height: 36px; image-rendering: auto; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6)); }
.ts-lv { position: absolute; right: 8px; bottom: 8px; padding: 1px 9px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--au2);
  background: rgba(8, 12, 24, .78); border: 1px solid var(--ln); }
.ts-del { position: absolute; right: 4px; top: 4px; width: 44px; height: 44px; border: 0; border-radius: 10px; background: none; opacity: .55; transition: opacity .2s, background .2s; }
.ts-del::before { content: ''; position: absolute; inset: 12px; background: #ffd9d6;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6'/%3E%3C/svg%3E") center / contain no-repeat; }
.ts-del:hover, .ts-del:focus-visible { opacity: 1; background: rgba(160, 40, 36, .55); }
.ts-info { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; min-width: 0; flex: 1; }
.ts-info b { font-size: 18px; font-weight: 600; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-info .ts-job { color: var(--hue); font-size: 14px; font-weight: 500; filter: brightness(1.25); }
.ts-info .ts-meta { color: var(--tx3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ts-info .ts-btn { margin-top: 8px; min-height: 46px; }
.ts-card.ts-empty { align-items: center; justify-content: center; gap: 8px; min-height: 330px; padding: 16px; border: 1px dashed rgba(232, 194, 106, .38);
  background: rgba(10, 15, 30, .45); color: var(--au2); text-align: center; }
.ts-card.ts-empty:hover { background: rgba(232, 194, 106, .08); }
.ts-plus { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 36px; line-height: 1; font-weight: 300;
  border: 1px solid var(--ln); background: radial-gradient(circle, rgba(232, 194, 106, .2), rgba(232, 194, 106, .04)); box-shadow: 0 0 24px rgba(232, 194, 106, .18); }
.ts-card.ts-empty span { display: flex; flex-direction: column; align-items: inherit; gap: 2px; }
.ts-card.ts-empty b { font-size: 16px; font-weight: 600; }
.ts-card.ts-empty small { color: var(--tx3); font-size: 12.5px; }
.ts-card.locked { opacity: .45; pointer-events: none; }

/* ---------- create ---------- */
.ts-create { display: grid; grid-template-columns: 240px 1fr; gap: 22px; align-items: center; }
.ts-preview { position: relative; text-align: center; }
.ts-preview::before { content: ''; position: absolute; left: 10%; right: 10%; bottom: 30px; height: 46px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(232, 194, 106, .5), rgba(232, 194, 106, 0) 70%); }
.ts-preview canvas { position: relative; display: block; width: 234px; height: 240px; margin: 0 auto; filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .55)); }
.ts-preview p { margin: 2px 0 0; color: var(--au2); font-weight: 600; } .ts-preview small { color: var(--tx3); font-weight: 400; }
.ts-cform h2 { margin-bottom: 2px; }
.ts-count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 12.5px; color: var(--tx3); pointer-events: none; }
#newName { padding-right: 58px; }
.ts-check { margin: -4px 2px 0; min-height: 20px; color: var(--tx3); font-size: 13px; line-height: 1.45; }
.ts-check.bad { color: var(--bad); } .ts-check.good { color: var(--okc); }
.ts-next { margin: 0; padding: 10px 12px; border-radius: 10px; color: var(--tx2); font-size: 13.5px; line-height: 1.55;
  background: rgba(232, 194, 106, .07); border: 1px solid var(--ln2); }
.ts-next b { color: var(--au2); font-weight: 600; }
#btnBack { align-self: center; }

/* ---------- entering the world ---------- */
.ts-stage { transition: opacity .35s ease, transform .35s ease; }
#title.ts-entering .ts-stage { opacity: 0; transform: scale(.985); pointer-events: none; }
.ts-enter { position: fixed; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: radial-gradient(ellipse at 50% 55%, rgba(14, 20, 40, .55), rgba(6, 9, 18, .92) 70%); animation: tsFade .45s ease both; }
.ts-enter[hidden] { display: none; }
@keyframes tsFade { from { opacity: 0; } }
.ts-ring { position: absolute; left: 50%; top: 50%; width: min(420px, 86vw); aspect-ratio: 1; transform: translate(-50%, -56%); border-radius: 50%;
  background: conic-gradient(from 0deg, transparent, rgba(246, 220, 150, .55), transparent 30%, transparent 50%, rgba(246, 220, 150, .4), transparent 80%);
  -webkit-mask: radial-gradient(closest-side, transparent 92%, #000 93%, #000 97%, transparent 98%); mask: radial-gradient(closest-side, transparent 92%, #000 93%, #000 97%, transparent 98%);
  animation: tsSpin 3.2s linear infinite; }
.ts-ring::after { content: ''; position: absolute; inset: 9%; border-radius: 50%; border: 1px dashed rgba(246, 220, 150, .3); }
.ts-enter canvas { position: relative; width: min(260px, 60vw); height: auto; aspect-ratio: 195 / 200; filter: drop-shadow(0 0 24px rgba(246, 220, 150, .35)); animation: tsRise .7s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes tsRise { from { opacity: 0; transform: translateY(24px) scale(.94); } }
.ts-enter b { position: relative; font-size: 26px; font-weight: 600; color: var(--au2); text-shadow: 0 2px 12px rgba(0, 0, 0, .8); }
.ts-enter p { position: relative; margin: 0; color: var(--tx2); font-size: 15px; animation: tsPulse 1.6s ease-in-out infinite; }

/* ---------- delete dialog ---------- */
.ts-modal { position: fixed; inset: 0; z-index: 4; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 14, .7); animation: tsFade .2s ease both; }
.ts-modal[hidden] { display: none; }
.ts-dialog { width: min(400px, 100%); display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 22px 20px 18px; border-radius: 16px;
  background: linear-gradient(180deg, #1c2747, #0e1428); border: 1px solid rgba(255, 143, 138, .45); box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
.ts-dialog h3 { margin: 0; font-size: 20px; color: #ffd9d6; }
.ts-dialog p { margin: 0; color: var(--tx2); font-size: 14px; line-height: 1.55; }
.ts-dialog p b { color: var(--tx); }
.ts-dialog .ts-msg { margin: 0; }
.ts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }

/* ---------- PC wide: a little more room ---------- */
@media (min-width: 1600px) and (min-height: 900px) {
  .ts-brand, .ts-panel { width: 470px; }
  .ts-logo img { width: 460px; }
  .ts-art { height: 250px; } .ts-art canvas { height: 240px; }
}

/* ---------- phones, portrait: logo over the sky, the panel low on the painting's dark foot ---------- */
@media (max-width: 600px) and (orientation: portrait) {
  .ts-kb img { object-position: 50% 0; }
  .ts-shade { background: linear-gradient(180deg, rgba(9, 13, 26, .45) 0%, rgba(9, 13, 26, 0) 22%, rgba(9, 13, 26, 0) 44%, rgba(9, 13, 26, .55) 64%, rgba(9, 13, 26, .9) 100%); }
  .ts-stage { justify-content: space-between; align-items: stretch; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom)); min-height: 100dvh; }
  #title[data-view] .ts-stage { align-items: stretch; padding-left: 16px; }
  .ts-brand, #title[data-view] .ts-brand { width: auto; align-self: center; }
  .ts-logo img { width: min(300px, 78vw); }
  #title[data-view="chars"] .ts-logo img, #title[data-view="create"] .ts-logo img { width: min(220px, 60vw); }
  .ts-tag { font-size: 14px; }
  .ts-panel, #title[data-view] .ts-panel { width: 100%; padding: 18px 16px 14px; }
  .ts-c { width: 44px; height: 44px; }
  .ts-btn.ts-big { min-height: 62px; }
  .ts-or { margin: 12px 0 10px; }
  .ts-head h2, .ts-cform h2 { font-size: 19px; }
  /* cards become rows: art left, name / job / where + the play button right */
  .ts-cards { grid-template-columns: 1fr; gap: 10px; }
  .ts-card { flex-direction: row; }
  .ts-art { width: 96px; height: auto; min-height: 128px; flex: none; }
  .ts-art canvas { height: 122px; bottom: 2px; }
  .ts-crest { width: 26px; height: 26px; left: 4px; top: 4px; }
  .ts-lv { left: 50%; right: auto; bottom: 4px; transform: translateX(-50%); font-size: 12px; white-space: nowrap; }
  .ts-del { right: 0; top: 0; }
  .ts-info { padding: 8px 10px 10px 4px; justify-content: center; }
  .ts-info b { font-size: 17px; padding-right: 34px; } /* room for the delete button in the card's corner */
  .ts-head { flex-wrap: wrap; align-items: center; row-gap: 0; margin-bottom: 10px; padding-bottom: 6px; }
  .ts-head h2 { flex: 1 0 auto; }
  .ts-who { font-size: 12.5px; }
  .ts-who .ts-link { min-height: 44px; padding: 0 4px; font-size: 13px !important; }
  .ts-info .ts-btn { margin-top: 6px; min-height: 44px; }
  .ts-card.ts-empty { flex-direction: row; min-height: 72px; justify-content: flex-start; padding: 10px 14px; text-align: left; }
  .ts-card.ts-empty .ts-plus { width: 46px; height: 46px; font-size: 28px; flex: none; }
  .ts-card.ts-empty span { display: flex; flex-direction: column; }
  .ts-create { grid-template-columns: 1fr; gap: 10px; }
  .ts-preview { display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
  .ts-preview::before { left: 30%; right: 30%; bottom: 0; height: 30px; }
  .ts-preview canvas { width: 117px; height: 120px; margin: 0; }
  .ts-preview p { margin-bottom: 10px; text-align: left; display: flex; flex-direction: column; line-height: 1.3; }
  .ts-next { font-size: 13px; padding: 8px 10px; }
  .ts-enter canvas { width: min(220px, 56vw); }
}
/* very short portrait phones (iPhone SE class): smaller logo, the tag line goes */
@media (max-width: 600px) and (orientation: portrait) and (max-height: 700px) {
  .ts-logo img { width: min(240px, 66vw); }
  .ts-tag { display: none; }
}

/* ---------- phones, landscape (short): brand left, panel right, both in one screen ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .ts-kb img { object-position: 62% 30%; }
  .ts-stage, #title[data-view] .ts-stage { flex-direction: row; align-items: center; justify-content: center; gap: 18px; min-height: 100dvh;
    padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .ts-brand, #title[data-view] .ts-brand { width: min(270px, 34vw); flex: none; }
  .ts-logo img, #title[data-view] .ts-logo img { width: 100%; }
  .ts-tag { font-size: 13px; }
  #title[data-view="chars"] .ts-brand, #title[data-view="create"] .ts-brand { width: min(170px, 22vw); }
  .ts-panel { width: min(400px, 56vw); padding: 14px 16px 10px; max-height: calc(100dvh - 16px); overflow-y: auto; scrollbar-width: thin; }
  #title[data-view="chars"] .ts-panel { width: min(600px, 74vw); }
  #title[data-view="create"] .ts-panel { width: min(560px, 72vw); }
  .ts-c { width: 40px; height: 40px; }
  .ts-btn.ts-big { min-height: 56px; } .ts-btn.ts-big b { font-size: 19px; } .ts-btn.ts-big small { display: none; }
  .ts-or { margin: 6px 0; }
  .ts-rule br { display: none; } .ts-rule span + span::before { content: '  '; white-space: pre; } /* the two rules on one line */
  .ts-tabs { margin-bottom: 8px; } .ts-tabs button { min-height: 36px; }
  #accForm, .ts-cform { gap: 8px; }
  .ts-field input { height: 44px; }
  .ts-eye { width: 40px; height: 40px; top: 2px; }
  .ts-head { margin: -2px 0 8px; padding-bottom: 6px; } .ts-head h2, .ts-cform h2 { font-size: 18px; }
  .ts-cards { gap: 8px; }
  .ts-art { height: 128px; } .ts-art canvas { height: 122px; }
  .ts-crest { width: 26px; height: 26px; }
  .ts-info { padding: 6px 8px 8px; } .ts-info b { font-size: 15px; } .ts-info .ts-job { font-size: 13px; } .ts-info .ts-meta { font-size: 11.5px; }
  .ts-info .ts-btn { min-height: 44px; margin-top: 4px; }
  .ts-card.ts-empty { min-height: 230px; }
  .ts-create { grid-template-columns: 170px 1fr; gap: 12px; }
  .ts-preview canvas { width: 156px; height: 160px; }
  .ts-preview::before { bottom: 24px; }
  .ts-next { font-size: 12.5px; padding: 6px 10px; line-height: 1.45; }
  .ts-enter canvas { width: 150px; }
  .ts-ring { width: min(300px, 80vh); }
}

/* ---------- reduced motion: a still picture, no motes, no sweeps; views just appear ---------- */
@media (prefers-reduced-motion: reduce) {
  .ts-kb, .ts-btn.ts-big::after, .ts-live i, .ts-ring, .ts-enter p { animation: none !important; }
  .ts-kb img { transition: opacity .3s; transform: none !important; }
  .ts-view.in, .ts-enter, .ts-enter canvas, .ts-modal { animation: none !important; }
  #title.ts-out { transition: opacity .2s; }
  #tsMotes { display: none; }
  .ts-card, .ts-btn { transition: none; }
}

/* delete dialog (ui/nav 2026-10-14): the field says which name to type; the placeholder alone went away at the first letter */
#title .ts-dialog .ts-field > span { position: static; display: block; width: auto; height: auto; overflow: visible; clip: auto; margin: 0 0 6px; font-size: 13px; color: var(--tx2); }
#title .ts-dialog .ts-field > span b { color: #ffd9d6; }

/* a character in the game on another device right now (server /api/chars `on`, owner 2026-10-14) */
#title .ts-on { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: #10261a; background: #6fe39a; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); white-space: nowrap; }
#title .ts-info .ts-onnote { color: #8fe8b0; white-space: normal; }

/* ---------- living pixel scene (vis/title 2026-10-17, src/title-scene.js) ----------
   The canvas holds the art at its own size; JS sizes it to a whole number of device pixels per art pixel and centres it, so
   only `pixelated` is needed here. The key visual (.ts-kb) stays as the fallback and is hidden while the scene runs. */
#tsScene { position: absolute; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; animation: tsFade 1.2s ease both; }
@supports (image-rendering: pixelated) { #tsScene { image-rendering: pixelated; } }
#title.ts-scene .ts-kb { display: none; }
/* the panel side a touch lighter than over the busy painting: the scene is dark already */
#title.ts-scene .ts-shade { background: linear-gradient(90deg, rgba(9, 13, 26, .6) 0%, rgba(9, 13, 26, .3) 30%, rgba(9, 13, 26, 0) 52%),
  linear-gradient(180deg, rgba(9, 13, 26, .2) 0%, rgba(9, 13, 26, 0) 22%, rgba(9, 13, 26, 0) 74%, rgba(9, 13, 26, .55) 100%); }
#title.ts-scene[data-view="chars"] .ts-shade, #title.ts-scene[data-view="create"] .ts-shade {
  background: radial-gradient(ellipse at 50% 55%, rgba(9, 13, 26, .3), rgba(9, 13, 26, .72) 78%); }
@media (max-width: 600px) and (orientation: portrait) {
  #title.ts-scene .ts-shade { background: linear-gradient(180deg, rgba(9, 13, 26, .3) 0%, rgba(9, 13, 26, 0) 20%, rgba(9, 13, 26, 0) 42%, rgba(9, 13, 26, .5) 62%, rgba(9, 13, 26, .85) 100%); }
}
/* logo shine: a soft light sweeps across the painted logo every few seconds (masked by the logo itself) */
.ts-logo { position: relative; }
.ts-logo::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  -webkit-mask: url(assets/ui/home/art/logo.webp) center / contain no-repeat; mask: url(assets/ui/home/art/logo.webp) center / contain no-repeat;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 246, 214, .0) 44%, rgba(255, 246, 214, .7) 50%, rgba(255, 246, 214, 0) 56%, transparent 58%) no-repeat;
  background-size: 300% 100%; background-position: 100% 0; mix-blend-mode: screen; animation: tsShine 7.5s ease-in-out 1.5s infinite; }
@keyframes tsShine { 0%, 62% { background-position: 100% 0; } 92%, 100% { background-position: 0% 0; } }
@media (prefers-reduced-motion: reduce) { .ts-logo::after { animation: none; display: none; } #tsScene { animation: none; } }

/* ---------- character stages (vis/title 2026-10-17, src/title-stage.js) ----------
   The canvas fills the art box; the stage painting, the light and the hero are all drawn in it at whole scales. Cards not
   picked sit a little in the dark; the picked one lifts, its frame and the light on its platform glow in the line colour. */
#title .ts-art canvas.ts-stcv { position: absolute; inset: 0; left: 0; bottom: auto; width: 100%; height: 100%; aspect-ratio: auto; transform: none; filter: none; }
#title .ts-art { background: #0b1020; }
#title .ts-art::after { content: ''; position: absolute; inset: 0; pointer-events: none; transition: background .3s;
  background: linear-gradient(180deg, rgba(9, 13, 26, .25), rgba(9, 13, 26, 0) 30%, rgba(9, 13, 26, 0) 80%, rgba(9, 13, 26, .45)); }
#title .ts-card[data-pick]:not(.sel) .ts-art::after { background: linear-gradient(180deg, rgba(9, 13, 26, .45), rgba(9, 13, 26, .22) 40%, rgba(9, 13, 26, .5)); }
#title .ts-card[data-pick]:not(.sel) .ts-stcv { filter: saturate(.8); }
#title .ts-crest, #title .ts-lv, #title .ts-on, #title .ts-del { z-index: 1; }
#title .ts-card.sel { transform: translateY(-4px); border-color: var(--hue);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .5), 0 0 0 1px var(--hue), 0 0 30px color-mix(in srgb, var(--hue) 38%, transparent); }
#title .ts-card.sel .ts-info b { color: #fff; }
#title .ts-info b .vstar { font-size: .9em; }
/* open slot: the meadow stage with a faint novice outline under the + */
#title .ts-card.ts-empty { position: relative; overflow: hidden; }
#title .ts-card.ts-empty canvas.ts-ghost { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .7; transition: opacity .25s; }
#title .ts-card.ts-empty:hover canvas.ts-ghost, #title .ts-card.ts-empty:focus-visible canvas.ts-ghost { opacity: .85; }
#title .ts-card.ts-empty > :not(canvas) { position: relative; z-index: 1; text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
#title .ts-card.ts-empty .ts-plus { background: radial-gradient(circle, rgba(232, 194, 106, .35), rgba(12, 17, 33, .6)); animation: tsPlus 2.6s ease-in-out infinite; }
@keyframes tsPlus { 50% { box-shadow: 0 0 34px rgba(246, 220, 150, .45); transform: scale(1.06); } }
/* create: the stage box + the six class lines */
#title .ts-preview::before { display: none; }
#title .ts-preview canvas#newHero { width: 234px; height: 260px; border-radius: 14px; border: 1px solid var(--ln); filter: none; box-shadow: 0 10px 26px rgba(0, 0, 0, .45); }
#title .ts-lines { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 8px auto 0; width: 234px; }
#title .ts-lines button { --hue: var(--au); display: grid; place-items: center; min-height: 40px; padding: 2px 0; border-radius: 9px; border: 1px solid var(--ln2);
  background: rgba(10, 15, 30, .6); transition: border-color .2s, background .2s; }
#title .ts-lines button img { width: 26px; height: 26px; }
#title .ts-lines button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#title .ts-lines button:hover, #title .ts-lines button[aria-pressed="true"] { border-color: var(--hue); background: color-mix(in srgb, var(--hue) 22%, rgba(10, 15, 30, .7)); }
@media (max-width: 600px) and (orientation: portrait) {
  #title .ts-preview { flex-direction: column; align-items: center; }
  #title .ts-preview canvas#newHero { width: min(260px, 70vw); height: 170px; }
  #title .ts-lines { width: min(260px, 70vw); }
  #title .ts-preview p { margin: 4px 0 0; text-align: center; flex-direction: row; gap: 6px; align-items: baseline; }
  #title .ts-card.ts-empty canvas.ts-ghost { opacity: .4; }
}
@media (orientation: landscape) and (max-height: 500px) {
  #title .ts-preview canvas#newHero { width: 156px; height: 168px; }
  #title .ts-lines { width: 156px; gap: 3px; grid-template-columns: repeat(3, 1fr); } #title .ts-lines button { min-height: 40px; } #title .ts-lines button img { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) { #title .ts-card.ts-empty .ts-plus { animation: none; } }
@media (orientation: landscape) and (max-height: 500px) { #title .ts-preview p small { display: block; font-size: 11.5px; } }

/* feat/home-update 2026-10-18: privacy / terms links under the panel (the Google sign-in consent screen points at them) */
#title .ts-legal { margin: 0; width: min(440px, 100%); text-align: center; font-size: 12.5px; color: var(--tx3, #808aa5); text-shadow: 0 1px 6px rgba(0, 0, 0, .9); }
#title .ts-legal a { display: inline-block; padding: 8px 4px; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
#title .ts-legal a:hover { color: #f7e0a3; }
#title[data-view="boot"] .ts-legal { display: none; }
/* phones held sideways: the stage is a row there, so the links sit in the bottom-left corner under the logo instead */
@media (max-height: 520px) and (min-aspect-ratio: 1/1) {
  #title .ts-legal { position: absolute; left: max(16px, env(safe-area-inset-left)); bottom: max(4px, env(safe-area-inset-bottom)); width: auto; text-align: left; }
}
