/* The title screen, its windows and the pause menu (title.js), from Bellmourn's. */
  /* ---------------- the mouse pointer: a little gilded sword (tools/title/make_cursor.py), its blade
     glinting over whatever can be clicked */
  html, body { cursor: url(../assets/title/cursor.png) 1 1, auto;
    cursor: -webkit-image-set(url(../assets/title/cursor.png) 1x, url(../assets/title/cursor@2x.png) 2x) 1 1, auto;
    cursor: image-set(url(../assets/title/cursor.png) 1x, url(../assets/title/cursor@2x.png) 2x) 1 1, auto; }
  #pause *, #title * { cursor: inherit; }
  #ui :is(button, select, input[type=range], .eslot, .bslot, .q-list .q-row, .q-pick, .q-toggle, .cskip),
  #title :is(button, select, input[type=range], .t-gate, .t-cards) {
    cursor: url(../assets/title/cursor_hover.png) 1 1, pointer;
    cursor: -webkit-image-set(url(../assets/title/cursor_hover.png) 1x, url(../assets/title/cursor_hover@2x.png) 2x) 1 1, pointer;
    cursor: image-set(url(../assets/title/cursor_hover.png) 1x, url(../assets/title/cursor_hover@2x.png) 2x) 1 1, pointer; }
  #pause button:disabled, #title button:disabled { cursor: url(../assets/title/cursor.png) 1 1, auto;
    cursor: -webkit-image-set(url(../assets/title/cursor.png) 1x, url(../assets/title/cursor@2x.png) 2x) 1 1, auto;
    cursor: image-set(url(../assets/title/cursor.png) 1x, url(../assets/title/cursor@2x.png) 2x) 1 1, auto; }
  #ui .map-full canvas { cursor: grab; }

  /* ---------------- the title screen (title.js): the cards, Bellmourn's logo over the black, the menu */
  body.title-up #hud, body.title-up #touch, body.title-up #pause { visibility: hidden; }
  #title { position: fixed; inset: 0; z-index: 50; pointer-events: none; font: 14px Cinzel, Georgia, serif; color: #e8dcc0; }
  .t-screen { position: absolute; inset: 0; overflow: hidden; pointer-events: auto; transition: opacity .85s ease; }
  .t-screen.out { opacity: 0; pointer-events: none; }
  .t-screen.gone { display: none; }
  .t-veil { position: absolute; inset: 0; background: radial-gradient(ellipse 72% 62% at 50% 40%, rgba(5, 4, 8, .28), rgba(5, 4, 8, .9)),
            linear-gradient(rgba(5, 4, 8, .62), rgba(5, 4, 8, .18) 46%, rgba(5, 4, 8, .78)); }
  .t-cover { position: absolute; inset: 0; background: #000; transition: opacity .35s ease; }
  .t-cover.reveal { opacity: 0; transition: opacity 3.2s ease .4s; }
  .t-cards { position: absolute; inset: 0; }
  .t-card { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; animation: t-card 5.2s linear both; }
  @keyframes t-card {
    0% { opacity: 0; transform: scale(.965); animation-timing-function: ease-out; }
    25% { opacity: 1; transform: scale(.981); animation-timing-function: linear; }
    77% { opacity: 1; transform: scale(1.015); animation-timing-function: ease-in; }
    100% { opacity: 0; transform: scale(1.03); } }
  .t-logo { position: relative; width: min(80vw, 1000px); }
  .t-logo img { display: block; width: 100%; height: auto; -webkit-user-drag: none; }
  .t-shine { position: absolute; inset: 0; overflow: hidden; pointer-events: none;
             -webkit-mask: var(--m) center / 100% 100% no-repeat; mask: var(--m) center / 100% 100% no-repeat; }
  .t-shine i { position: absolute; top: -20%; bottom: -20%; left: 0; width: 26%; transform: translateX(-120%); animation: t-shine 1.5s ease-in-out both;
               background: linear-gradient(100deg, rgba(255, 250, 230, 0) 15%, rgba(255, 247, 220, .8) 50%, rgba(255, 250, 230, 0) 85%); }
  @keyframes t-shine { from { transform: translateX(-120%); } to { transform: translateX(420%); } }
  .t-glints, .t-motes { position: absolute; inset: 0; pointer-events: none; }
  .t-glint { position: absolute; width: calc(var(--s, 1) * 9%); aspect-ratio: 1; background: var(--t-star) center / contain no-repeat;
             opacity: 0; transform: translate(-50%, -50%) scale(.1); animation: t-glint 1.15s cubic-bezier(.2, .7, .3, 1) both; }
  @keyframes t-glint {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.1) rotate(-30deg); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1) rotate(0deg); }
    55% { opacity: .8; transform: translate(-50%, -50%) scale(.72) rotate(22deg); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(.05) rotate(50deg); } }
  .t-mote { position: absolute; width: max(3px, .32%); aspect-ratio: 1; border-radius: 50%; opacity: 0; animation: t-mote 3.2s ease-out both;
            background: radial-gradient(circle, #fff6d0, rgba(255, 200, 90, .6) 45%, rgba(255, 180, 60, 0) 70%); }
  .t-mote.loop { animation: t-mote 7s ease-in-out infinite; }
  @keyframes t-mote { 0% { opacity: 0; transform: translate(0, 0) scale(var(--z)); } 25% { opacity: .9; }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(calc(var(--z) * .4)); } }

  /* (the logo waits low, centred, while the game loads; it rises as the menu comes in under it) */
  .t-main { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 16px 3vh; box-sizing: border-box;
            transform: translateY(min(105px, 13vh)); transition: transform 1.8s cubic-bezier(.3, .7, .2, 1); }
  .t-main.menu-on { transform: none; }
  .t-mainlogo { width: clamp(260px, min(76vw, calc((100vh - 300px) * 4.5)), 1040px); opacity: 0; }
  .t-mainlogo img { filter: drop-shadow(0 6px 22px rgba(0, 0, 0, .9)); }
  @keyframes t-main { 0% { opacity: 0; transform: scale(.96); } 100% { opacity: 1; transform: none; } }
  @keyframes t-fade { from { opacity: 0; } to { opacity: 1; } }
  .t-under { display: grid; justify-items: center; margin-top: clamp(6px, 2.4vh, 26px); }
  .t-under > * { grid-area: 1 / 1; }
  .t-status { align-self: start; display: grid; justify-items: center; gap: 12px; opacity: 0; }
  .t-status span { font: 600 13px Cinzel, serif; letter-spacing: .28em; text-transform: uppercase; color: #b89a62; text-shadow: 0 1px 4px #000; text-align: center; transition: opacity .5s; }
  /* The loading bar, filling from the left, and under it the file coming down. */
  .t-bar { width: min(380px, 66vw); height: 5px; padding: 1px; border: 1px solid rgba(184, 154, 98, .42); border-radius: 3px; background: rgba(11, 9, 7, .6);
           box-shadow: 0 1px 6px rgba(0, 0, 0, .8); opacity: 0; transition: opacity .5s; box-sizing: content-box; }
  .t-status.has-bar .t-bar { opacity: 1; }
  .t-bar i { display: block; height: 100%; border-radius: 2px; transform: scaleX(0); transform-origin: 0 50%; transition: transform .25s ease-out;
             box-shadow: 0 0 6px rgba(255, 210, 120, .55); background: linear-gradient(90deg, #8c7344, #f2cf82 70%, #fff0c0); }
  .t-file { min-height: 1.3em; max-width: min(92vw, 640px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: italic 600 13px 'Alegreya Sans', Georgia, serif;
            letter-spacing: .04em; color: #8c7a58; text-shadow: 0 1px 4px #000; margin-top: -4px; }
  .t-main.menu-on .t-status > * { opacity: 0; }
  .t-menu { display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
  .t-main.menu-on .t-menu { pointer-events: auto; }
  .t-btn { position: relative; background: none; border: 0; padding: 8px 36px; min-width: 0; outline: none;
           font: 700 clamp(15px, 1.55vw, 20px) Cinzel, Georgia, serif; letter-spacing: .24em; text-transform: uppercase;
           color: #e2c486; text-shadow: 0 2px 6px #000, 0 0 2px #000; transition: color .2s, text-shadow .2s; }
  .t-btn::before, .t-btn::after { content: ''; position: absolute; top: 50%; width: 7px; height: 7px; margin-top: -4px; opacity: 0; transform: rotate(45deg) scale(0);
           background: linear-gradient(135deg, #fff2c4, #d9a04a 60%, #8a5a1c); border: 1px solid #2a1a06; transition: transform .22s ease, opacity .22s; }
  .t-btn::before { left: 10px; } .t-btn::after { right: 10px; }
  .t-btn:hover:not(:disabled), .t-btn:focus-visible { color: #fff4d2; text-shadow: 0 0 14px rgba(255, 200, 90, .75), 0 2px 6px #000; background: none; border: 0; }
  .t-btn:hover:not(:disabled)::before, .t-btn:hover:not(:disabled)::after, .t-btn:focus-visible::before, .t-btn:focus-visible::after { opacity: 1; transform: rotate(45deg) scale(1); }
  .t-btn:disabled { color: #9a8458; opacity: .38; }
  .t-menu .t-btn { opacity: 0; transform: translateY(10px); }
  .t-main.menu-on .t-menu .t-btn { opacity: 1; transform: none;
    transition: color .2s, text-shadow .2s, opacity .8s ease calc(var(--i) * 90ms + .15s), transform .8s ease calc(var(--i) * 90ms + .15s); }
  .t-main.menu-on .t-menu .t-btn:disabled { opacity: .34; }
  .t-gate { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .6s, visibility 0s .6s; }
  .t-gate.on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .6s; }
  .t-gate b { font: 600 14px Cinzel, serif; letter-spacing: .4em; text-transform: uppercase; color: #c9a86a; animation: pulse 2.4s ease-in-out infinite; }
  .t-gate b::before, .t-gate b::after { content: ''; display: inline-block; vertical-align: middle; width: 46px; height: 1px; margin: 0 18px; }
  .t-gate b::before { background: linear-gradient(90deg, transparent, #9a7638); } .t-gate b::after { background: linear-gradient(90deg, #9a7638, transparent); }
  .t-skip { position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: 18px; font: 11px Cinzel, serif; letter-spacing: .18em; text-transform: uppercase;
            color: rgba(200, 176, 128, .45); opacity: 0; transition: opacity 1s; pointer-events: none; }
  .t-skip.on { opacity: 1; transition-delay: 1.4s; }
  .t-last { position: absolute; left: 12px; right: 12px; bottom: 8px; text-align: center; font: 11px Georgia, serif; color: #c0907a; -webkit-user-select: text; user-select: text; }
  .t-last:empty { display: none; }

  /* ---------------- the windows over it all: settings, how to play, the confirm box, the save slots */
  .t-modal { position: absolute; inset: 0; pointer-events: none; }
  /* (what's closed takes no clicks from the moment it closes, not when its fade ends) */
  .t-scrim { position: absolute; inset: 0; background: rgba(4, 3, 6, .55); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s, visibility 0s .25s; }
  .t-scrim.on { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .25s; }
  #title .panel { pointer-events: auto; }
  #title .panel.saves { background: linear-gradient(#1c1511, #0d0a08); border-color: #9a7638; box-shadow: 0 0 0 1px #000, 0 24px 70px rgba(0, 0, 0, .92); }
  .t-frame { position: absolute; left: 50%; top: 50%; width: min(560px, 92vw); max-height: 90vh; overflow: auto; box-sizing: border-box; padding: 26px 30px 22px;
             background: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(120, 84, 30, .22), transparent 70%), linear-gradient(#1c1511, #0d0a08);
             border: 1px solid #9a7638; outline: 1px solid rgba(154, 118, 56, .35); outline-offset: 4px;
             box-shadow: 0 0 0 1px #000, 0 24px 70px rgba(0, 0, 0, .92), inset 0 0 50px rgba(0, 0, 0, .55);
             opacity: 0; visibility: hidden; transform: translate(-50%, -47%) scale(.97); pointer-events: none; overscroll-behavior: contain; touch-action: pan-y;
             transition: opacity .22s ease, transform .22s ease, visibility 0s .22s; }
  .t-frame.open { opacity: 1; visibility: visible; transform: translate(-50%, -50%); pointer-events: auto; transition: opacity .22s ease, transform .22s ease; }
  .t-frame::before { content: ''; position: absolute; inset: 7px; pointer-events: none; --c: #d4aa5a; background-repeat: no-repeat;
    background-image: linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
                      linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
    background-size: 18px 1px, 1px 18px, 18px 1px, 1px 18px, 18px 1px, 1px 18px, 18px 1px, 1px 18px;
    background-position: left top, left top, right top, right top, left bottom, left bottom, right bottom, right bottom; }
  .t-frame h2 { margin: 0; text-align: center; font: 700 clamp(20px, 2.4vw, 26px) 'Cinzel Decorative', Cinzel, serif; color: #f0cf86; letter-spacing: .05em; text-shadow: 0 2px 10px #000; }
  .t-rule { position: relative; height: 1px; width: 72%; margin: 12px auto 18px; background: linear-gradient(90deg, transparent, #b08840 30%, #b08840 70%, transparent); }
  .t-rule::after { content: ''; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; transform: translate(-50%, -50%) rotate(45deg);
                   background: linear-gradient(135deg, #fff2c4, #d9a04a 60%, #8a5a1c); border: 1px solid #000; }
  .t-msg { margin: 0 0 6px; text-align: center; font: 17px/1.5 'Alegreya Sans', Georgia, serif; color: #eadcbc; }
  .t-dbtns { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
  .t-dbtns .t-btn { font-size: 15px; letter-spacing: .2em; padding: 8px 32px; }
  .t-dialog { width: min(480px, 92vw); }
  .t-set { display: grid; }
  .t-set .t-sub { padding: 16px 2px 4px; font: 600 11px Cinzel, serif; letter-spacing: .2em; text-transform: uppercase; color: #e0b860; border-bottom: 1px solid rgba(224, 184, 96, .35); }
  .t-set label { display: grid; grid-template-columns: 1fr 1.3fr; align-items: center; gap: 14px; padding: 9px 2px; border-bottom: 1px solid rgba(154, 118, 56, .16);
                 font: 600 12px Cinzel, serif; letter-spacing: .14em; text-transform: uppercase; color: #cdb386; }
  .t-set select { font: 13px Cinzel, serif; color: #f0e2c0; background: #18110d; border: 1px solid #6a5232; padding: 6px 8px; outline: none; }
  .t-set select:focus-visible { border-color: #e0b860; }
  .t-set input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: transparent; outline: none; }
  .t-set input[type=range]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(90deg, #9a7638, #3a2c1a); border: 1px solid #000; }
  .t-set input[type=range]::-moz-range-track { height: 4px; background: linear-gradient(90deg, #9a7638, #3a2c1a); border: 1px solid #000; }
  .t-set input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -6px; transform: rotate(45deg);
    background: radial-gradient(circle at 35% 30%, #fff3c8, #e0a84a 55%, #7a4f17); border: 1px solid #1a1006; }
  .t-set input[type=range]::-moz-range-thumb { width: 12px; height: 12px; transform: rotate(45deg); border-radius: 0;
    background: radial-gradient(circle at 35% 30%, #fff3c8, #e0a84a 55%, #7a4f17); border: 1px solid #1a1006; }
  .t-set input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px rgba(255, 210, 120, .6); }
  .t-note { margin: 12px 0 0; text-align: center; font: italic 600 14px 'Alegreya Sans', Georgia, serif; color: #9a8662; }
  .t-howto { width: min(680px, 94vw); }
  .t-keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font: 15px 'Alegreya Sans', Georgia, serif; color: #e2d4b4; }
  .t-keys b { font: 700 12px Cinzel, serif; letter-spacing: .08em; color: #f0cf86; text-align: right; white-space: nowrap; padding-top: 2px; }
  @media (min-width: 640px) { .t-keys { grid-template-columns: auto 1fr auto 1fr; } }
  .t-touchkeys { display: none; font: 15px/1.5 'Alegreya Sans', Georgia, serif; color: #e2d4b4; text-align: center; }
  .t-touchkeys p { margin: 4px 0; } .t-touchkeys b { color: #f0cf86; }
  #title.is-touch .t-keys { display: none; } #title.is-touch .t-touchkeys { display: block; }
  .t-howto h3 { margin: 20px 0 8px; font: 700 12px Cinzel, serif; letter-spacing: .22em; text-transform: uppercase; color: #c9a86a; text-align: center; }
  .t-tips { margin: 0; padding-left: 20px; font: 15px/1.45 'Alegreya Sans', Georgia, serif; color: #dccfae; }
  .t-tips li { margin: 5px 0; } .t-tips b { color: #ffd84a; }
  @media (max-height: 480px) {   /* a phone on its side */
    .t-mainlogo { width: clamp(220px, min(70vw, calc((100vh - 200px) * 4.5)), 700px); }
    .t-menu .t-btn { padding: 4px 28px; font-size: 14px; }
    .t-frame { padding: 16px 20px 14px; max-height: 94vh; }
    .t-set label { padding: 4px 2px; }
    .t-rule { margin: 8px auto 10px; }
  }
  @keyframes pulse { 50% { opacity: .45; } }

  /* ---------------- bm's own: the save slots, the toast, the pause menu */
  .t-btn.small { font-size: 12px; letter-spacing: .14em; padding: 6px 18px; }
  .t-btn.red { color: #e0806a; }
  .t-btn.sel { color: #fff4d2; }
  .t-tabs { display: flex; justify-content: center; gap: 4px; margin: -6px 0 10px; }
  .t-slots { width: min(640px, 94vw); }
  .t-slotlist { display: grid; gap: 2px; }
  .t-slot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border-bottom: 1px solid rgba(154, 118, 56, .16); }
  .t-slot .si { display: grid; gap: 2px; min-width: 0; }
  .t-slot .si b { font: 700 12px Cinzel, serif; letter-spacing: .14em; color: #f0cf86; }
  .t-slot .when { font: 13px 'Alegreya Sans', Georgia, serif; color: #cdb386; }
  .t-slot .who { font: 13px 'Alegreya Sans', Georgia, serif; color: #9a8662; }
  .t-slot.empty .when { opacity: .5; }
  .t-slot .sb { display: flex; flex-shrink: 0; }
  .t-toast { position: fixed; left: 50%; top: 14%; transform: translateX(-50%); padding: 8px 18px; font: 600 13px Cinzel, serif; letter-spacing: .18em; color: #f0cf86;
             background: rgba(12, 9, 7, .85); border: 1px solid #6a5232; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 2; }
  .t-toast.on { opacity: 1; }
  #pause .t-menu { pointer-events: auto; }
  #pause .t-btn { opacity: 1; transform: none; }
  #pause .p-title { font: 700 clamp(22px, 3vw, 32px) 'Cinzel Decorative', Cinzel, serif; color: #f0cf86; letter-spacing: .08em; text-shadow: 0 2px 10px #000; margin-bottom: 10px; }
