/*
 * The header and the four views: front, morning, evening report, and the
 * end of the game. Written mobile-first; wider layouts are added at 640px
 * and 960px.
 */

/* --- The menu board (header) ---------------------------------------------- */

.papan {
  position: relative;
  background:
    radial-gradient(120% 140% at 10% 0%, rgb(255 255 255 / 0.07), transparent 60%),
    /* The sky outside, low on the horizon: its color follows the time of day. */
    radial-gradient(70% 150% at 78% 135%, var(--langit), transparent 70%),
    var(--papan);
  color: var(--kapur);
  border-bottom: var(--border-thick) solid var(--ink);
}

/* Stars, which come out at dusk. */
.papan::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: var(--bintang);
  background-image:
    radial-gradient(1.5px 1.5px at 12% 28%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 68%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 56% 78%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 68% 32%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 81% 14%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 93% 58%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 4% 82%, #fff 50%, transparent 51%);
  pointer-events: none;
}

.papan__inner {
  position: relative;
}

/* The moon takes the sun's place once the stars are out. */
.status__moon {
  display: none;
}

:root[data-phase='petang'] .status__sun,
:root[data-phase='malam'] .status__sun {
  display: none;
}

:root[data-phase='petang'] .status__moon,
:root[data-phase='malam'] .status__moon {
  display: block;
}

/* A strip of gingham under the board: the tablecloth of every warung. */
.papan::after {
  content: '';
  position: absolute;
  inset: 100% 0 auto;
  height: 12px;
  margin-top: var(--border-thick);
  background-color: #fffdf6;
  background-image:
    linear-gradient(90deg, rgb(197 48 28 / 0.62) 50%, transparent 50%),
    linear-gradient(rgb(197 48 28 / 0.62) 50%, transparent 50%);
  background-size: 12px 12px;
  border-bottom: var(--border) solid var(--ink);
}

.papan__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--space-3) var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target);
  color: var(--kapur);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.brand__name {
  white-space: nowrap;
}

.brand__icon {
  width: 28px;
  height: 28px;
  color: var(--kunyit);
}

.papan :focus-visible {
  outline-color: var(--kunyit);
}

.papan__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.papan__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target);
  min-width: var(--target);
  justify-content: center;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--kapur);
  font-weight: 700;
  font-size: var(--text-sm);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .papan__link:hover {
    background: var(--papan-raised);
  }
}

/* A control that shows its icon only, at every width; its words stay available to screen readers. */
.papan__link--icon {
  padding: 0;
}

.papan__link--icon span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Day, cash, reputation: chalked onto the board. */
.status {
  display: flex;
  gap: var(--space-2);
  order: 3;
  width: 100%;
}

.status__item {
  flex: 1 1 0;
  min-width: 0;
  padding: var(--space-2) var(--space-3);
  border: 2px dashed rgb(246 240 221 / 0.4);
  border-radius: var(--radius-sm);
}

.status__item dt {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  /* A label of two words stays one label: the chip gives room before the words break. */
  white-space: nowrap;
  color: var(--kapur-soft);
}

.status__item dt .icon {
  width: 1em;
  height: 1em;
}

.status__item dd {
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

/*
 * The reputation answers when pressed. The number is a button whose reach
 * is the whole chip, and a little mark beside the label says there is more
 * to read.
 */
.status__item--asks {
  position: relative;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease;
}

.status__ask {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Taller than the chip, so the finger has its 44px. */
.status__ask::after {
  content: '';
  position: absolute;
  inset: -6px 0;
}

.status__ask:focus-visible {
  outline: none;
}

.status__item--asks:has(.status__ask:focus-visible) {
  outline: 3px solid var(--kunyit);
  outline-offset: 2px;
}

.status__item dt .status__hint {
  width: 1.1em;
  height: 1.1em;
  color: var(--kunyit);
}

@media (hover: hover) and (pointer: fine) {
  .status__item--asks:hover {
    background: var(--papan-raised);
  }
}

.status__item--asks:active {
  background: var(--papan-raised);
}

@media (max-width: 639px) {
  /* On a phone: name and menu on one line, the three figures on the next. */
  .brand {
    font-size: var(--text-md);
  }

  .brand__icon {
    width: 24px;
    height: 24px;
  }

  .papan__nav {
    gap: 0;
  }

  /* The menu shows icons only; the words stay available to screen readers. */
  .papan__link span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .status__item {
    flex: 1 1 auto;
    padding-inline: 10px;
  }

  .status__item dt {
    white-space: nowrap;
  }

  .status__item dt .icon {
    display: none;
  }

  /* The mark that says "press me" stays. */
  .status__item dt .status__hint {
    display: block;
  }

  .status__item dd {
    font-size: var(--text-md);
  }
}

@media (min-width: 640px) {
  .status {
    justify-content: center;
  }

  .status__item {
    flex: 0 1 auto;
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
  }
}

@media (min-width: 1100px) {
  /* Three columns, the outer two equal, so the figures sit in the true centre. */
  .papan__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .status {
    order: 0;
    width: auto;
  }

  /* Slimmer chips, so the three figures and the menu beside them share one line. */
  .status__item {
    padding: var(--space-1) var(--space-2);
  }

  /* The menu keeps to the right-hand column, also when there are no figures in the middle. */
  .papan__nav {
    grid-column: 3;
    justify-self: end;
  }

  /* A little tighter, so the menu is no wider than its column and the figures stay in the middle. */
  .papan__link:not(.papan__link--icon) {
    gap: 6px;
    padding-inline: var(--space-2);
  }
}

/* --- Views ---------------------------------------------------------------- */

main {
  padding-top: 12px; /* the gingham strip */
}

main:focus {
  outline: none;
}

/*
 * Every screen is one column of sections, all as wide as the column and the
 * same distance apart (--gap-section). What belongs to one section is kept
 * closer together (--gap-group), and a block that belongs closely to the one
 * before it says so itself (see .wallet-note).
 */
.view {
  display: grid;
  gap: var(--gap-section);
  align-content: start;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--space-6) var(--gutter) var(--space-8);
}

.view > * {
  min-width: 0;
}

/*
 * A new screen arrives a section at a time, top to bottom, each a moment
 * after the one above it: the eye is led down the page instead of being
 * handed all of it at once. Only the first few are held back, so the last
 * of them is in place within half a second, and nothing waits for them:
 * every control works from the first frame.
 *
 * Written with :where() so that it weighs nothing: a section with an
 * entrance of its own (the receipt being printed, the surprise) keeps it.
 */
:where(.view) > :where(*) {
  animation: rise-in var(--dur-view) var(--ease-out) backwards;
  animation-delay: calc(var(--stagger) * var(--order, 0));
}

:where(.view) > :where(:nth-child(2)) {
  --order: 1;
}

:where(.view) > :where(:nth-child(3)) {
  --order: 2;
}

:where(.view) > :where(:nth-child(4)) {
  --order: 3;
}

:where(.view) > :where(:nth-child(5)) {
  --order: 4;
}

:where(.view) > :where(:nth-child(n + 6)) {
  --order: 5;
}

@media (max-width: 959px) {
  /*
   * On a phone these two sections hold a bar pinned to the bottom of the
   * window. Something that is moving cannot hold anything pinned to the
   * window, so they are simply there.
   */
  .view--pagi > .desk,
  .view--malam > .report {
    animation: none;
  }
}

.view__head {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
  text-align: center;
}

/* What Pak Erlangga says reads as a paragraph, so it stays left-aligned inside its bubble. */
.view__head .bubble,
.home__hero .bubble {
  max-width: 680px;
  text-align: left;
}

.section-title {
  margin-bottom: var(--space-3);
}

.section-title--center {
  text-align: center;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: var(--border) solid var(--biru);
  border-radius: var(--radius-sm);
  background: var(--biru-soft);
  font-size: var(--text-sm);
}

.noscript {
  max-width: 60ch;
  margin: var(--space-7) auto;
  padding: var(--space-5);
  text-align: center;
}

/* --- Front ---------------------------------------------------------------- */

.home__hero {
  display: grid;
  gap: var(--space-5);
  justify-items: center;
  text-align: center;
}

/*
 * The signboard: brick red with cream lettering, the way warung signs are
 * painted. It hangs over the top edge of the street scene below it.
 */
.sign {
  position: relative;
  z-index: 1;
  max-width: 100%;
  margin-bottom: calc(-1 * var(--space-5));
  padding: var(--space-4) var(--space-7);
  background: var(--bata);
  color: var(--krem);
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--lip-lg) var(--ink);
  transform: rotate(-1.2deg);
  animation: sign-in 700ms var(--ease-out) both;
}

/* Dropped into place from above, with one small swing. */
@keyframes sign-in {
  0% {
    opacity: 0;
    transform: translateY(-40px) rotate(-6deg);
  }

  60% {
    opacity: 1;
    transform: translateY(4px) rotate(1deg);
  }

  100% {
    transform: rotate(-1.2deg);
  }
}

.sign::before,
.sign::after {
  content: '';
  position: absolute;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--krem);
  box-shadow: inset 0 -2px 0 rgb(42 27 18 / 0.35);
}

.sign::before {
  left: 16px;
}

.sign::after {
  right: 16px;
}

.sign__name {
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 3px 0 var(--bata-deep);
}

/* What is served, lettered under the name between two rules, as on a painted sign. */
.sign__menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  font-weight: 800;
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--kunyit-soft);
}

