/* The life of the park: the cast's portraits, the era charter, the day card, the bonus strip, the daily tasks in
   Quests and the Collections (js/life/*.js). */

/* ---- portraits ---- */
.castpt {
  flex: 0 0 auto;
  display: inline-block;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--bark, #3b2614);
  background: #e3d6bb;
  vertical-align: middle;
  box-sizing: border-box;
}
.castpt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.casthead {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.casthead b {
  display: block;
  font: 400 18px/1.1 var(--display, inherit);
}
.casthead small {
  display: block;
  color: var(--muted, #7a6a58);
  font-size: 12px;
}
#toast .t.who {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
}
.slot.cev .castpt {
  margin-right: 8px;
}

/* ---- the era charter ---- */
.charter {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(59, 38, 20, 0.25);
}
.charter .cq {
  font-style: italic;
  font-size: 13px;
  margin: 0 0 6px;
}
.ctasks {
  list-style: none;
  margin: 6px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.ctasks li {
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.ctasks li i {
  font-style: normal;
  font-weight: 800;
  color: #a0522d;
  width: 14px;
}
.ctasks li.ok {
  color: #3d7a22;
}
.ctasks li.ok i {
  color: #3d7a22;
}

/* ---- the day card (morning / sunset): one card at a time, above the command bar ---- */
.daycard {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--cmdH, 100px) + 12px);
  z-index: 41;
  max-width: 440px;
  max-height: calc(100vh - var(--cmdH, 100px) - var(--hudB, 120px) - 30px);
  overflow-y: auto;
  margin: 0 auto;
  padding: 14px;
  box-sizing: border-box;
  border: 3px solid var(--bark, #3b2614);
  border-radius: 16px 20px 14px 18px;
  background: var(--cream, #fbf3e2);
  box-shadow: 0 4px 0 var(--bark, #3b2614);
}
.daycard[hidden] {
  display: none;
}
/* s1-pace: only the body of the card scrolls; the title and the buttons stay in view. A long sunset report scrolled
   the whole card and the 20 px frame cut "Good night" in half: a newcomer's tap on its lower half did nothing */
.daycard:not([hidden]) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.daycard > .casthead,
.daycard > .acts {
  flex: none;
}
.daycard > .dcbody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
/* (margins do not collapse across a scroller: the card stays as tall as it was) */
.daycard > .dcbody > :first-child {
  margin-top: 0;
}
.daycard > .dcbody > :last-child {
  margin-bottom: 0;
}
.daycard h4,
.report h4 {
  margin: 8px 0 4px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted, #7a6a58);
}
.dcrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin: 3px 0;
}
.dcrow .bar {
  flex: 0 0 70px;
  height: 7px;
}
.dcrow.dream {
  padding: 8px;
  border-radius: 10px;
  background: rgba(90, 58, 106, 0.12);
}
.rpmain {
  padding: 8px;
  border-radius: 10px;
  background: rgba(194, 65, 45, 0.08);
  margin-bottom: 6px;
}
.rpd {
  font-weight: 700;
}
.rpd.up {
  color: var(--leaf, #3d7a22);
}
.rpd.dn {
  color: var(--bad, #c2412d);
}
body.qopen .daycard,
body.popen .daycard,
body.bopen:not(.bmini) .daycard,
body.placing .daycard,
body.tracking .daycard,
body.peek .daycard,
body.bmini .daycard,
body.incamp .daycard,
body.mgon .daycard {
  display: none;
}
/* the Shaman's tips wait while another card is up */
body.hasday #tut,
body.hasmge #tut {
  display: none !important;
}

/* ---- the strip of active bonuses under the HUD ---- */
.boons {
  pointer-events: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 300px;
}
.boons[hidden] {
  display: none;
}
.boon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
  background: rgba(251, 243, 226, 0.95);
  border: 2px solid #3d7a22;
  font-size: 11px;
  line-height: 1.1;
  color: var(--ink, #2b1d10);
  box-shadow: 0 2px 0 rgba(36, 21, 9, 0.25);
}
.boon.bad {
  border-color: #c2412d;
}
.boon img,
.boon i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  font-style: normal;
  display: grid;
  place-items: center;
  font-size: 13px;
  background: #e3d6bb;
}
.boon b {
  font-size: 12px;
}
.boon small {
  color: var(--muted, #7a6a58);
  font-size: 10.5px;
}
.boon.more {
  padding: 2px 8px;
  font-weight: 700;
}
@media (max-width: 700px) {
  .hud {
    grid-template-areas: 'pill pill' 'lvl spd' 'boons boons';
  }
  .boons {
    grid-area: boons;
    max-width: none;
  }
  .boon small {
    display: none;
  }
}

/* ---- daily tasks in the Quests sheet ---- */
.dailyq h3 small {
  font-family: var(--body, inherit);
  font-size: 12px;
  color: var(--muted, #7a6a58);
}
.dq {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin: 6px 0;
  font-size: 13px;
}
.dq > div {
  flex: 1;
  min-width: 0;
}
.dq .bar {
  display: block;
  height: 6px;
  margin-top: 3px;
}

/* ---- Collections ---- */
.colltabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 10px;
}
.colltabs .pill {
  cursor: pointer;
}
.colltabs .pill[aria-pressed='true'] {
  background: var(--bark, #3b2614);
  color: var(--cream, #fbf3e2);
}
.collgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
}
.collgrid .castpt {
  margin: 2px auto;
}
.collgrid.art canvas {
  width: 96px;
  height: 96px;
  border-radius: 10px;
  border: 2px solid var(--bark, #3b2614);
}

/* ---- v33: the mood face and the "Now" line ---- */
.rpill .chip.mood .ico.hp,
.rpill .chip.mood #happy {
  color: var(--mood, #9fd46a);
}
.chip.mood.shake {
  animation: moodShake 0.4s ease;
}
@keyframes moodShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px) rotate(-6deg); }
  40% { transform: translateX(3px) rotate(6deg); }
  60% { transform: translateX(-2px) rotate(-3deg); }
  80% { transform: translateX(2px); }
}
@media (prefers-reduced-motion: reduce) {
  .chip.mood.shake { animation: none; }
}
.nowChip {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: 'l t go' 'b b b';
  align-items: center;
  column-gap: 6px;
  row-gap: 3px;
  width: 280px;
  margin-top: 6px;
  padding: 5px 10px;
  background: rgba(36, 21, 9, 0.82);
  color: #f6eedc;
  border: 2px solid var(--bark, #4a2d16);
  border-radius: 12px;
  font: 600 12.5px/1.25 var(--body);
  text-align: left;
  cursor: pointer;
}
.nowChip[hidden] { display: none; }
.nowChip.act { border-color: #ef5a3c; }
.nowL { grid-area: l; font-weight: 800; color: #ffd27a; }
.nowT { grid-area: t; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nowGo { grid-area: go; font-weight: 800; color: #9fd46a; white-space: nowrap; }
.nowB { grid-area: b; display: block; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.nowB[hidden] { display: none; }
.nowB i { display: block; height: 100%; background: #9fd46a; }
.toast .tshow, #toast .tshow {
  pointer-events: auto; /* (#toast is pointer-events: none so the map stays usable under it: a finger never reached Show) */
  margin-left: 8px;
  padding: 3px 10px;
  font-size: 12px;
  min-height: 0;
}
.tsel.pulse, #items .pulse { animation: pulseCard 0.8s ease 3; }
@keyframes pulseCard { 50% { box-shadow: 0 0 0 4px #ffd27a; } }
@media (max-width: 700px) {
  .hud {
    grid-template-areas: 'pill pill' 'lvl spd' 'now now' 'boons boons';
  }
  .nowChip {
    grid-area: now;
    width: auto;
    margin-top: 0;
    font-size: 12px;
    padding: 4px 9px;
  }
}

/* ---- v33: the camp sheet (level, villagers, four tabs, sites) ---- */
.campCard .ctabs {
  flex-wrap: wrap;
}
.campCard .ctabs .pill {
  flex: 1 1 40%;
}
.campCard .clv {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 2px 8px;
  margin: 2px 0 4px;
}
.campCard .clv .bar {
  grid-column: 1 / -1;
  display: block;
  height: 6px;
  margin: 0;
}
.campCard .row.bad b,
.campCard p.bad,
#info p.bad {
  color: var(--bad);
}
.restab small.need {
  color: #8a5a10;
  font-weight: 600;
}
#info .bar {
  display: block;
  height: 6px;
  margin: 2px 0 6px;
}
.item .sub.mats {
  display: inline-flex;
  gap: 1px;
  margin-left: 4px;
  vertical-align: middle;
}

.lvunl {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lvunl span {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 70px;
  text-align: center;
}
.lvunl img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.lvunl small {
  font-size: 10.5px;
  line-height: 1.1;
}

.hudTip {
  position: fixed;
  z-index: 40;
  width: 260px;
  padding: 8px 10px;
  background: var(--cream, #fbf3e2);
  border: 2px solid var(--bark, #4a2d16);
  border-radius: 12px;
  font-size: 12.5px;
  box-shadow: 0 4px 0 rgba(36, 21, 9, 0.3);
}
.hudTip[hidden] { display: none; }
.hudTip p { margin: 0 0 4px; }
.ach.book.focus { outline: 3px solid #ffd27a; border-radius: 10px; }
.qhead .qhelp { margin-left: auto; margin-right: 6px; font-weight: 800; }

/* ---- v33: in the camp the bottom bar's middle button is the camp's sheet ---- */
body.incamp .cmdbar #btnBuild {
  visibility: visible;
}
body.incamp .cmdbar #btnBuild .bl {
  display: none;
}
body.incamp .cmdbar #btnBuild .cl {
  display: revert;
}
.cmdbar #btnBuild .cl {
  display: none;
}
@media (max-width: 700px) {
  body.incamp .side {
    bottom: calc(var(--cmdH, 100px) + 8px) !important;
    max-height: min(52vh, calc(100vh - var(--hudB, 110px) - var(--cmdH, 100px) - 30px)) !important;
  }
  /* the build drawer: the category tabs stay on top while the cards scroll */
  .tray .tabs {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--cream);
    padding-bottom: 8px;
    border-radius: 22px 22px 0 0;
  }
}
.nowChip .nowT {
  min-height: 2.5em;
  display: flex;
  align-items: center;
}
@supports (-webkit-line-clamp: 2) {
  .nowChip .nowT {
    display: -webkit-box;
  }
}
body.incamp .cmdbar #btnBuild[aria-pressed='true'] .cl {
  display: none;
}
.slot.cur { outline: 2px solid var(--orange, #e0672b); border-radius: 10px; }

/* v35: the guide (Menu → Guide) */
.gtabs {
  flex-wrap: wrap;
  gap: 6px;
}
.gtabs .btn {
  padding: 4px 10px;
  font-size: 13px;
}
.gbody h4 {
  margin: 12px 0 4px;
}
.gbody p,
.gbody li {
  font-size: 14px;
  line-height: 1.45;
}
.gbody ul {
  margin: 4px 0 8px;
  padding-left: 20px;
}
.gq {
  border-bottom: 1px solid var(--stone-lo);
  padding: 6px 0;
}
.gq summary {
  cursor: pointer;
  font-weight: bold;
}
.gq p {
  margin: 6px 0 2px;
}

/* ---- the level's goals under the level plate (js/goals.js): a list on a wide screen, a row of chips on a phone ---- */
.goalStrip {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 280px;
  margin-top: 6px;
  padding: 5px 6px 6px;
  box-sizing: border-box;
  background: var(--woodtex, rgba(36, 21, 9, 0.82));
  color: #f6eedc;
  border: 2px solid #1e1108;
  border-radius: 12px;
  box-shadow: inset 0 2px 0 rgba(255, 220, 170, 0.16), 0 4px 0 rgba(20, 10, 0, 0.4);
  font: 600 12px/1.2 var(--body);
}
.goalStrip[hidden] { display: none; }
.gsHead { display: flex; justify-content: space-between; padding: 0 4px; color: #ffd27a; font-size: 11.5px; }
.gsHead b { font-weight: 800; }
.gs {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  grid-template-areas: 'i t v' 'i b b';
  align-items: center;
  column-gap: 6px;
  row-gap: 2px;
  min-height: 0;
  padding: 3px 6px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.gs:hover { background: rgba(0, 0, 0, 0.42); }
.gs.next { box-shadow: inset 0 0 0 2px #ffd27a; }
.gs.ok { opacity: 0.7; }
.gs.ok .gsV { color: #9fd46a; }
.gsI { grid-area: i; width: 22px; height: 22px; display: grid; place-items: center; overflow: hidden; border-radius: 6px; background: #e3d6bb; }
.gsI img { width: 100%; height: 100%; object-fit: contain; }
.gsI .resico { width: 18px !important; height: 18px !important; }
.gsI .castpt { width: 22px !important; height: 22px !important; border: 0; }
.gsT { grid-area: t; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gsV { grid-area: v; font-weight: 800; color: #ffd27a; white-space: nowrap; }
.gsB { grid-area: b; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.gsB i { display: block; height: 100%; background: #9fd46a; }
.gs.ok .gsB { visibility: hidden; }
.gs.long { margin-top: 2px; background: rgba(0, 0, 0, 0.16); }
.gs.pop { animation: gsPop 0.6s ease 3; }
@keyframes gsPop { 50% { background: rgba(159, 212, 106, 0.6); transform: scale(1.04); } }
@media (prefers-reduced-motion: reduce) {
  .gs.pop { animation: none; background: rgba(159, 212, 106, 0.45); }
}
.lgHead { margin: 10px 0 2px; font: 400 15px/1.1 var(--display); }
@media (max-width: 700px) {
  .hud {
    grid-template-areas: 'pill pill' 'lvl spd' 'goals goals' 'now now' 'boons boons';
  }
  .goalStrip {
    grid-area: goals;
    flex-direction: row;
    width: auto;
    min-width: 0;
    margin-top: 0;
    padding: 3px;
    gap: 3px;
    border-radius: 11px;
  }
  .gsHead,
  .gs.long { display: none; }
  .gs {
    flex: 0 0 auto;
    grid-template-columns: 20px auto;
    grid-template-areas: 'i v' 'b b';
    column-gap: 4px;
    padding: 2px 5px;
  }
  .gs .gsT { display: none; }
  .gs.next { flex: 1 1 0; min-width: 0; grid-template-columns: 20px 1fr auto; grid-template-areas: 'i t v' 'b b b'; }
  .gs.next .gsT { display: block; }
  .gsI { width: 20px; height: 20px; }
}
.ctasks.goals li { align-items: center; }
.ctasks.goals li span { flex: 1; }
.ctasks.goals .btn { min-height: 0; padding: 2px 10px; font-size: 12px; }

/* s1-pace: a finger on a phone needs 40 px and the eye 13 px text (tools/tests_ui.py phone_sizes checks both on the
   first hour's screens). Before: goal chips 29 px tall, Show in the Quests 82x22 and in a message 90x32, the speed
   buttons 36x34, the price -/+ 30x34; 11-12 px in the charter, the cards' footnotes and the sunset lines */
@media (max-width: 700px) {
  #toast .tshow,
  .ctasks.goals .btn,
  .qtab {
    min-height: 40px;
  }
  .hudR .chip button,
  #pminus,
  #pplus {
    min-width: 40px;
    height: 40px;
  }
  /* the HUD keeps its height (a taller one put the camp's places under the Now line): the resource chips and the goal
     chips reach 40 px into the gaps around them, by a see-through padding or border and the same negative margin */
  .rpill .chip {
    box-sizing: border-box;
    min-height: 40px;
    margin-top: -7.5px;
    margin-bottom: -7.5px;
  }
  .gs {
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    margin-top: -6px;
    margin-bottom: -6px;
    background-clip: padding-box;
  }
  .gs,
  .nowChip,
  #toast .tshow,
  .ctasks.goals .btn,
  .casthead small,
  .daycard small,
  .daycard .dcrow,
  .qsheet small,
  .qsheet h3 small,
  #info p,
  #info small,
  #info .mat,
  #info .pill {
    font-size: 13px;
  }
}
