/* FOUR LETTERS: layout 1 "Face to Face". One big oil painting; words, cards and buttons are normal UI on top.
   Colours follow the paintings: deep green, violet shadow, warm amber and gold. */
:root {
  --night: #0b120e; --green: #14211a; --green2: #1d2e24; --line: #3c5143;
  --gold: #d9b45a; --gold2: #a9843a; --cream: #f3e7cc; --paper: #efe4cb; --ink: #1a140c; --muted: #9fae9c;
  --serif: "Libre Baskerville", Georgia, serif; --ui: Inter, system-ui, sans-serif; --deco: Cinzel, Georgia, serif;
}
* { box-sizing: border-box; margin: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #050806; overflow: hidden; }
body { font-family: var(--ui); color: var(--cream); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
#app { position: relative; height: 100%; max-width: 480px; margin: 0 auto; overflow: hidden; background: var(--night); user-select: none; }

/* the painting: two layers so pictures cross-fade */
#art { position: absolute; left: 0; right: 0; top: 0; height: 86%; }
#art .layer { position: absolute; inset: 0; background: center top / cover no-repeat; opacity: 0; transition: opacity .7s ease; }
#art .layer.on { opacity: 1; }
#fade { position: absolute; left: 0; right: 0; top: 56%; bottom: 0; background: linear-gradient(#0b120e00, var(--night) 44%); pointer-events: none; }

/* top bar */
#hud { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
       padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px 26px; background: linear-gradient(#0b120ee6, #0b120e00); }
#where { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#where b { font: 700 11px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
#where span { font: 500 11px/1.2 var(--ui); letter-spacing: .06em; color: var(--muted); }
.hud-btns { display: flex; gap: 8px; flex: none; }
.hb { position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #14211acc; border: 1px solid var(--line); }
.hb svg { width: 19px; height: 19px; stroke: var(--gold); fill: none; }
.hb i { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--gold); color: var(--ink); font: 700 10.5px/18px var(--ui); font-style: normal; text-align: center; }

/* a spoken line: in the same bottom panel as the narration, so the words are always in one place */
#say { position: absolute; z-index: 3; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 58px); padding: 14px 18px 16px; border-radius: 14px;
       background: #14211aee; border: 1px solid var(--gold2); box-shadow: 0 10px 30px #000c; animation: rise .25s ease; }
#say b { display: inline-block; font: 700 10.5px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--ink); background: var(--gold);
         padding: 4px 9px 3px; border-radius: 6px; margin-bottom: 9px; }
#say p { font: 16.5px/1.55 var(--serif); color: var(--cream); }

/* narration: the Storyteller, low on the screen */
#narr { position: absolute; z-index: 3; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 58px); padding: 16px 18px; border-radius: 14px;
        background: #14211aee; border: 1px solid var(--line); box-shadow: 0 10px 30px #000c; animation: rise .25s ease; }
#narr p { font: 16.5px/1.55 var(--serif); color: var(--cream); }
#tap { position: absolute; z-index: 3; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); text-align: center; font: 600 10.5px var(--ui);
       letter-spacing: .18em; text-transform: uppercase; color: var(--muted); animation: blink 2.2s infinite; }
@keyframes blink { 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* place and time */
#placecard { position: absolute; z-index: 4; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 62px); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px; text-align: center;
             background: linear-gradient(90deg, #0b120e00, #0b120ed9 20%, #0b120ed9 80%, #0b120e00); animation: placein 2.6s ease forwards; pointer-events: none; }
#placecard b { font: 700 20px/1.2 var(--deco); letter-spacing: .1em; color: var(--gold); }
#placecard span { font: 500 13px var(--ui); letter-spacing: .08em; color: var(--cream); }
@keyframes placein { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* the player's cards (style D) */
#choice { position: absolute; z-index: 4; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); display: flex; flex-direction: column; align-items: center; }
#ask { font: 600 11px var(--ui); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; text-align: center; padding: 0 20px; }
#hand { display: flex; justify-content: center; align-items: flex-end; height: 214px; padding-top: 14px; }
.pcard { width: 118px; height: 176px; margin: 0 -6px; padding: 16px 12px 12px; background: url(ui/card.png) center / 100% 100% no-repeat; display: flex; flex-direction: column;
         align-items: center; gap: 10px; text-align: center; color: var(--cream); font: 600 13.5px/1.28 var(--serif); filter: drop-shadow(0 8px 12px #000c);
         transform-origin: 50% 130%; transition: transform .18s ease; animation: deal .35s ease backwards; }
.pcard .ic { width: 42px; height: 42px; border-radius: 50%; border: 1.5px solid var(--gold2); display: grid; place-items: center; margin-top: 10px; background: #0b120e66; flex: none; }
.pcard svg { width: 21px; height: 21px; stroke: var(--gold); fill: var(--gold); fill-opacity: 0; }
.pcard svg use[href="#i-silence"] { fill-opacity: 1; }
.pcard .city { font: 700 15px/1.2 var(--deco); letter-spacing: .04em; color: var(--gold); margin-top: 18px; }
.pcard:active { transform: translateY(-14px) scale(1.04) !important; }
#hand.n3 .pcard:nth-child(1) { transform: rotate(-9deg); } #hand.n3 .pcard:nth-child(2) { transform: translateY(-16px); z-index: 1; } #hand.n3 .pcard:nth-child(3) { transform: rotate(9deg); }
#hand.n2 .pcard:nth-child(1) { transform: rotate(-6deg); margin-right: 6px; } #hand.n2 .pcard:nth-child(2) { transform: rotate(6deg); margin-left: 6px; }
#hand.n4 .pcard { width: 96px; height: 150px; font-size: 12px; margin: 0 -5px; }
#hand.n4 .pcard:nth-child(1) { transform: rotate(-11deg) translateY(8px); } #hand.n4 .pcard:nth-child(2) { transform: rotate(-4deg) translateY(-6px); }
#hand.n4 .pcard:nth-child(3) { transform: rotate(4deg) translateY(-6px); } #hand.n4 .pcard:nth-child(4) { transform: rotate(11deg) translateY(8px); }
@keyframes deal { from { opacity: 0; translate: 0 40px; } }

/* black title cards and the logo */
#titlecard { position: absolute; z-index: 8; inset: 0; background: #000; display: grid; place-items: center; padding: 40px 34px; }
#titlecard p { font: 17px/1.7 var(--serif); color: #e8e1d2; text-align: center; animation: rise .8s ease; }
#logo { position: absolute; z-index: 8; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; background: #000; animation: rise 1s ease; }
#logo h1, #home h1 { font: 700 46px/1 var(--deco); letter-spacing: .08em; color: var(--gold); text-transform: uppercase; text-align: center; text-shadow: 0 2px 20px #000; }
#logo span { font: 600 10.5px var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); animation: blink 2.2s infinite; }

/* a paper: letter or note */
#paper { position: absolute; z-index: 7; inset: 0; background: #050806e6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 20px; animation: rise .35s ease; }
#paper .sheet { position: relative; width: 100%; max-height: 74%; overflow-y: auto; background: #e9e4d7; color: #1f2a44; padding: 26px 22px 30px; border-radius: 3px;
                box-shadow: 0 16px 40px #000; transform: rotate(-.6deg); background-image: repeating-linear-gradient(#e9e4d7 0 29px, #d9d2c2 29px 30px); }
#paper .date { font: 12px var(--serif); text-align: right; color: #4a5470; margin-bottom: 14px; }
#paper .body p { font: italic 16px/30px var(--serif); margin: 0; }
#paper .sheet.note { background: #f2e9cf; color: var(--ink); transform: rotate(.8deg); }
#paper .sheet.note .body p { font: 14.5px/30px "IBM Plex Mono", monospace; font-style: normal; }
#paper .stamp { position: absolute; right: 14px; top: 12px; width: 78px; height: 78px; border: 2.5px solid #8a2b1f; border-radius: 50%; color: #8a2b1f; display: grid; place-items: center;
                text-align: center; font: 700 9px/1.25 var(--ui); letter-spacing: .06em; transform: rotate(-14deg); opacity: .85; }
#paper .close { font: 600 10.5px var(--ui); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* panels: case file, menu */
.sheetpanel { position: absolute; z-index: 9; left: 0; right: 0; bottom: 0; max-height: 82%; overflow-y: auto; background: var(--green); border-top: 1px solid var(--line);
              border-radius: 22px 22px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom, 0px) + 20px); display: flex; flex-direction: column; gap: 10px; animation: rise .25s ease; }
.sheetpanel h3 { font: 700 13px var(--deco); letter-spacing: .14em; color: var(--gold); text-transform: uppercase; margin: 2px 0 6px; }
.pbtn { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--green2); color: var(--cream); font: 600 14px var(--ui); padding: 10px 14px; text-align: left; }
.pbtn[data-close] { text-align: center; color: var(--gold); }
#case-list { display: flex; flex-direction: column; gap: 8px; }
#case-list .pbtn { display: flex; gap: 12px; align-items: center; }
#case-list svg { width: 20px; height: 20px; stroke: var(--gold); fill: none; flex: none; }
#case-list .empty { color: var(--muted); font: 14px var(--serif); padding: 8px 2px; }

/* start screen */
#home { position: absolute; z-index: 10; inset: 0; background: var(--night); display: flex; flex-direction: column; align-items: center; }
#home .home-art { position: absolute; inset: 0 0 30% 0; background: url(art/s_luderitz_street.webp) center top / cover; }
#home .home-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(#0b120e55, #0b120e00 30%, #0b120e00 55%, var(--night)); }
#home .home-title { position: relative; margin-top: calc(env(safe-area-inset-top, 0px) + 60px); text-align: center; padding: 0 20px; }
#home .home-title p { margin-top: 12px; font: italic 15px var(--serif); color: var(--cream); text-shadow: 0 1px 8px #000; }
#home .home-cards { position: relative; margin-top: auto; display: flex; gap: 14px; padding-bottom: 14px; }
.hcard { width: 132px; height: 188px; background: url(ui/card.png) center / 100% 100% no-repeat; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
         font: 700 14px/1.2 var(--deco); letter-spacing: .06em; color: var(--gold); text-transform: uppercase; filter: drop-shadow(0 10px 14px #000c); }
.hcard:first-child { transform: rotate(-5deg); } .hcard:last-child { transform: rotate(5deg); }
.hcard svg { width: 30px; height: 30px; stroke: var(--gold); fill: none; }
.hcard.off { opacity: .45; }
.home-note { position: relative; margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); font: 12px var(--ui); color: var(--muted); }
.home-note a { color: var(--gold); text-decoration: underline; cursor: pointer; }
#toast { position: absolute; z-index: 20; left: 50%; top: 40%; transform: translateX(-50%); background: var(--green2); border: 1px solid var(--gold2); color: var(--cream);
         font: 600 13px var(--ui); padding: 12px 18px; border-radius: 12px; box-shadow: 0 10px 30px #000; }

/* the painting melts into black at the top and the bottom, so no edge shows */
#art::before, #art::after { content: ""; position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none; }
#art::before { top: 0; height: 26%; background: linear-gradient(var(--night), #0b120e00); }
#art::after { bottom: 0; height: 34%; background: linear-gradient(#0b120e00, var(--night)); }
#fade { top: 62%; }