.sign__menu::before,
.sign__menu::after {
  content: '';
  flex: 1 1 var(--space-4);
  max-width: var(--space-7);
  border-top: 2px solid currentColor;
  opacity: 0.6;
}

@media (max-width: 479px) {
  /* The line breaks in two on a phone, and the rules have nothing to frame. */
  .sign {
    max-width: calc(100% - var(--space-1));
    padding-inline: var(--space-5);
    transform: rotate(-0.8deg);
  }

  .sign__menu::before,
  .sign__menu::after {
    content: none;
  }
}

/* The way in straddles the bottom edge of the scene, the way the sign straddles its top. */
.home__start {
  position: relative;
  z-index: 1;
  margin-top: calc(-1 * (var(--space-5) + 26px));
}

.home__tagline {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.3;
  text-wrap: balance;
}

.home__hero .bubble__text {
  display: grid;
  gap: var(--space-2);
}

.home__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
}

.home__hero .home__actions {
  margin-top: calc(var(--space-2) - var(--space-5));
}

/*
 * The three parts of a day, in order. On a phone a list down the page; from
 * a tablet up three columns, their icons joined by a dashed line.
 */
.how__steps {
  display: grid;
  gap: var(--space-5);
}

.how__step {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.how__words {
  display: grid;
  gap: var(--space-1);
}

.how__words p {
  color: var(--ink-soft);
}

.how__icon,
.decision__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--kunyit-soft);
}

.how__icon {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  background: var(--kunyit);
  box-shadow: var(--lip-sm) var(--ink);
}

.how__icon .icon {
  width: 1.6em;
  height: 1.6em;
}

.how__note {
  max-width: 70ch;
  margin-inline: auto;
  color: var(--ink-soft);
  text-align: center;
  text-wrap: balance;
}

@media (min-width: 640px) {
  .how__steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .how__step {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    /* Each starts at the top, so the three titles are level however long the text under them runs. */
    align-content: start;
    gap: var(--space-3);
    text-align: center;
  }

  /* From one icon to the next. */
  .how__step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 28px;
    left: calc(50% + 40px);
    width: calc(100% + var(--space-5) - 80px);
    border-top: var(--border) dashed var(--ink);
  }
}

/* --- The stage: the street scene, on the front page and during the day ------ */

.stage {
  width: 100%;
}

.stage__frame {
  position: relative;
  overflow: hidden;
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--lip-lg) var(--ink);
  background: var(--paper-deep);
}

/* The scene itself, inside the frame: what is pinned over it is pinned to this. */
.stage__view {
  position: relative;
}

.stage__canvas {
  display: block;
  width: 100%;
  height: 280px; /* set precisely by the scene once it knows its width */
}

/* Pause or play, in the corner of the scene. */
.stage__toggle {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target);
  padding: 0 var(--space-4);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 800;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease-out;
}

@media (hover: hover) and (pointer: fine) {
  .stage__toggle:hover {
    background: var(--kunyit-soft);
  }
}

.stage--home .stage__toggle {
  top: var(--space-6);
}

/* The title, the clock, and the scene are one thing: the day in progress. */
.view--siang {
  gap: var(--space-4);
  /* Nothing follows the legend, so the page ends close under it and the day fits one window. */
  padding-block: var(--space-5) var(--space-5);
}

.stage__top {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.stage__time {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* The longest name of a part of the day fits, so the bar beside it never jumps. */
.stage__time .chip {
  justify-content: center;
  min-width: 5.4em;
}

.stage__clock {
  font-size: var(--text-3xl);
  font-weight: 500;
  line-height: 1;
}

.stage__progress {
  flex: 1 1 auto;
  height: 14px;
  overflow: hidden;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper-deep);
}

.stage__progress-fill {
  display: block;
  height: 100%;
  background: var(--kunyit);
  transform: scaleX(0);
  transform-origin: left;
  /* It is set eight times a second; in between it keeps moving at the same rate. */
  transition: transform 140ms linear;
}

.stage__closed {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: rgb(31 51 39 / 0.9);
  color: var(--kapur);
  font-weight: 800;
  animation: rise-in 300ms var(--ease-out) both;
}

.stage__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* "Jeda" and "Putar" take the same room, so nothing beside them shifts. */
.stage__controls > .btn:first-child {
  min-width: 6.6em;
}

.stage .legend {
  margin-top: var(--space-4);
}

@media (max-width: 559px) {
  /* Two even rows: pause and speed, then the way to the report. */
  .stage__controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .stage__controls .segmented {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stage__controls .segmented__label {
    min-width: 0;
  }

  .stage__controls > :last-child {
    grid-column: 1 / -1;
  }

  /* The four marks in two columns, each starting at the same edge. */
  .stage .legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2) var(--space-3);
  }

  .stage .legend__item {
    align-items: flex-start;
  }

  .stage .legend__swatch {
    flex: none;
    margin-top: 3px;
  }
}

/* A choice of one among a few, as a row of joined buttons. */
.segmented {
  display: inline-flex;
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--lip-md) var(--ink);
}

.segmented__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented__label {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: var(--target);
  padding: 0 var(--space-3);
  font-family: var(--font-mono);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease-out;
}

@media (max-width: 639px) {
  .segmented__label {
    min-width: 48px;
    padding: 0 var(--space-2);
  }
}

.segmented__label:not(:last-child) {
  border-right: var(--border) solid var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .segmented__label:hover {
    background: var(--kunyit-soft);
  }
}

.segmented__input:checked + .segmented__label {
  background: var(--kunyit);
}

/*
 * With a thumb, the choices are equally wide and the color under the chosen
 * one is a block that slides from where it was to where it is going, so a
 * change of speed is seen as one. It is moved by its transform alone (set in
 * day-view.js): one thumb-width per place.
 */
.segmented--slide {
  position: relative;
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}

.segmented__thumb {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(100% / var(--choices, 4));
  background: var(--kunyit);
  transition: transform 220ms var(--ease-out);
}

.segmented--slide .segmented__label {
  position: relative;
}

.segmented--slide .segmented__input:checked + .segmented__label {
  background: transparent;
}

.segmented__input:focus-visible + .segmented__label {
  outline: 3px solid var(--focus);
  outline-offset: -4px;
}

/*
 * The running totals: chalked on a board along the bottom of the scene, in
 * the green of the menu board at the top of the page, so that what happens
 * and how often it has happened are read in one look.
 */

.tally {
  display: grid;
  /* Four to a row on a phone, each column as wide as its longest label needs. */
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 0.8fr);
  border-top: var(--border-thick) solid var(--ink);
  background: var(--papan);
  color: var(--kapur);
}

.tally__item {
  display: grid;
  gap: 2px;
  align-content: center;
  justify-items: center;
  min-width: 0;
  padding: var(--space-2) var(--space-1);
  text-align: center;
}

/* Chalk lines between the columns, and between the two rows on a phone. */
.tally__item:not(:nth-child(4n + 1)) {
  border-left: 2px dashed rgb(246 240 221 / 0.28);
}

.tally__item:nth-child(n + 5) {
  border-top: 2px dashed rgb(246 240 221 / 0.28);
}

/* Seven counts in rows of four: the last one takes the two places left over. */
.tally__item--revenue {
  grid-column: span 2;
}

.tally__item dt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--kapur-soft);
}

.tally__item dd {
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.tally__of {
  font-size: var(--text-xs);
  color: var(--kapur-soft);
}

.tally__dot {
  flex: none;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--kapur);
  border-radius: 50%;
}

.tally__item--served .tally__dot {
  background: var(--outcome-served);
}

.tally__item--reneged .tally__dot {
  background: var(--outcome-reneged);
}

.tally__item--balked .tally__dot {
  background: var(--outcome-balked);
}

.tally__item--soldout .tally__dot {
  background: var(--outcome-soldout);
}

.tally__item--revenue .tally__dot,
.tally__item--stock .tally__dot,
.tally__item--arrivals .tally__dot {
  display: none;
}

@media (min-width: 760px) {
  /* All seven in one line. */
  .tally {
    grid-template-columns: repeat(5, minmax(0, 1fr)) repeat(2, minmax(0, 1.25fr));
  }

  .tally__item {
    padding-block: var(--space-3);
  }

  .tally__item--revenue {
    grid-column: auto;
  }

  .tally__item:not(:nth-child(4n + 1)),
  .tally__item:nth-child(n + 5) {
    border-top: 0;
  }

  .tally__item + .tally__item {
    border-left: 2px dashed rgb(246 240 221 / 0.28);
  }

  .tally__item dt {
    gap: 6px;
    font-size: var(--text-xs);
  }

  .tally__item dd {
    font-size: var(--text-xl);
  }
}


/* --- Morning: the desk ---------------------------------------------------- */

/* The title and the calendar lead straight into the desk. */
.view--pagi {
  gap: var(--space-6);
}

/*
 * What Pak Erlangga says and the four choices on the left; what they cost,
 * and the button that opens the warung, on the right.
 */
.desk {
  display: grid;
  gap: var(--gap-group);
}

.desk > *,
.desk__main > * {
  min-width: 0;
}

.desk__main {
  display: grid;
  gap: var(--gap-group);
  align-content: start;
}

/* His words take the width of the column they stand in. */
.desk__main .bubble__text {
  flex: 1 1 auto;
  max-width: none;
}

.desk__side {
  display: grid;
  gap: var(--space-4);
  align-content: start;
}

.decisions {
  display: grid;
  gap: var(--space-4);
}

