/* Forget It. The SoSmarty look (base.css) on a teal ground; design rules live in the repo's CLAUDE.md. */
:root { --teal: #5fb3b3; --gap: 8px; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: var(--teal);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.screen { position: fixed; inset: 0; }

/* Title: the name, four cards lying still, the way in */
.title {
  display: flex; flex-direction: column; justify-content: space-between; gap: 24px;
  padding: max(7vh, env(safe-area-inset-top)) max(6vw, 16px) max(5vh, env(safe-area-inset-bottom));
}
.title h1 { font-size: 64px; line-height: 0.95; }
.title h1 span { display: block; }
.tagline { margin: 12px 0 0; font-size: 20px; font-weight: 700; }
.fan { display: flex; gap: 12px; align-items: center; }
.tcard {
  display: grid; place-items: center; width: min(22vw, 120px); aspect-ratio: 1; border: 3px solid var(--ink);
  border-radius: 4px; background: var(--ink); color: var(--cream); font: 32px/1 var(--display);
}
.tcard.up { background: var(--cream); }
.tcard svg { width: 66%; height: 66%; fill: var(--ink); }
.tcard:nth-child(2) { transform: rotate(-4deg); }
.tcard:nth-child(3) { transform: translateY(-10px) rotate(3deg); }
.title-bottom { display: flex; flex-direction: column; gap: 16px; }
.keys { margin: 0; font-size: 16px; }
body.touch .keys, body.touch .kbd { display: none; }
@media (max-height: 500px) and (orientation: landscape) {
  .title { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr; column-gap: 24px; padding-top: 16px; }
  .title h1 { font-size: 32px; }
  .title h1 span { display: inline; }
  .title-bottom { grid-column: 1; grid-row: 2; align-self: end; }
  .fan { grid-column: 2; grid-row: 1 / 3; }
  .tcard { width: 80px; }
}

/* Cream panels: the level list and the ending */
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.set { margin-top: 28px; padding-left: 16px; border-left: 8px solid var(--teal); }
.set h3 { font-size: 20px; margin-bottom: 6px; }
.set p { margin: 0 0 10px; font-size: 16px; }
.lvls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 600px) { .lvls { grid-template-columns: repeat(3, 1fr); } }
.lvl {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 76px; padding: 10px;
  font: 16px/1.25 var(--body); text-align: left; color: var(--cream); background: var(--ink);
  border: 3px solid var(--ink); border-radius: 4px; cursor: pointer;
}
.lvl b { font: 20px/1 var(--display); margin-bottom: 4px; }
.lvl.star { color: var(--ink); background: var(--teal); }
.lvl:disabled { color: rgba(26, 22, 18, 0.55); background: none; border: 3px dashed rgba(26, 22, 18, 0.4); cursor: default; }
.lvl:not(:disabled):hover { transform: translateY(-2px); }
.stats dt { font-weight: 700; font-size: 16px; }
.stats dd.small { font: 700 20px/1.3 var(--body); max-width: 22em; }

/* Play: header, the rule, the devil, the cards, two buttons */
.play {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: 'hud' 'rule' 'talk' 'stage' 'tools'; gap: 8px; max-width: 760px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.hud { grid-area: hud; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lv { margin: 0; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 20px; font-weight: 700; }
.lv b { margin-right: 6px; font: 20px/1 var(--display); }
.count { display: flex; gap: 14px; margin: 0; flex: none; }
.count div { display: flex; align-items: baseline; gap: 6px; }
.count dt { font-size: 16px; font-weight: 700; }
.count dd { margin: 0; font: 20px/1 var(--display); }
.count dd.low { color: var(--cream); background: var(--ink); padding: 2px 4px; border-radius: 4px; }
.rule { grid-area: rule; margin: 0; padding: 6px 10px; background: var(--ink); color: var(--cream); border-radius: 4px; font-size: 16px; line-height: 1.3; }
.rule b { margin-right: 6px; font: 16px/1 var(--display); color: var(--teal); }
.talk { grid-area: talk; display: flex; align-items: center; gap: 10px; min-height: 52px; }
.talk img { flex: none; width: 44px; height: 44px; }
.talk p {
  position: relative; flex: 1 1 auto; margin: 0; padding: 6px 10px; min-height: 44px;
  font-size: 16px; font-weight: 700; line-height: 1.3; background: var(--cream); border: 3px solid var(--ink); border-radius: 4px;
}
.talk p::before { content: ''; position: absolute; left: -11px; top: 12px; border: 8px solid transparent; border-left: 0; border-right-color: var(--ink); }
.talk p.pop { animation: say 0.2s ease-out; }
@keyframes say { from { transform: scale(0.95); } to { transform: none; } }
.showme { flex: none; padding: 10px 12px; font-size: 16px; color: var(--ink); background: var(--cream); }
.stage { grid-area: stage; position: relative; display: grid; place-items: center; min-height: 0; }
.tools { grid-area: tools; justify-content: center; }
.tools .btn { padding: 8px 14px; min-height: 44px; font-size: 16px; }

/* The board: slots stay put, cards slide between them (positions set from main.js) */
.board { position: relative; }
.board.shake { animation: shake 0.35s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
.slot { position: absolute; left: 0; top: 0; border: 3px dashed rgba(26, 22, 18, 0.35); border-radius: 4px; }
.card {
  position: absolute; left: 0; top: 0; padding: 0; display: grid; place-items: center;
  border: 3px solid var(--ink); border-radius: 4px; background: var(--ink); color: var(--cream);
  cursor: pointer; touch-action: manipulation;
}
.card .back { font: 400 var(--q, 28px)/1 var(--display); }
.card svg { width: 68%; height: 68%; fill: var(--ink); }
.card.up, .card.gone { background: var(--cream); }
.card.up .back, .card:not(.up) svg { display: none; }
.card.gone { visibility: hidden; }
.card.moving { z-index: 2; outline: 4px solid var(--cream); }
.card.hot { outline: 4px solid var(--ink); outline-offset: 3px; z-index: 1; }
.card:focus-visible { outline: 4px solid var(--cream); outline-offset: 2px; z-index: 3; }
.board.replay .card { cursor: default; }

/* Phones on their side: the board on the left, the rest in a column on the right */
@media (max-height: 520px) and (orientation: landscape) {
  .play {
    max-width: none; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: 'stage hud' 'stage rule' 'stage talk' 'stage .' 'stage tools';
  }
  .lv { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn:active, .lvl:not(:disabled):hover { transform: none; }
  .talk p.pop, .board.shake { animation: none; }
}
