/* UNFOLD customer game area. Mobile first. */
:root {
  color-scheme: light;
  --cream: #F5F1E9; --beige: #D9D0C1; --green: #263F31; --burgundy: #762D40;
  --paper: #FBF8F2; --green-soft: #4A6152; --muted: #62685F; --line: #D9D0C1;
  --tint: #762D40; /* set per game */
  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-body: "DM Sans", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--cream); color: var(--green); font: 16px/1.55 var(--f-body); -webkit-font-smoothing: antialiased; display: flex; flex-direction: column; }
h1, h2 { font-family: var(--f-display); font-weight: 400; margin: 0; line-height: 1.12; text-wrap: balance; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 3px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--burgundy); }

.btn { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: .9em 1.4em; font: 600 1rem/1 var(--f-body); border: 1px solid transparent; cursor: pointer; text-decoration: none; min-height: 48px; }
.btn-primary { background: var(--burgundy); color: var(--paper); }
.btn-primary:hover { background: #5E2333; }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-ghost { border-color: var(--green); color: var(--green); background: transparent; }
.btn-ghost:hover { background: var(--green); color: var(--cream); }
.btn-ghost:disabled { opacity: .35; cursor: default; background: transparent; color: var(--green); }
.link { background: none; border: 0; padding: .5rem 0; font: 600 .9375rem var(--f-body); color: var(--burgundy); cursor: pointer; }

.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: calc(.8rem + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) .8rem max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--green); }
.brand img { width: 40px; height: auto; }
.brand span { font-family: "Playfair Display", Georgia, serif; font-weight: 600; letter-spacing: .14em; font-size: 1.3rem; }

.main { flex: 1; width: 100%; max-width: 760px; margin-inline: auto; padding: 2rem max(16px, env(safe-area-inset-right, 0px)) calc(2rem + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; }
.screen { display: grid; gap: 1rem; align-content: start; }
.screen.center { text-align: center; justify-items: center; align-content: center; flex: 1; max-width: 460px; margin-inline: auto; }
.screen h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.6rem); }

.thanks { display: grid; gap: .4rem; padding: 1rem 1.2rem; border: 1px solid color-mix(in srgb, var(--burgundy) 30%, transparent); background: var(--paper); border-radius: 10px; margin-bottom: .5rem; }
.signin { display: grid; gap: .6rem; width: 100%; text-align: left; margin-top: .5rem; }
.signin label { font-size: .8125rem; font-weight: 600; }
.signin input { width: 100%; padding: .9em 1em; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-size: 16px; }
.msg { font-size: .9rem; min-height: 1.4em; text-align: center; }
.msg.ok { color: #2F6B45; } .msg.err { color: #A23B3B; }

/* library */
.library { display: grid; gap: .9rem; margin-top: .75rem; }
.game-tile {
  --tint: var(--burgundy);
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; gap: .35rem; padding: 1.4rem 1.3rem; border-radius: 12px;
  background: var(--paper); border: 1px solid var(--line); text-align: left; cursor: pointer; color: var(--green); font: inherit;
}
.game-tile:hover { border-color: color-mix(in srgb, var(--tint) 45%, var(--line)); }
.game-tile img { position: absolute; z-index: -1; right: -4%; top: 50%; width: 46%; max-width: 230px; transform: translateY(-50%); opacity: .38; }
.game-tile h2 { font-size: 1.8rem; }
.game-tile .meta { font-size: .875rem; color: var(--muted); }
.game-tile .go { margin-top: .5rem; font-weight: 600; color: var(--tint); }
.game-tile.pending { cursor: default; }
.empty { display: grid; gap: .5rem; padding: 1.25rem; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.empty b { color: var(--green); font-family: var(--f-display); font-weight: 500; font-size: 1.15rem; }

/* game */
.game { flex: 1; grid-template-rows: auto auto 1fr auto auto; gap: .9rem; }
.game-top { display: flex; justify-content: space-between; align-items: center; }
.game-count { font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.progress { height: 3px; background: var(--beige); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--tint); transition: width .4s ease; }
.stage { display: grid; perspective: 1200px; min-height: 0; }
.card {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: min(62vh, 520px); display: grid; align-content: center; justify-items: center; gap: .9rem; text-align: center;
  padding: 2.25rem 1.5rem 4.5rem; border-radius: 18px; background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 24px 40px -30px rgba(38, 63, 49, .45); transform-origin: 50% 0;
}
.card.unfold { animation: unfold .6s cubic-bezier(.2, .7, .2, 1); }
@keyframes unfold { 0% { transform: rotateX(-80deg); opacity: .2; } 60% { transform: rotateX(5deg); opacity: 1; } 100% { transform: none; } }
.card-sec { position: absolute; top: 1.3rem; left: 0; right: 0; font-size: .6875rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--tint); }
.card-kind { font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--paper); background: var(--tint); padding: .35em .8em; border-radius: 999px; }
.card-title { font-size: 1.6rem; }
.card-body { font-family: var(--f-display); font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2.1rem); line-height: 1.3; max-width: 24ch; white-space: pre-line; }
.card.activity .card-body { font-family: var(--f-body); font-size: 1.1rem; line-height: 1.6; max-width: 34ch; }
.card-bird { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); width: 64px; opacity: .85; z-index: -1; }
.hint { text-align: center; font-family: var(--f-display); font-style: italic; color: var(--muted); font-size: .95rem; }
.controls { display: grid; grid-template-columns: 1fr 2fr; gap: .75rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; margin-top: .5rem; }
@media (prefers-reduced-motion: reduce) { .card.unfold { animation: none; } .progress i { transition: none; } }