.decision,
.decision__main {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

/* A choice with something to show beside its control takes the whole row. */
.decision--wide {
  gap: var(--space-4);
}

.decision__main,
.decision__aside {
  min-width: 0;
}

.decision__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.decision__label {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.2;
}

.decision__control {
  display: grid;
  gap: var(--space-1);
}

/* The control spans its card, so nothing is left hanging to one side. */
.decision .stepper,
.decision .slider {
  max-width: none;
}

.decisions > * {
  animation: rise-in var(--dur-enter) var(--ease-out) both;
  animation-delay: calc(var(--i) * var(--stagger));
}

.decisions > :nth-child(1) {
  --i: 0;
}

.decisions > :nth-child(2) {
  --i: 1;
}

.decisions > :nth-child(3) {
  --i: 2;
}

.decisions > :nth-child(4) {
  --i: 3;
}

.decision__help {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* A choice that is allowed and almost surely a mistake: said, not forbidden. */
.decision__warn {
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: var(--border) solid var(--kunyit-deep);
  border-radius: var(--radius-sm);
  background: var(--kunyit-soft);
  font-size: var(--text-sm);
  font-weight: 700;
}

.decision__help a {
  color: var(--biru);
  font-weight: 800;
}

.shift-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.shift-grid__item {
  display: grid;
  gap: var(--space-1);
}

.shift-grid__item label {
  font-size: var(--text-sm);
  font-weight: 700;
}

/* A checkbox drawn as a switch. The real checkbox stays in place, invisible, to take the focus. */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--target);
  font-weight: 700;
  cursor: pointer;
}

.switch__input {
  position: absolute;
  inset: 0 auto 0 0;
  width: 52px;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  position: relative;
  flex: none;
  width: 52px;
  height: 30px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper-deep);
  transition: background-color var(--dur-fast) ease-out;
}

.switch__track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: #fff;
  transition: transform var(--dur-fast) var(--ease-out);
}

.switch__input:checked + .switch__track {
  background: var(--daun);
}

.switch__input:checked + .switch__track::after {
  transform: translateX(22px);
}

.switch__input:focus-visible + .switch__track {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* The morning receipt and the button that opens the warung */

.nota__subtitle {
  margin: var(--space-4) 0 var(--space-1);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cta {
  display: grid;
  gap: var(--space-2);
}

.cta__summary {
  text-align: center;
  font-size: var(--text-sm);
}

.cta__summary.is-loss {
  font-weight: 500;
}

.cta__blocked {
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--sambal-text);
}

/* The choices in the letters of queueing theory: a list to open */

.params {
  display: grid;
}

.param {
  display: grid;
  grid-template-columns: 3.6em minmax(0, 1fr);
  column-gap: var(--space-3);
  align-items: center;
  padding-block: var(--space-2);
}

.param + .param {
  border-top: 2px dashed var(--line-soft);
}

/* dt and dd share the row: the symbol on the left spans both lines of text. */
.param dt {
  display: contents;
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.param dt .chip {
  grid-row: span 2;
  justify-content: center;
  padding-inline: var(--space-1);
}

.param dd {
  grid-column: 2;
  font-weight: 700;
  line-height: 1.3;
}

/* Said in passing after the value, and kept in one piece. */
.param__aside {
  font-weight: 400;
  color: var(--ink-soft);
  white-space: nowrap;
}

@media (min-width: 640px) {
  /* Symbol, what it is, and its value, in one line. */
  .param {
    grid-template-columns: 3.6em minmax(0, 1fr) auto;
  }

  .param dt .chip {
    grid-row: auto;
  }

  .param dd {
    grid-column: 3;
    text-align: right;
  }
}

/* Yesterday's arrivals and today's capacity, inside the staff card */

.capacity {
  display: grid;
  gap: var(--space-2);
}

.capacity__title {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.3;
}

.capacity .legend {
  margin-top: 0;
}

.capacity-chart {
  width: 100%;
  height: auto;
}

.capacity-chart__grid {
  stroke: var(--line-soft);
  stroke-width: 1;
}

.capacity-chart__tick {
  fill: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 13px;
}

.capacity-chart__bar {
  fill: var(--kunyit);
  stroke: var(--ink);
  stroke-width: 1.2;
}

/* Hours in which more customers came than could be served. */
.capacity-chart__bar--over {
  fill: var(--outcome-reneged);
}

.capacity-chart__line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2.5;
  stroke-dasharray: 6 4;
  stroke-linejoin: round;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.legend__swatch--bar {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: var(--kunyit);
}

.legend__swatch--line {
  width: 22px;
  border-top: 2.5px dashed var(--ink);
}

.legend--center {
  justify-content: center;
}

.legend__swatch--patience {
  width: 22px;
  height: 7px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--outcome-served) 62%, var(--surface) 62%);
}

.legend__swatch--ring {
  width: 14px;
  height: 14px;
  border: 3px solid var(--kunyit);
  border-radius: 50%;
}

.legend__swatch--angry,
.legend__swatch--full {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.legend__swatch--angry {
  background: var(--outcome-reneged);
  color: #fff;
}

.legend__swatch--angry::before {
  content: '!';
}

.legend__swatch--full {
  background: var(--outcome-balked);
}

.legend__swatch--full::before {
  content: '×';
}

.legend__swatch--fill {
  width: 18px;
  height: 10px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--kunyit);
}

.legend__swatch--mark {
  height: 16px;
  border-left: 3px solid var(--ink);
}

.legend__swatch--dotted {
  border-left-style: dotted;
}

@media (max-width: 959px) {
  /* Under the choices the receipt keeps the width of a receipt. */
  .desk__side .nota {
    justify-self: center;
    width: min(100%, 440px);
  }

  /* On a phone the button that opens the warung stays within reach. */
  .view--pagi {
    padding-bottom: 148px;
  }

  .cta {
    position: fixed;
    inset: auto 0 0 0;
    z-index: var(--z-sticky);
    padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: var(--border-thick) solid var(--ink);
  }
}

@media (min-width: 640px) {
  .decisions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .decision--wide {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }

  /* The chart starts level with the name of the choice it belongs to. */
  .decision--wide:has(.capacity) {
    align-items: start;
  }

  .capacity__title {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (min-width: 960px) {
  /*
   * The receipt and the button that opens the warung stay in sight while
   * the choices scroll past, so a change and what it costs are seen together.
   */
  .desk {
    grid-template-columns: minmax(0, 1fr) 352px;
    align-items: start;
  }

  .desk__side {
    position: sticky;
    top: var(--space-4);
  }

  /* The receipt right above already shows it. */
  .cta__summary {
    display: none;
  }
}

/* --- Evening: the report -------------------------------------------------- */

.report {
  display: grid;
  gap: var(--space-5);
}

.report > * {
  min-width: 0;
  animation: rise-in var(--dur-view) var(--ease-out) both;
  animation-delay: calc(var(--i) * var(--stagger));
}

.report > :nth-child(1) {
  --i: 0;
}

.report > :nth-child(2) {
  --i: 1;
}

.report > :nth-child(3) {
  --i: 2;
}

.report > :nth-child(n + 4) {
  --i: 3;
}

/* The receipt and the customers, side by side and ending on the same line. */
.report__pair {
  display: grid;
  gap: var(--space-5);
  align-items: stretch;
}

.report__pair > * {
  min-width: 0;
}

.report__pair > .card {
  display: flex;
  flex-direction: column;
}

.report__pair .outcomes {
  flex: 1 1 auto;
  align-content: space-between;
}

.report__next {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: var(--space-3);
}

@media (max-width: 959px) {
  /* Like the button that opens the warung: the way on stays within reach of the thumb. */
  .view--malam {
    padding-bottom: 116px;
  }

  .view--malam .report__next {
    position: fixed;
    inset: auto 0 0 0;
    z-index: var(--z-sticky);
    margin: 0;
    padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: var(--border-thick) solid var(--ink);
  }

  .view--malam .report__next .btn {
    width: 100%;
  }
}

/* The day's result, large */

.hero-result {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--lip-lg) var(--ink);
}

.hero-result--gain {
  background: var(--daun-soft);
}

.hero-result--loss {
  background: var(--sambal-soft);
}

.hero-result__main {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0 var(--space-3);
}

.hero-result__label {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
}

/* The figure of the day, in the lettering of the signboard: as heavy as the headings around it. */
.hero-result__amount {
  grid-column: 1 / -1;
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 10vw, 3.75rem);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
  /* While it counts up the digits blur into one another, then come sharp. */
  animation: ink-settle 1000ms var(--count-delay, 250ms) var(--ease-out) backwards;
}

@keyframes ink-settle {
  from {
    filter: blur(5px);
    opacity: 0.5;
  }
}

.hero-result--gain .hero-result__amount {
  color: var(--daun-text);
}

.hero-result--loss .hero-result__amount {
  color: var(--sambal-text);
}

/* A rubber stamp, so that gain and loss differ in more than color. */
.stamp {
  justify-self: start;
  padding: 0 var(--space-3);
  border: 3px solid currentColor;
  border-radius: var(--radius-xs);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transform: rotate(-6deg);
  animation: stamp-in 260ms 1250ms both;
}

/*
 * A rubber stamp: it is not there, then it hits the paper (falling, so it
 * speeds up), presses in a little, and lifts to rest. No bounce: ink does
 * not spring back.
 */
@keyframes stamp-in {
  0% {
    opacity: 0;
    transform: rotate(-10deg) scale(1.9);
    animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5);
  }

  55% {
    opacity: 1;
    transform: rotate(-6deg) scale(0.94);
    animation-timing-function: var(--ease-out);
  }

  100% {
    transform: rotate(-6deg) scale(1);
  }
}

