/* =========================================================================
   POUSSE CAFÉ — Phase 2
   Screen shell, title, stage select, stars.  Loaded after style.css.
   ========================================================================= */

/* ---------- screen shell ---------------------------------------------- */
#app {
  display: block;
  padding: 0;
  background: #05060a;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding:
    max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
  background: #05060a center 28% / cover no-repeat;
}
.screen.on { opacity: 1; pointer-events: auto; }

#title, #select { background-image: url("../assets/title/title_bg.webp"); }
#play           { background-image: url("../assets/background/bar.webp"); }

#title::before, #select::before, #play::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 55% at 50% 42%, rgba(255,186,92,.10), transparent 62%),
    radial-gradient(140% 90% at 50% 55%, transparent 38%, rgba(0,0,0,.62) 100%);
}
/* the back bar lamps breathe, very slightly */
@keyframes lamp { 0%,100% { opacity: .82; } 45% { opacity: 1; } 70% { opacity: .9; } }
#title::before { animation: lamp 7s ease-in-out infinite; }
#select::before { background: linear-gradient(180deg, rgba(3,5,10,.82), rgba(3,5,10,.92)); }

/* ---------- title ------------------------------------------------------ */
.t-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 2vh 0 1vh;
}

@keyframes lit {
  0%,100% { filter: drop-shadow(0 0 14px rgba(255,186,92,.28)) drop-shadow(0 6px 14px rgba(0,0,0,.7)); }
  50%     { filter: drop-shadow(0 0 26px rgba(255,204,120,.5)) drop-shadow(0 6px 14px rgba(0,0,0,.7)); }
}
.t-logo {
  width: 74%;
  max-width: 360px;
  height: auto;
  animation: lit 5.5s ease-in-out infinite;
}

.t-shelf {
  position: relative;
  flex: 0 1 auto;
  width: 88%;
  max-width: 420px;
  min-height: 0;
  overflow: hidden;
}
.t-glasses {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,.6));
}
/* a highlight travels across the row every few seconds */
@keyframes sweep {
  0%   { transform: translateX(-120%) skewX(-14deg); opacity: 0; }
  12%  { opacity: .5; }
  55%  { opacity: .5; }
  75%  { transform: translateX(320%) skewX(-14deg); opacity: 0; }
  100% { transform: translateX(320%) skewX(-14deg); opacity: 0; }
}
.t-sweep {
  position: absolute;
  top: 0;
  left: 0;
  width: 26%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,240,205,.42), transparent);
  mix-blend-mode: screen;
  animation: sweep 7s ease-in-out infinite;
}

.t-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding-bottom: 2vh;
}

.pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(84%, 340px);
  aspect-ratio: 3.87;
  max-height: 78px;
  padding: 0 7% 0 9%;
  border: 0;
  background: url("../assets/ui/btn.png") center / 100% 100% no-repeat;
  color: var(--gold-hi);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", Cinzel, serif;
  cursor: pointer;
  transition: transform .12s var(--ease), filter .15s linear;
}
.pill .ic {
  width: auto;
  height: 46%;
  flex: 0 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.6));
}
.pill.locked .lbl { margin-left: 4px; }
.pill .lbl {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: clamp(15px, 4.4vw, 19px);
  letter-spacing: .06em;
  text-shadow: 0 0 14px rgba(255,190,90,.45);
}
.pill .lbl small {
  font-size: 10px;
  letter-spacing: .12em;
  color: var(--gold-dim);
  text-shadow: none;
}
.pill:active { transform: translateY(2px) scale(.985); filter: brightness(1.08); }
.pill:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 60px; }

.pill.locked {
  background-image: url("../assets/ui/btn_lock.png");
  color: #9d9483;
}
.pill.locked .lbl { text-shadow: none; }
.pill.locked .ic { opacity: .85; height: 38%; }
.pill.locked:active { transform: none; filter: none; }

@keyframes rattle {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-4px) rotate(-.5deg); }
  60%     { transform: translateX(4px) rotate(.5deg); }
}
.rattle { animation: rattle .3s var(--ease); }

/* ---------- stage select ----------------------------------------------- */
.s-head {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 6px 0 10px;
  text-align: center;
}
.s-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .3em;
  color: var(--gold-hi);
}
.s-head p {
  margin: 4px 0 0;
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--gold-dim);
}

.chip {
  position: absolute;
  top: 2px;
  left: 2px;
  z-index: 5;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(232,189,106,.32);
  border-radius: 50%;
  background: rgba(8,14,30,.5);
  color: var(--gold-dim);
  cursor: pointer;
}
.chip:active { transform: scale(.92); }
.ico-home {
  display: block;
  width: 100%;
  height: 100%;
  background: currentColor;
  -webkit-mask: var(--h) center / 15px 15px no-repeat;
  mask: var(--h) center / 15px 15px no-repeat;
  --h: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 3 2 12h3v9h6v-6h2v6h6v-9h3z'/%3E%3C/svg%3E");
}

