@font-face { font-family: 'Grot'; src: url('../fonts/SpaceGrotesk-Regular.ttf') format('truetype'); font-weight: 400; font-display: block; }
@font-face { font-family: 'Grot'; src: url('../fonts/SpaceGrotesk-Bold.ttf') format('truetype'); font-weight: 700; font-display: block; }

:root {
  --field: #0b5a46;      /* gallery green wall */
  --field-deep: #063a2d;
  --field-hi: #13775d;
  --pink: #ff3d7f;       /* the button colour */
  --pink-deep: #c41a57;
  --ink: #041f18;
  --paper: #fff8ec;
  --gold: #f2c45a;
  --amber: #d9a13b;
  --red: #ff5b4a;
  --ok: #81b64c;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; background: var(--field); color: var(--paper); font-family: 'Grot', system-ui, sans-serif; overflow: hidden; }
#app { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
[hidden] { display: none !important; }

.btn {
  font: 700 18px/1 'Grot', sans-serif; color: var(--paper); background: rgba(0, 0, 0, .28);
  border: 1.5px solid rgba(0, 0, 0, .45); border-radius: 12px; padding: 0 18px; min-height: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35); transition: transform .08s;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.btn.big { background: var(--pink); border-color: var(--pink-deep); font-size: 22px; min-height: 60px; box-shadow: 0 4px 0 var(--pink-deep); }
.btn.pink { background: var(--pink); border-color: var(--pink-deep); box-shadow: 0 3px 0 var(--pink-deep); }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .25); box-shadow: none; }
.btn[disabled] { opacity: .45; }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
kbd { display: none; font: 700 12px/1 'Grot', sans-serif; padding: 4px 6px; border-radius: 5px; background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .3); }
body.desk kbd { display: inline-block; }

/* home */
#home { align-items: center; justify-content: flex-end; }
#homecv { position: absolute; inset: 0; width: 100%; height: 100%; }
.home-ui { position: relative; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: 0 20px calc(26px + var(--safe-b)); background: linear-gradient(to bottom, transparent, rgba(4, 31, 24, .85) 30%); padding-top: 60px; }
#logo { display: flex; flex-direction: column; align-items: center; line-height: .86; text-transform: uppercase; letter-spacing: -.02em; text-align: center; }
#logo .w1 { font-size: clamp(40px, 12.5vw, 92px); color: var(--paper); text-shadow: 0 4px 0 var(--ink); }
#logo .w2 { font-size: clamp(56px, 20vw, 150px); color: var(--pink); text-shadow: 0 5px 0 var(--ink); }
.home-btns { display: flex; flex-direction: column; gap: 10px; width: min(420px, 100%); }
.home-btns .row { display: flex; gap: 10px; }
.home-btns .row .btn { flex: 1; }

/* bars */
.bar { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) 12px 10px; min-height: 64px; }
.bar h2 { font-size: 24px; }
.play-bar { position: relative; z-index: 2; justify-content: space-between; }
.btn.icon { padding: 0 14px; }
.burger { width: 20px; height: 14px; border-top: 3px solid var(--paper); border-bottom: 3px solid var(--paper); position: relative; }
.burger::after { content: ''; position: absolute; left: 0; right: 0; top: 2.5px; border-top: 3px solid var(--paper); }
#plaque { flex: 1; text-align: center; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#plaque-no { font-size: 17px; }
#plaque-rows { font-size: 13px; opacity: .8; }
#cv { flex: 1; width: 100%; min-height: 0; display: block; touch-action: none; }
#toast { position: absolute; left: 50%; transform: translateX(-50%); top: calc(70px + var(--safe-t)); background: var(--ink); color: var(--paper);
  border: 1.5px solid var(--amber); border-radius: 10px; padding: 10px 14px; font-size: 15px; font-weight: 700; max-width: calc(100% - 24px);
  text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 3; }
#toast.on { opacity: 1; }

/* paintings grid */
#painting-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; padding: 8px 16px calc(24px + var(--safe-b)); align-content: start; }
.pcell { position: relative; aspect-ratio: 4 / 5; border: 0; padding: 0; background: none; cursor: pointer; color: var(--paper); font: inherit; }
.pcell .fr { position: absolute; inset: 0; background: url('../art/frame.webp') center / 100% 100% no-repeat; pointer-events: none; }
.pcell .in { position: absolute; left: 22.4%; right: 22.6%; top: 18.5%; bottom: 18.8%; background: var(--field-deep) center / cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; image-rendering: auto; }
.pcell .num { position: absolute; left: 0; right: 0; bottom: -2px; text-align: center; font-size: 14px; font-weight: 700; }
.pcell.locked { opacity: .55; }
.pcell .badge { position: absolute; top: 4%; right: 6%; background: var(--pink); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 3px 7px; }
.why { min-height: 0; padding: 0 16px; color: var(--amber); font-weight: 700; }
.why:empty { display: none; }

/* panels */
.panel { position: absolute; inset: 0; background: rgba(4, 31, 24, .78); display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
.sheet { background: var(--field); border: 1.5px solid var(--ink); border-radius: 18px; padding: 22px 20px; width: min(440px, 100%); max-height: calc(100% - 20px);
  overflow-y: auto; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 10px 0 rgba(0, 0, 0, .3); }
.sheet h2 { font-size: 26px; line-height: 1.1; }
.sheet p { font-size: 17px; line-height: 1.35; }
#guess-options { display: flex; flex-direction: column; gap: 10px; }
#guess-options .btn { justify-content: flex-start; text-align: left; line-height: 1.2; padding: 10px 16px; font-size: 19px; }
#guess-stake b { color: var(--gold); }

#reveal { background: var(--field-deep); flex-direction: column; padding: 0; }
#revealcv { position: absolute; inset: 0; width: 100%; height: 100%; }
#reveal-skip { position: absolute; right: 12px; bottom: calc(14px + var(--safe-b)); z-index: 2; }
#card { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 0 12px calc(12px + var(--safe-b)); z-index: 3; animation: rise .45s ease-out; }
#card .sheet { width: min(560px, 100%); gap: 6px; }
#card-title { font-size: 30px; }
#card-by { font-size: 18px; font-weight: 700; color: var(--gold); }
#card-where { font-size: 14px; opacity: .8; }
#card-fact { margin-top: 4px; }
#card-result { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
#card-result span { background: rgba(0, 0, 0, .3); border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 15px; }
#card .btns { display: flex; flex-direction: column; gap: 8px; }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

#deadcv { align-self: center; image-rendering: pixelated; border: 1.5px solid var(--ink); background: var(--field-deep); }
#credits-body { display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.35; }
#credits-body h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--gold); margin-bottom: 4px; }

body.desk .play-bar { padding-left: 24px; padding-right: 24px; }

@media (orientation: landscape) and (max-height: 600px) {
  #card { left: auto; right: 0; top: 0; bottom: 0; width: min(46vw, 460px); align-items: center; padding: 10px 12px; }
  #card .sheet { max-height: calc(100vh - 20px); }
  #card-title { font-size: 24px; }
  .home-ui { flex-direction: row; justify-content: center; align-items: flex-end; gap: 28px; padding-top: 30px; }
  #logo .w1 { font-size: min(9vh, 52px); }
  #logo .w2 { font-size: min(16vh, 88px); }
  .home-btns { width: min(360px, 48vw); gap: 6px; }
  .home-btns .btn { min-height: 40px; }
  .btn.big { min-height: 48px; }
}