/* The receipt comes out of the printer. */
.view--malam .nota {
  animation: print 800ms 300ms var(--ease-out) both;
}

@keyframes print {
  from {
    clip-path: inset(0 0 100% 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

.hero-result--gain .stamp {
  color: var(--daun-text);
}

.hero-result--loss .stamp {
  color: var(--sambal-text);
}

/*
 * Three facts beside the result. Written on the same tinted paper and kept
 * apart by dashed rules, the way the lines of a receipt are: on a phone as
 * rows (what it is, then the figure), from a tablet up as columns.
 */
.hero-result__facts {
  display: grid;
}

.hero-result__fact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 0 var(--space-3);
  padding-block: var(--space-2);
}

.hero-result__fact + .hero-result__fact {
  border-top: 2px dashed var(--rule);
}

.hero-result__fact dt {
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-result__fact dd {
  display: grid;
  justify-items: end;
  font-size: var(--text-lg);
  font-weight: 500;
  line-height: 1.3;
  text-align: right;
  white-space: nowrap;
}

.hero-result__fact small {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 400;
}

@media (min-width: 640px) {
  .hero-result__facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-result__fact {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: var(--space-1);
    padding: 0 var(--space-4);
  }

  .hero-result__fact:first-child {
    padding-left: 0;
  }

  .hero-result__fact:last-child {
    padding-right: 0;
  }

  .hero-result__fact + .hero-result__fact {
    border-top: 0;
    border-left: 2px dashed var(--rule);
  }

  .hero-result__fact dd {
    justify-items: start;
    text-align: left;
  }
}

.nota__rows--cash {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 2px solid var(--ink);
}

/* Customers by how their visit ended */

.flowbar {
  transform-origin: left;
  animation: grow-x 800ms 450ms var(--ease-out) both;
  display: flex;
  height: 28px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.flowbar__part {
  min-width: 4px;
}

.flowbar__part + .flowbar__part {
  border-left: var(--border) solid var(--ink);
}

.flowbar__part--served,
.outcome--served .outcome__mark {
  background: var(--outcome-served);
}

.flowbar__part--reneged,
.outcome--reneged .outcome__mark {
  background: var(--outcome-reneged);
}

.flowbar__part--balked,
.outcome--balked .outcome__mark {
  background: var(--outcome-balked);
}

.flowbar__part--soldout,
.outcome--soldout .outcome__mark {
  background: var(--outcome-soldout);
}

.outcomes {
  display: grid;
  gap: var(--space-3);
}

.outcome {
  display: grid;
  grid-template-columns: auto 3.2em minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
}

.outcome__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  color: #fff;
}

/* Amber is too light for a white icon. */
.outcome--balked .outcome__mark {
  color: var(--ink);
}

.outcome__count {
  font-size: var(--text-xl);
  font-weight: 500;
  text-align: right;
}

/* An ending nobody had today steps back. */
.outcome--none .outcome__mark {
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.outcome--none .outcome__count,
.outcome--none .outcome__label strong {
  color: var(--ink-soft);
}

.outcome__label small {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink-soft);
  line-height: 1.35;
}

/* Queueing metrics */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: var(--space-5) var(--space-6);
}

/* Each measure under a dashed rule, like an entry on a receipt. */
.metric {
  display: grid;
  gap: var(--space-1);
  align-content: start;
  padding-top: var(--space-4);
  border-top: 2px dashed var(--line-soft);
}

/* The fifth tile takes a full row, so no row is left half empty. */
.metric:last-child {
  grid-column: 1 / -1;
}

.metric dt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  /* As tall as a symbol, with or without one, so the figures below stand level. */
  min-height: 30px;
  gap: var(--space-2);
  font-weight: 800;
  font-size: var(--text-sm);
}

.metric dd {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.metric__value {
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.15;
}

.metric__unit {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-soft);
}

.metric__note {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* Charts and their tables */

.chart {
  position: relative;
  width: 100%;
}

.chart--tall {
  height: 320px;
}

.chart--short {
  height: 190px;
}

.chart__summary {
  margin-bottom: var(--space-4);
  max-width: 75ch;
}

.details {
  margin-top: var(--space-4);
}

.details summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--target);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.details summary::-webkit-details-marker {
  display: none;
}

/* A drawn arrowhead that turns down when the list is open, so it reads as something to press. */
.details summary::before {
  content: '';
  flex: none;
  width: 9px;
  height: 9px;
  margin-left: 2px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: translateY(-1px) rotate(-45deg);
  transition: transform var(--dur-fast) var(--ease-out);
}

.details[open] > summary::before {
  transform: translateY(-3px) rotate(45deg);
}

/* A list to open that is a block of its own on the page. */
.details--block {
  width: 100%;
  margin: 0;
  padding: var(--space-1) var(--space-5);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--lip-md) var(--lip-color);
}

.details--block > summary {
  display: flex;
}

.details--block[open] {
  padding-bottom: var(--space-5);
}

.details[open] > :not(summary) {
  animation: panel-in 200ms var(--ease-out) both;
}

.details__lead {
  margin: var(--space-1) 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* Two of them in a row on a screen belong together. */
.view > .details--block + .details--block {
  margin-top: calc(var(--space-3) - var(--gap-section));
}

.table-scroll {
  overflow-x: auto;
  margin-top: var(--space-2);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-sm);
}

.table {
  font-size: var(--text-sm);
  min-width: 520px;
}

.table th,
.table td {
  padding: var(--space-2) var(--space-3);
  text-align: right;
  white-space: nowrap;
}

.table th:first-child {
  text-align: left;
}

.table thead th {
  background: var(--paper-deep);
  border-bottom: var(--border) solid var(--ink);
  font-weight: 800;
}

.table tbody tr + tr > * {
  border-top: 1px solid var(--line-soft);
}

.table tbody th {
  font-weight: 700;
}

.trends {
  display: grid;
  gap: var(--space-5);
}

.trend figcaption {
  font-weight: 800;
  font-size: var(--text-sm);
  margin-bottom: var(--space-2);
}

/* The score behind the reputation */

.score {
  display: grid;
  gap: var(--space-1);
}

.score__line {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  gap: var(--space-3);
  align-items: baseline;
}

.score__amount {
  text-align: right;
  font-weight: 500;
}

.score__total {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 2px dashed var(--ink);
}

.score__total strong {
  font-size: var(--text-xl);
  font-weight: 500;
}

.meter {
  position: relative;
  height: 22px;
  margin: var(--space-5) 0 var(--space-2);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper-deep);
}

.meter__fill {
  transform-origin: left;
  animation: grow-x 900ms 500ms var(--ease-out) both;
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: var(--radius-pill);
  background: var(--kunyit);
  border-right: var(--border) solid var(--ink);
}

.meter__marker {
  position: absolute;
  top: -7px;
  bottom: -7px;
  width: 0;
  border-left: 3px solid var(--ink);
}

.meter__marker--score {
  border-left-style: dotted;
}

@media (min-width: 860px) {
  .report__pair {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  }

  /* Five tiles without a gap: three across, then two sharing the next row. */
  .metrics {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .metric {
    grid-column: span 2;
  }

  /* The last one takes two places, so every edge lines up with the row above. */
  .metric:last-child {
    grid-column: span 4;
  }

  .trends {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-result {
    grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
    align-items: center;
    padding: var(--space-6);
  }
}

/* --- The end of the game: the certificate ----------------------------------- */

/*
 * A certificate in the manner of an Indonesian "piagam": cream paper, a
 * double rule all round with an ornament in each corner, a centered title,
 * and a signature at the foot.
 */
.piagam {
  display: grid;
  gap: var(--space-4);
  justify-items: center;
}

.piagam__frame {
  position: relative;
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  width: 100%;
  max-width: 760px;
  padding: var(--space-7) var(--space-5);
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 50% 0%, rgb(242 169 30 / 0.16), transparent 60%),
    var(--krem);
  box-shadow: var(--lip-lg) var(--ink);
  text-align: center;
  animation: rise-in 520ms var(--ease-out) both;
}

/* The inner rule, and a turmeric ornament in each corner. */
.piagam__frame::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: var(--border) solid var(--kunyit-deep);
  border-radius: var(--radius-xs);
  background:
    radial-gradient(circle at 0 0, var(--kunyit) 0 14px, transparent 15px),
    radial-gradient(circle at 100% 0, var(--kunyit) 0 14px, transparent 15px),
    radial-gradient(circle at 0 100%, var(--kunyit) 0 14px, transparent 15px),
    radial-gradient(circle at 100% 100%, var(--kunyit) 0 14px, transparent 15px);
  pointer-events: none;
}

.piagam__frame > * {
  position: relative;
}

.piagam__kicker {
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bata-deep);
}

.piagam__stars {
  display: flex;
  gap: var(--space-2);
}

.piagam__star {
  width: 52px;
  height: 52px;
  fill: var(--paper-deep);
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.piagam__star--on {
  fill: var(--kunyit);
}

/* A star that has just been earned drops into its place, a touch too far, and settles. */
.piagam__star--landing {
  animation: star-land 460ms var(--ease-bounce) both;
}

@keyframes star-land {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(1.7) rotate(-32deg);
  }
}

.piagam__title {
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1.05;
  color: var(--bata);
}