.grid {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 2px 6px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
@media (min-width: 620px) { .grid { grid-template-columns: repeat(5, 1fr); } }

.lv {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  aspect-ratio: 1 / 1.02;
  padding: 6px 2px;
  border: 1px solid rgba(232,189,106,.34);
  border-radius: 5px;
  background: linear-gradient(180deg, rgba(18,30,56,.92), rgba(6,10,20,.92));
  box-shadow: inset 0 1px 0 rgba(255,224,160,.16), 0 6px 14px rgba(0,0,0,.45);
  color: var(--gold);
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s var(--ease);
}
.lv:active { transform: translateY(2px); }
.lv b { font-size: 20px; font-weight: 600; color: var(--gold-hi); }
.lv em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: .12em;
  color: var(--gold-dim);
}
.lv em.par { opacity: .75; }
.lv.perfect { border-color: rgba(255,214,140,.8); box-shadow: 0 0 16px rgba(255,190,90,.28), inset 0 1px 0 rgba(255,224,160,.3); }
.lv.locked {
  border-color: rgba(150,140,120,.22);
  background: linear-gradient(180deg, rgba(14,14,16,.9), rgba(6,6,8,.92));
  color: #6d6558;
  cursor: default;
}
.lv.locked b { color: #6d6558; }

.ico-lock {
  display: block;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--l) center / 20px 20px no-repeat;
  mask: var(--l) center / 20px 20px no-repeat;
  --l: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 2a5 5 0 0 0-5 5v3H6a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1h-1V7a5 5 0 0 0-5-5zm0 2a3 3 0 0 1 3 3v3H9V7a3 3 0 0 1 3-3zm0 10a1.6 1.6 0 0 1 .8 3v2.2h-1.6V17a1.6 1.6 0 0 1 .8-3z'/%3E%3C/svg%3E");
}

/* ---------- stars ------------------------------------------------------ */
.stars { display: flex; justify-content: center; gap: 4px; }
.stars i {
  display: block;
  background: #4a4335;
  -webkit-mask: var(--s) center / 100% 100% no-repeat;
  mask: var(--s) center / 100% 100% no-repeat;
  --s: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 1.7l3.1 6.6 7.2.9-5.3 4.9 1.4 7.2L12 17.8 5.6 21.3 7 14.1 1.7 9.2l7.2-.9z'/%3E%3C/svg%3E");
  transition: background .18s linear;
}
.stars i.on {
  background: linear-gradient(180deg, #fff0c6, #e8bd6a 45%, #b07d1e);
  filter: drop-shadow(0 0 6px rgba(255,196,96,.75));
}
.stars.xs i { width: 12px; height: 12px; }
.stars.sm i { width: 13px; height: 13px; }
.stars.lg i { width: 34px; height: 34px; }

@keyframes pop {
  0%   { transform: scale(.2) rotate(-30deg); opacity: 0; }
  60%  { transform: scale(1.28) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.stars i.pop { animation: pop .34s cubic-bezier(.2,.9,.3,1.2); }

#hudStars { margin-top: 3px; }

/* ---------- play screen tweaks ----------------------------------------- */
#play #topbar { padding-top: 2px; }
#play .chip { top: 2px; left: 2px; }

#clear .card .score {
  margin: 12px 0 2px;
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--gold);
}
#clear .card .score b { font-size: 21px; color: var(--gold-hi); margin-right: 5px; }
#clear .card .score span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--gold-dim);
}
@keyframes shine { 0%,100% { opacity: .75; } 50% { opacity: 1; } }
#clear .perfect {
  margin: 10px 0 0;
  font-size: 14px;
  letter-spacing: .3em;
  color: #ffe9b0;
  text-shadow: 0 0 16px rgba(255,196,96,.7);
  animation: shine 1.6s ease-in-out infinite;
}
#clear .best {
  margin: 8px 0 0;
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--gold-dim);
}
#clear #next { margin-top: 18px; }
#clear .ghost {
  width: 100%;
  margin-top: 8px;
  padding: 9px 0;
  border: 1px solid rgba(232,189,106,.4);
  border-radius: 3px;
  background: transparent;
  color: var(--gold-dim);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: .18em;
  cursor: pointer;
}
#clear .ghost:active { transform: translateY(1px); }
#clear #clearStars { margin-top: 14px; }

@media (max-height: 700px) {
  .t-logo { width: 62%; }
  .pill { max-height: 66px; }
  .stars.lg i { width: 28px; height: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .t-logo, .t-sweep, #title::before, #clear .perfect { animation: none; }
  .stars i.pop { animation: none; }
}

/* =========================================================================
   Phase 4 — the daily challenge entry
   ========================================================================= */

/* A drawn coaster: the other three pills carry shipped art, and inventing a
   fourth icon in that style is a job for the artist, not for CSS.          */
/* A crescent and two sparks: the bar is open late. Drawn, because the other
   three pills carry shipped art and inventing a fourth is the artist's job. */
.ic-daily {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 46%;
  aspect-ratio: 1;
  flex: 0 0 auto;
}
.ic-daily svg {
  width: 100%;
  height: 100%;
  fill: var(--gold);
  filter: drop-shadow(0 0 6px rgba(255,190,90,.35));
}
.pill.locked .ic-daily { opacity: .6; }

/* Four buttons now share the menu; give the shelf above them room to shrink. */
.t-menu { gap: clamp(7px, 1.6vh, 12px); }
/* A wide, short window (a laptop) has the least room per button of anything. */
@media (min-width: 700px) and (max-height: 900px) {
  .t-logo { width: 56%; }
  .pill { max-height: 58px; }
}
@media (max-height: 760px) {
  .pill { max-height: 62px; }
  .t-logo { width: 64%; }
}
@media (max-height: 640px) {
  .pill { max-height: 54px; }
  .pill .lbl { font-size: clamp(13px, 4vw, 16px); }
  .pill .lbl small { font-size: 9px; }
}