.piagam__to,
.piagam__for {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* The name is written on the line, like a certificate filled in by hand. */
.piagam__name {
  width: min(100%, 420px);
  min-height: var(--target);
  padding: 0 var(--space-3);
  border: 0;
  border-bottom: var(--border) dashed var(--ink);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  text-align: center;
}

.piagam__name::placeholder {
  color: var(--ink-soft);
  font-weight: 600;
  opacity: 0.7;
}

/* One column on a phone, where a full amount needs the whole width; two from there on. */
.piagam__facts {
  display: grid;
  gap: var(--space-3);
  width: 100%;
  margin-top: var(--space-3);
}

@media (min-width: 520px) {
  .piagam__facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.piagam__fact {
  display: grid;
  gap: 2px;
  align-content: start;
  padding: var(--space-3);
  border: 2px dashed var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.piagam__fact dt {
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.piagam__fact dd {
  display: grid;
  gap: 2px;
}

.piagam__fact .num {
  font-size: var(--text-xl);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.piagam__fact small {
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.piagam__sign {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
  text-align: left;
}

.piagam__sign p {
  display: grid;
  line-height: 1.2;
}

.piagam__sign strong {
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.piagam__sign small {
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

.piagam__next {
  max-width: 60ch;
  color: var(--ink-soft);
  text-align: center;
  text-wrap: balance;
}

@media (min-width: 720px) {
  .piagam__frame {
    padding: var(--space-7);
  }
}

/* --- The tutorial: stars, the rent rise, reputation --------------------------- */

.goal__rules {
  display: grid;
  gap: var(--space-4);
}

.goal__rules li {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
}

/* As tall as the round marks beside it, so the texts start level. */
.goal__stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 36px;
}

.goal__stars .icon {
  width: 22px;
  height: 22px;
  fill: var(--kunyit);
  stroke-width: 1.6;
}

.goal__mark {
  display: grid;
  place-items: center;
  justify-self: center;
  width: 36px;
  height: 36px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--kunyit-soft);
}

/* The rule about tips carries a coin. */
.goal__mark--coin {
  background: var(--kunyit);
}

.goal__mark--warning {
  background: var(--sambal-soft);
  color: var(--sambal-text);
}

/*
 * Four things worth knowing before the first day, as a short list: each a
 * mark and one line. On a wide screen they stand two by two, read left to
 * right like the lines of a menu, not as a second row of columns under the
 * three steps above.
 */
.goal__rules {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding-top: var(--space-5);
  border-top: 2px dashed var(--line-soft);
}

@media (min-width: 720px) {
  .goal__rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4) var(--space-6);
  }
}

/* The day the rent goes up, marked on the calendar. */
/* Both pins sit on the top edge of their own cell, clear of the cells beside it. */
.cal__rent {
  position: absolute;
  top: -9px;
  left: 3px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--sambal);
  color: #fff;
}

.cal__rent .icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.6;
}

/* --- Numbers that follow from the player's choices -------------------------- */

/* Marked like a price written in highlighter, so they stand out from the fixed words. */
.live {
  display: inline-block;
  padding: 0 0.4em;
  border-radius: var(--radius-xs);
  background: var(--kunyit-soft);
  box-shadow: inset 0 -2px 0 var(--kunyit);
  color: var(--ink);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* --- The day's event: this morning's news, or a surprise --------------------- */

/*
 * Everything in the box is centered: what it is, then what it means. The
 * icon sits in line with the name, so the two read as one heading.
 */
.news,
.happened {
  display: grid;
  gap: var(--space-2);
  justify-items: center;
  /* As wide as what it says, in the middle of the page: a note, not a band across it. */
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  padding: var(--space-4) var(--space-6);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--biru-soft);
  box-shadow: var(--lip-md) var(--lip-color);
  text-align: center;
}

.news {
  animation: rise-in var(--dur-view) var(--ease-out) 80ms both;
}

/* A surprise is louder than a piece of news. */
.happened--surprise {
  background: var(--kunyit-soft);
}

/*
 * During the day the note is not there until the clock reaches it. News
 * rises into place; a surprise drops in a little askew, goes a touch past
 * its size, and settles.
 */
.view--siang .happened {
  animation: rise-in var(--dur-view) var(--ease-out) both;
  /* Under the scene on a phone, inside its frame. */
  margin: var(--space-3) auto;
  box-shadow: none;
}

@media (min-width: 760px) {
  /*
   * On a wide screen it hangs over the sky in the middle of the scene,
   * between Pak Erlangga's corner and the roof: nobody has to scroll to
   * learn why the day has just changed.
   */
  .view--siang .happened {
    position: absolute;
    top: var(--space-3);
    /* A little left of the middle, so it clears the roof whatever the width of the stall. */
    inset-inline: 0 14%;
    gap: 2px;
    max-width: min(380px, 38%);
    margin: 0 auto;
    padding: var(--space-2) var(--space-4);
    pointer-events: none;
  }

  .view--siang .happened__title {
    font-size: var(--text-md);
  }

  .view--siang .happened__icon {
    width: 28px;
    height: 28px;
  }

  .view--siang .happened__text {
    font-size: var(--text-xs);
  }
}

.view--siang .happened--surprise {
  animation: surprise-in 420ms both;
}

@keyframes surprise-in {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.92) rotate(-1.6deg);
    animation-timing-function: var(--ease-out);
  }

  55% {
    opacity: 1;
    transform: translateY(-3px) scale(1.03) rotate(0.5deg);
    animation-timing-function: var(--ease-in-out);
  }

  100% {
    transform: none;
  }
}

.news__title,
.happened__title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  line-height: 1.2;
}

.happened__title {
  font-size: var(--text-lg);
}

.news__icon,
.happened__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
}

.happened__icon {
  width: 34px;
  height: 34px;
}

.news__text,
.happened__text {
  max-width: 62ch;
  text-wrap: balance;
}

.happened__text {
  font-size: var(--text-sm);
}

.news__kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #174a68;
}


/* --- Morning: the way to the shop next door ---------------------------------- */

.teaser {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3) var(--space-4);
  align-items: center;
  background:
    repeating-linear-gradient(-45deg, transparent 0 14px, rgb(242 169 30 / 0.12) 14px 28px),
    var(--surface);
}

.teaser__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--bata);
  color: var(--krem);
  box-shadow: var(--lip-sm) var(--ink);
  transform: rotate(-4deg);
}

.teaser__icon .icon {
  width: 1.75em;
  height: 1.75em;
}

.teaser__body {
  display: grid;
  gap: 2px;
}

.teaser__body h2 {
  font-size: var(--text-xl);
  line-height: 1.2;
}

.teaser__body p {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.teaser__body .teaser__basket {
  margin-top: var(--space-1);
  color: var(--ink);
  font-weight: 700;
}

.teaser__go {
  grid-column: 1 / -1;
}

@media (min-width: 640px) {
  .teaser {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .teaser__go {
    grid-column: auto;
  }
}

/* --- The shop next door ------------------------------------------------------ */

.toko__tagline {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink-soft);
  text-wrap: balance;
}

/* The wallet stays in sight while the shelves scroll past. */
.wallet {
  position: sticky;
  top: var(--space-2);
  z-index: var(--z-sticky);
  padding: var(--space-3) var(--space-4);
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--papan);
  color: var(--kapur);
  box-shadow: var(--lip-md) var(--ink);
}

.wallet__figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-4);
}

.wallet__figure dt {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--kapur-soft);
}

.wallet__figure dd {
  font-size: var(--text-md);
  white-space: nowrap;
}

.wallet__figure--left dd {
  font-weight: 500;
}

.wallet .live {
  background: var(--kunyit);
  box-shadow: none;
}

.wallet dd.is-loss .live {
  background: var(--sambal-soft);
  color: var(--sambal-text);
}

/* The note under the wallet belongs to it, so it sits closer than a block of its own. */
.wallet-note {
  margin-top: calc(var(--space-3) - var(--gap-section));
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-align: center;
  text-wrap: balance;
}

.wallet-note.is-loss {
  font-weight: 700;
}

@media (min-width: 600px) {
  .wallet__figures {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 860px) {
  .wallet__figure dd {
    font-size: var(--text-lg);
  }
}

.wares {
  display: grid;
  /* One column that never grows past the page, whatever is written in a card. */
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .wares {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Five things in two columns: the last one sits in the middle, not off to one side. */
@media (min-width: 640px) and (max-width: 999px) {
  .wares > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - var(--space-3));
  }
}

/*
 * Five things in rows of three: three on top and two centered under them.
 * Each card takes two of six columns, and the fourth starts one column in.
 */
@media (min-width: 1000px) {
  .wares {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .wares > * {
    grid-column: span 2;
  }

  .wares > :nth-child(3n + 4):nth-last-child(2) {
    grid-column: 2 / span 2;
  }
}

/* One thing on the shelf. */
/* A column: the description takes the room left over, so every card ends with its button. */
.ware {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) ease-out;
  animation: rise-in var(--dur-enter) var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

.wares > :nth-child(2) {
  --i: 1;
}

.wares > :nth-child(3) {
  --i: 2;
}

.wares > :nth-child(4) {
  --i: 3;
}

.wares > :nth-child(5) {
  --i: 4;
}

/* It leans toward the pointer (see tilt() in motion.js), and lifts when hovered. */
.ware {
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
}

@media (hover: hover) and (pointer: fine) {
  .ware:hover {
    transform: perspective(900px) translateY(-5px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
    box-shadow: 0 9px 0 var(--lip-color);
  }

  .ware:hover .ware__icon {
    transform: rotate(-8deg) scale(1.06);
  }
}

.ware--chosen {
  background: var(--daun-soft);
  border-color: var(--daun-text);
}

.ware__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.ware__icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--kunyit-soft);
  box-shadow: var(--lip-sm) var(--ink);
  transition: transform var(--dur-fast) var(--ease-out);
}

.ware__icon .icon {
  width: 2em;
  height: 2em;
}

/* A price tag on a string. */
.ware__price {
  position: relative;
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-5);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-xs) var(--radius-sm) var(--radius-sm) var(--radius-xs);
  background: var(--kunyit);
  font-weight: 500;
  white-space: nowrap;
  transform: rotate(3deg);
}

.ware__price::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 8px;
  height: 8px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  transform: translateY(-50%);
}

.ware__price small {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 700;
}

.ware__name {
  font-size: var(--text-xl);
  line-height: 1.2;
}

.ware__effect {
  flex: 1 1 auto;
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.ware__change {
  padding: var(--space-2) var(--space-3);
  border: 2px dashed var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--paper);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.9;
}

.ware--chosen .ware__change {
  border-color: var(--daun-text);
  background: var(--surface);
}

/* The arrow and what follows it stay together, so no line ends on an arrow. */
.ware__pair {
  white-space: nowrap;
}

.ware__change .live {
  white-space: normal;
}

.ware__before {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--ink-soft);
}

.ware__buy {
  width: 100%;
}

.ware .stepper {
  max-width: none;
}

.ware__reason {
  min-height: 1.4em;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--sambal-text);
  text-align: center;
}

.ware__reason:empty {
  display: none;
}

.ware__owned {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--target);
  font-weight: 800;
  color: var(--daun-text);
}

/* Stuck across the corner once the item is in the basket. */
.ware__ribbon {
  position: absolute;
  top: -12px;
  left: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--daun);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 800;
  transform: rotate(-3deg);
  animation: ribbon-in 260ms var(--ease-out) both;
}

.ware__ribbon[hidden] {
  display: none;
}

@keyframes ribbon-in {
  from {
    opacity: 0;
    transform: rotate(-12deg) scale(1.6);
  }
}

/* Training: one pip per level. */
.pips {
  display: flex;
  gap: var(--space-2);
}

.pips__pip {
  width: 28px;
  height: 10px;
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.pips__pip--done {
  background: var(--daun);
}

.toko__back {
  display: flex;
  justify-content: center;
}

/* --- Front: how to play ------------------------------------------------------- */

.guide {
  display: grid;
  gap: var(--space-6);
  scroll-margin-top: var(--space-4);
}

.guide > * {
  min-width: 0;
}

.guide__head {
  display: grid;
  gap: var(--space-3);
  justify-items: center;
  text-align: center;
}

.guide__head .section-title {
  margin-bottom: 0;
  font-size: var(--text-3xl);
}

.guide__head .section-title:focus {
  outline: none;
}

/* What is only looked up: three lists to open, close together. */
.guide__more {
  display: grid;
  gap: var(--space-3);
}

/* What the marks in the scene mean */
.marks {
  display: grid;
  gap: var(--space-4) var(--space-5);
  padding-top: var(--space-2);
}

.mark {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.mark p {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.figure {
  width: 72px;
  height: 81px;
  border-radius: var(--radius-sm);
  background: var(--tanah);
}

@media (min-width: 640px) {
  .marks {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1000px) {
  .marks {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* Seven marks: the last one sits in the middle of its row. */
  .marks > :last-child:nth-child(3n + 1) {
    grid-column: 2;
  }
}

/* Events: what is told in the morning, and what is not */
.happenings {
  display: grid;
  gap: var(--space-5);
}

.happenings__group {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.happenings__group h3 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.happenings__lead {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.happenings__list {
  display: grid;
  gap: var(--space-3);
}

.happening {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
}

.happening__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--biru-soft);
}

.happenings__group:last-child .happening__icon {
  background: var(--kunyit-soft);
}

.happening p {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

@media (min-width: 760px) {
  /* Two columns that start level: heading, a lead of the same height, then the list. */
  .happenings {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-6);
  }

  .happenings__group {
    grid-template-rows: auto auto 1fr;
  }

  .happenings__lead {
    min-height: 2lh;
  }

  /* Every entry as tall as the tallest, so the two lists run level. */
  .happening {
    min-height: 4.3rem;
  }
}

/* The glossary */
.glossary {
  display: grid;
  gap: var(--space-3);
}

.glossary__item dt {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 800;
}

.glossary__item dd {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

@media (min-width: 640px) {
  .glossary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4) var(--space-5);
  }
}

/* Who made it, at the foot of the front page */
.credit {
  padding-top: var(--space-5);
  border-top: 2px dashed var(--line-soft);
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-align: center;
}

.credit a {
  color: var(--ink);
  font-weight: 800;
}

/* --- The fourteen days as a wall calendar ------------------------------------ */

.cal {
  width: 100%;
}

/* Close together on a phone, so each of the seven cells is wide enough for a thumb. */
.cal__days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-3) var(--space-1);
}

@media (min-width: 480px) {
  .cal__days {
    column-gap: var(--space-2);
  }
}

.cal__day {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 1px;
  min-height: 52px;
  padding: var(--space-1);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.1;
  text-decoration: none;
}

a.cal__day {
  box-shadow: var(--lip-sm) var(--lip-color);
  transition:
    transform var(--dur-press) ease-out,
    box-shadow var(--dur-press) ease-out;
}

@media (hover: hover) and (pointer: fine) {
  a.cal__day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 var(--lip-color);
  }
}

a.cal__day:active {
  transform: translateY(2px);
  box-shadow: none;
  transition-duration: var(--dur-press);
}

.cal__number {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
}

.cal__day--gain {
  background: var(--daun-soft);
  border-color: var(--daun-text);
}

.cal__day--loss {
  background: var(--sambal-soft);
  border-color: var(--sambal-text);
}

/* The stamp: plus for a profit, minus for a loss, so the color is not the only cue. */
.cal__stamp {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
}

.cal__stamp .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3.2;
}

.cal__day--gain .cal__stamp {
  background: var(--daun);
}

.cal__day--loss .cal__stamp {
  background: var(--sambal);
}

.cal__day--fresh .cal__stamp {
  animation: ribbon-in 420ms var(--ease-out) 500ms both;
}

.cal__amount {
  display: none;
  font-size: var(--text-2xs);
  white-space: nowrap;
}

/* What happened that day, pinned to the corner. */
.cal__event {
  position: absolute;
  top: -9px;
  right: 3px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--kunyit);
  color: var(--ink);
}

.cal__event .icon {
  width: 13px;
  height: 13px;
}

/* The report on screen */
.cal__day[aria-current='page'] {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.cal__day--today {
  border-style: dashed;
  background: var(--kunyit-soft);
}

.cal__today {
  display: none;
  font-size: var(--text-2xs);
  font-weight: 800;
  white-space: nowrap;
}

.cal__today-icon {
  width: 18px;
  height: 18px;
}

.cal__day--ahead {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}

@media (max-width: 719px) {
  /* In a narrow cell the pins are smaller and hang off its corners, clear of the number. */
  .cal__rent,
  .cal__event {
    top: -7px;
    width: 18px;
    height: 18px;
  }

  .cal__rent {
    left: -3px;
  }

  .cal__event {
    right: -3px;
  }

  .cal__rent .icon,
  .cal__event .icon {
    width: 10px;
    height: 10px;
  }
}

@media (min-width: 720px) {
  .cal__days {
    grid-template-columns: repeat(14, minmax(0, 1fr));
  }

  .cal__day {
    min-height: 64px;
  }
}

/* Seven wide cells on a tablet, fourteen on a desktop: both have room for the words. */
@media (min-width: 560px) and (max-width: 719px), (min-width: 960px) {
  .cal__today {
    display: block;
  }

  .cal__today-icon {
    display: none;
  }
}

@media (min-width: 960px) {
  .cal__amount {
    display: block;
  }
}

/* --- Tabs ---------------------------------------------------------------------- */

/*
 * The chosen tab is marked by one pill that slides from tab to tab under
 * the words. The pill is two layers the size of the whole bar, an ink one
 * and a turmeric one inside it, each cut down to the chosen tab with
 * clip-path (see createTabs in controls.js). Moving it is then a change of
 * clip-path alone: nothing is laid out again, and the words never move.
 */
.tabs {
  position: relative;
  justify-self: center;
  max-width: 100%;
  padding: var(--space-1);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--paper-deep);
}

.tabs__list {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

.tabs__ink,
.tabs__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  /* Until the bar has been measured there is nothing to show. */
  clip-path: inset(50%);
  transition: clip-path 260ms var(--ease-out);
}

.tabs__ink {
  background: var(--ink);
}

.tabs__fill {
  background: var(--kunyit);
}

/* Placed for the first time, or chosen with the arrow keys: it is simply there. */
.tabs[data-instant] > .tabs__ink,
.tabs[data-instant] > .tabs__fill {
  transition: none;
}

.tabs__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--target);
  padding: 0 var(--space-4);
  border: var(--border) solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) ease,
    transform var(--dur-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .tabs__tab:not([aria-selected='true']):hover {
    background: var(--surface);
  }
}

.tabs__tab:active {
  transform: translateY(2px);
}

.tabs__panel {
  display: grid;
  gap: var(--space-5);
  animation: panel-in 200ms var(--ease-out) both;
}

/* A panel is the same page turned over, not a new one: it barely moves. */
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Chosen with the arrow keys, a panel is simply there. */
.tabs__panel[data-instant] {
  animation: none;
}

.tabs__panel > * {
  min-width: 0;
}

.tabs__panel > .bubble {
  justify-self: center;
  width: 100%;
  max-width: 680px;
}

.tabs__panel:focus-visible {
  outline-offset: 6px;
  border-radius: var(--radius-md);
}

/* Four tabs on a phone: the icon over its word, so neither has to go. */
@media (max-width: 559px) {
  .tabs {
    width: 100%;
    border-radius: var(--radius-md);
  }

  .tabs__list {
    gap: 0;
  }

  .tabs__tab {
    flex: 1 1 0;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    padding: var(--space-2) var(--space-1);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    line-height: 1.2;
  }
}

/* --- The guided tour ------------------------------------------------------------ */


/* The dialog covers the window and is see-through; the dimming is the hole's shadow. */
.tour {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.tour::backdrop {
  background: transparent;
}

.tour__hole {
  position: absolute;
  top: 0;
  left: 0;
  border: var(--border-thick) solid var(--kunyit);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 200vmax rgb(42 27 18 / 0.62);
  pointer-events: none;
  transition:
    transform var(--dur-enter) var(--ease-out),
    width var(--dur-enter) var(--ease-out),
    height var(--dur-enter) var(--ease-out),
    box-shadow var(--dur-enter) ease,
    opacity var(--dur-enter) ease;
}

/*
 * The tour opens where its first step is: the page dims and the card fades
 * in, already in place. Only from the second step on do the light and the
 * card travel (see data-placed in tour.js); before that they would fly in
 * from the corner of the window they were created in.
 */
.tour:not([data-placed]) .tour__hole {
  transition:
    box-shadow var(--dur-enter) ease,
    opacity var(--dur-enter) ease;
}

.tour:not([data-placed]) .tour__card {
  transition: opacity var(--dur-enter) var(--ease-out);
}

@starting-style {
  .tour__hole {
    box-shadow: 0 0 0 200vmax rgb(42 27 18 / 0);
    opacity: 0;
  }

  .tour__card {
    opacity: 0;
  }
}

.tour__card {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  gap: var(--space-3);
  width: min(380px, calc(100vw - 20px));
  padding: var(--space-4) var(--space-5);
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--lip-lg) var(--ink);
  transition:
    transform var(--dur-enter) var(--ease-out),
    opacity var(--dur-enter) var(--ease-out);
}

.tour__head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.tour__head .avatar {
  width: 48px;
  height: 48px;
}

.tour__count {
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.tour__title {
  font-size: var(--text-xl);
  line-height: 1.15;
}

.tour__actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.tour__next {
  margin-left: auto;
  font-size: var(--text-md);
  padding: var(--space-2) var(--space-5);
}

.tour__skip {
  justify-self: center;
  min-height: var(--target);
  margin-block: calc(-1 * var(--space-2));
  padding: 0 var(--space-3);
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

/* --- The rolling door between the parts of a day ------------------------------ */

.shutter {
  position: fixed;
  inset: 0;
  z-index: 900;
  overflow: hidden;
}

/* Corrugated steel, painted the green of the board, with a lip along the bottom. */
.shutter__door {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-bottom: 14px solid var(--ink);
  background-color: var(--papan-raised);
  background-image: repeating-linear-gradient(
    180deg,
    rgb(255 255 255 / 0.1) 0 3px,
    transparent 3px 20px,
    rgb(0 0 0 / 0.22) 20px 24px
  );
  transform: translateY(-100%);
  will-change: transform;
}

/* What the door says: painted on, a little crooked. */
.shutter__sign {
  padding: var(--space-3) var(--space-7);
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--krem);
  color: var(--bata);
  box-shadow: var(--lip-lg) var(--ink);
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: rotate(-3deg);
}

.shutter__handle {
  position: absolute;
  left: 50%;
  bottom: var(--space-4);
  width: 88px;
  height: 14px;
  border: var(--border-thick) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--kunyit);
  transform: translateX(-50%);
}

/* --- The evening report, printed ---------------------------------------------- */

/* Each line of the receipt comes out in turn (--line is its place in the order). */
.nota--printing .nota__row,
.nota--printing .nota__rule {
  animation: print-line 240ms var(--ease-out) both;
  animation-delay: calc(1300ms + var(--line, 0) * 110ms);
}

@keyframes print-line {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* The face of a coin, wherever one turns up: flying to the till, lying on the counter, in the tip jar. */
.coin,
.tip__coin,
.toss__coin,
.tipjar__coin,
.legend__swatch--tip {
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe08a 0 30%, var(--kunyit) 31%);
  box-shadow: inset 0 0 0 3px rgb(184 116 0 / 0.55);
}

/* A coin on its way to the till. It is placed by its transform alone. */
.coin {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 800;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  pointer-events: none;
  will-change: transform;
}

.coin--lost {
  background: radial-gradient(circle at 35% 30%, #f2a79b 0 30%, var(--sambal) 31%);
  box-shadow: inset 0 0 0 3px rgb(143 39 21 / 0.55);
}

/* --- Tips: coins on the counter, and the jar they are counted in --------------- */

/* Laid exactly over the canvas; only the coins in it can be pressed. */
.stage__coins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/*
 * A coin on the counter. The button is a full tap target; the coin drawn in
 * it is smaller, so that it sits on the counter top without hiding the faces
 * on either side. It is put in place with left and top, which never change
 * while it lies there, and keeps its transform for arriving and being pressed.
 */
.tip {
  position: absolute;
  width: var(--target);
  height: var(--target);
  margin: calc(var(--target) / -2) 0 0 calc(var(--target) / -2);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* It lands on the counter: up from below, a little past its size, and back. */
  transition:
    transform var(--dur-enter) var(--ease-bounce),
    opacity var(--dur-fast) var(--ease-out);
}

@starting-style {
  .tip {
    opacity: 0;
    transform: translateY(10px) scale(0.6);
  }
}

/* Pressed, it gives at once; the press is what picks it up. */
.tip:active {
  transform: scale(0.88);
  transition-duration: var(--dur-press);
  transition-timing-function: var(--ease-out);
}

.tip:focus-visible {
  outline-offset: 0;
  border-radius: 50%;
}

/* Not picked up in time: it goes quicker than it came, and without the bounce. */
.tip--gone {
  opacity: 0;
  transform: translateY(5px) scale(0.85);
  transition-duration: 140ms;
  transition-timing-function: var(--ease-out);
  pointer-events: none;
}

.tip__coin {
  position: absolute;
  inset: 6px;
  display: grid;
  place-items: center;
  /* Over the inner rim shared by every coin, a lip like the one under a button. */
  box-shadow:
    inset 0 0 0 3px rgb(184 116 0 / 0.55),
    var(--lip-sm) var(--ink);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transition: transform var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .tip:hover .tip__coin {
    transform: translateY(-2px);
  }
}

/* How long it will still lie there: a ring that runs out, starting from the top. */
.tip__timer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
  pointer-events: none;
}

.tip__track,
.tip__ring {
  fill: none;
  stroke-linecap: round;
}

/* A pale band under the ring, so it can be read against whatever the scene shows behind it. */
.tip__track {
  stroke: var(--surface);
  stroke-width: 6;
}

.tip__ring {
  stroke: var(--ink);
  stroke-width: 3;
}

/* Nearly gone: red, like a patience bar at the same point. */
.tip--low .tip__ring {
  stroke: var(--sambal);
}

/* While the day is paused the coins wait with it, and look it. */
.stage__coins[data-frozen='true'] .tip {
  cursor: default;
  filter: grayscale(0.85);
  opacity: 0.8;
}

@media (max-width: 559px) {
  /* On a phone the whole warung is small: the coin is drawn smaller, and stays as easy to hit. */
  .tip__coin {
    inset: 8px;
    font-size: 11px;
    letter-spacing: -0.02em;
  }

  .tip__timer {
    transform: rotate(-90deg) scale(0.84);
  }
}

/* The coin Pak Erlangga points at while explaining: lit like the rest, and not for pressing. */
.tip--sample {
  pointer-events: none;
}

.stage__coins[data-frozen='true'] .tip--sample {
  filter: none;
  opacity: 1;
}

/* A coin thrown from the counter to the jar: the outer part crosses the screen, the inner part rises and falls. */
.toss {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 800;
  pointer-events: none;
  will-change: transform;
}

.toss__coin {
  display: block;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  will-change: transform;
}

/*
 * The tip jar: what has been picked up today. It stands at the end of the
 * clock's row, where a game keeps its score, and like the reputation in the
 * header it answers when asked: pressing it explains the coins again.
 */
.tipjar {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target);
  padding: 0 var(--space-3) 0 var(--space-2);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--lip-sm) var(--ink);
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .tipjar:hover {
    background: var(--kunyit-soft);
  }
}

.tipjar:active {
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--ink);
  transition-duration: var(--dur-press);
}

.tipjar__coin {
  flex: none;
  width: 24px;
  height: 24px;
}

/* The figure rolls up inside this when a coin lands (see roll() in motion.js). */
.tipjar__clip {
  display: inline-block;
  overflow: hidden;
}

.tipjar__label {
  font-size: var(--text-sm);
  font-weight: 800;
}

/* Wide enough for a good day's tips, so the bar beside the jar never jumps. */
.tipjar__amount {
  display: inline-block;
  min-width: 9ch;
  font-weight: 500;
  text-align: right;
}

.tipjar__hint {
  width: 1em;
  height: 1em;
  color: var(--ink-soft);
}

.legend__swatch--tip {
  width: 16px;
  height: 16px;
  border-width: 1.5px;
  box-shadow: inset 0 0 0 2px rgb(184 116 0 / 0.55);
}

@media (max-width: 559px) {
  /* The clock takes the first line; the bar of the day and the jar share the second. */
  .stage__top {
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
  }

  .stage__time {
    flex-basis: 100%;
  }
}

/* --- The day's challenge -------------------------------------------------------- */

/* One line: the goal, and what meeting it is worth. On the report it also says how it went. */
.challenge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-3);
  justify-self: center;
  max-width: 100%;
  padding: var(--space-2) var(--space-4);
  border: var(--border) dashed var(--ink);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: var(--text-sm);
  text-align: center;
}

.challenge__mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--kunyit-soft);
}

.challenge__mark .icon {
  width: 16px;
  height: 16px;
}

.challenge__prize {
  padding: 1px var(--space-2);
  border-radius: var(--radius-xs);
  background: var(--kunyit-soft);
  font-weight: 500;
  white-space: nowrap;
}

.challenge--met {
  border-style: solid;
  border-color: var(--daun-text);
  background: var(--daun-soft);
}

.challenge--met .challenge__mark {
  background: var(--daun);
  color: var(--krem);
}

.challenge--met .challenge__prize {
  background: var(--surface);
  color: var(--daun-text);
}

/* A stamp on the calendar for a challenge met: bottom corner, clear of the event and the rent pins. */
.cal__cap {
  position: absolute;
  right: 3px;
  bottom: -8px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--daun);
  color: var(--krem);
}

.cal__cap .icon {
  width: 11px;
  height: 11px;
  stroke-width: 3;
}

.piagam__caps {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--daun-text);
}

/* --- Gauges: the queue as it stands this instant -------------------------------- */

.gauges {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2) var(--space-5);
  padding: var(--space-2) var(--space-4);
  border-top: var(--border-thick) solid var(--ink);
  background: var(--paper-deep);
  font-size: var(--text-xs);
  font-weight: 700;
}

.gauge {
  display: grid;
  grid-template-columns: auto minmax(40px, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.gauge__label {
  white-space: nowrap;
}

.gauge__bar {
  height: 10px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.gauge__fill {
  display: block;
  height: 100%;
  background: var(--outcome-served);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 140ms linear;
}

/* Every pegawai serving: the next customer has to wait. */
.gauges[data-busy='full'] .gauge:first-child .gauge__fill {
  background: var(--kunyit);
}

/* Somebody is about to give up: the color of a patience bar at the same point. */
.gauges[data-patience='low'] .gauge:last-child .gauge__fill {
  background: var(--sambal);
}

/* As wide as its longest reading, so the bar beside it does not jump. */
.gauge__value {
  min-width: 9.5em;
  font-weight: 500;
  white-space: nowrap;
}

@media (max-width: 559px) {
  .gauges {
    grid-template-columns: minmax(0, 1fr);
    padding-inline: var(--space-3);
  }

  .gauge {
    grid-template-columns: 7.5em minmax(40px, 1fr) auto;
  }
}

/* --- What the customers said ---------------------------------------------------- */

.reviews__list {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 760px) {
  .reviews__list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

.review {
  display: grid;
  gap: var(--space-1);
  align-content: start;
}

.review__words {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

.review__who {
  font-size: var(--text-xs);
  color: var(--ink-soft);
}

/* --- Pak Erlangga in the corner of the scene ---------------------------------- */

.stage__host {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}

.stage__host .avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  box-shadow: var(--lip-sm) var(--ink);
  pointer-events: auto;
}

/* What he says: a small bubble that points back at him. */
.stage__say {
  position: relative;
  transform-origin: left center;
  /*
   * It can be cut short by the next remark, so it is a transition, not a
   * keyframe. It pops out of him a little past its size and settles.
   */
  transition:
    opacity var(--dur-fast) var(--ease-out),
    transform var(--dur-enter) var(--ease-bounce);
  max-width: 190px;
  padding: var(--space-1) var(--space-3);
  border: var(--border) solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.3;
}

.stage__say[data-shown='false'] {
  opacity: 0;
  transform: scale(0.9);
  /* Leaving is quicker than arriving, and does not bounce. */
  transition-duration: 110ms;
  transition-timing-function: var(--ease-out);
}

.stage__say::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -7px;
  width: 10px;
  height: 10px;
  border-left: var(--border) solid var(--ink);
  border-bottom: var(--border) solid var(--ink);
  background: var(--surface);
  transform: translateY(-50%) rotate(45deg);
}

@media (max-width: 519px) {
  .stage__host .avatar {
    width: 44px;
    height: 44px;
  }

  .stage__say {
    max-width: 150px;
    font-size: var(--text-xs);
  }
}

/* --- "Kenapa begini?": the day explained ---------------------------------------- */

/*
 * Read in a glance: the few things that cost the day most, each one name,
 * one sentence, and one thing to try. The working behind them is at the
 * bottom, for whoever wants to open it.
 */
.why {
  display: grid;
  gap: var(--space-4);
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
}

.why__head {
  display: grid;
  gap: var(--space-1);
  text-align: center;
}

.why__lead {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  text-wrap: balance;
}

.why__list {
  display: grid;
}

/* Each finding is an entry under a dashed rule, like the lines of the receipt. */
.why__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  align-items: start;
  padding-block: var(--space-4);
  border-top: 2px dashed var(--line-soft);
}

.why__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: var(--border) solid var(--ink);
  border-radius: 50%;
  background: var(--kunyit-soft);
}

.why__body {
  display: grid;
  gap: var(--space-1);
}

.why__body h3 {
  font-size: var(--text-lg);
  line-height: 1.25;
}

/* What to try: said in the green of a good day, on a line of its own. */
.why__tip strong,
.why__advice strong {
  color: var(--daun-text);
}

/* What the finding cost the day, as a price tag. */
.why__cost {
  grid-column: 2;
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  justify-self: start;
  margin-top: 2px;
  padding: 2px var(--space-3);
  border: var(--border) solid var(--sambal-text);
  border-radius: var(--radius-pill);
  background: var(--sambal-soft);
  color: var(--sambal-text);
  font-weight: 500;
  white-space: nowrap;
}

.why__cost small {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 800;
}

/* The smaller findings, folded away under the ones that matter. */
.why__more {
  margin-top: 0;
  border-top: 2px dashed var(--line-soft);
}

.why__more .why__item:first-child {
  border-top: 0;
}

.why__shop {
  justify-self: center;
}

/* The working: the same findings in the words and letters of queueing theory. */
.why__working {
  margin-top: var(--space-2);
}

.why__proofs {
  display: grid;
  gap: var(--space-5);
}

.why__proof {
  display: grid;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.why__proof h3 {
  font-size: var(--text-md);
}

/* Its name in queueing theory, after the plain words. */
.why__concept {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  color: var(--ink-soft);
}

@media (min-width: 720px) {
  /* The price stands at the end of the line, level with the name of what it is the price of. */
  .why__item {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .why__cost {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
}

@media (max-width: 519px) {
  /* Two buttons, one under the other and equally wide. */
  .view--akhir .report__next {
    flex-direction: column;
  }
}

/* --- The certificate on paper --------------------------------------------------- */

/* Printed, or saved as a PDF, the page is the certificate and nothing else. */
@media print {
  @page {
    margin: 14mm;
  }

  body {
    background: #fff;
  }

  .papan,
  .skip-link,
  .view--akhir > :not(.piagam),
  .piagam__next,
  .confetti,
  .shutter {
    display: none !important;
  }

  main,
  .view--akhir {
    padding: 0;
  }

  .view--akhir {
    animation: none;
  }

  .piagam__frame {
    max-width: none;
    box-shadow: none;
    animation: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .piagam__star--landing {
    animation: none;
  }

  /* An empty name line prints as a line to write on. */
  .piagam__name::placeholder {
    color: transparent;
  }
}

/* --- What the reputation is, explained ------------------------------------------ */

.dialog--wide {
  width: min(92vw, 560px);
}

.dialog--wide > h2 {
  margin-bottom: var(--space-3);
}

/*
 * On a small screen the explanation is longer than the window and scrolls;
 * the button that closes it stays at the bottom edge, always in reach.
 */
.dialog--wide .dialog__actions {
  position: sticky;
  bottom: calc(-1 * var(--space-5));
  margin: var(--space-4) calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
  padding: var(--space-3) var(--space-5) var(--space-5);
  border-top: 2px dashed var(--line-soft);
  background: var(--surface);
}

.rep-guide {
  display: grid;
  gap: var(--space-3);
}

.rep-guide__title {
  margin-top: var(--space-1);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 800;
}

/* One line per thing that gives or costs points, the points first. */
.rep-guide__rules {
  display: grid;
  margin-top: calc(-1 * var(--space-2));
}

.rep-guide__rule {
  display: grid;
  grid-template-columns: 3.8em minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  padding-block: var(--space-2);
}

.rep-guide__rule + .rep-guide__rule {
  border-top: 2px dashed var(--line-soft);
}

/* Plus or minus is written out; the color only repeats it. */
.rep-guide__points {
  padding: 2px var(--space-2);
  border: var(--border) solid currentColor;
  border-radius: var(--radius-pill);
  font-weight: 500;
  text-align: center;
}

.rep-guide__points--up {
  background: var(--daun-soft);
  color: var(--daun-text);
}

.rep-guide__points--down {
  background: var(--sambal-soft);
  color: var(--sambal-text);
}

.rep-guide__note {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}
