:root {
  color-scheme: light;
  --ink: #244c46;
  --muted: #6f817d;
  --paper: #fffdf7;
  --line: #ddd2b5;
  --gold: #dda64c;
  --gold-dark: #9d6c27;
  --green: #4b9d79;
  --green-dark: #2b745a;
  --purple: #7a689e;
  --red: #d96f62;
  --blue: #4e8ca3;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  overflow-x: hidden;
}

html {
  background: #f4efe1;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 7%, rgba(221, 166, 76, .19), transparent 28rem),
    radial-gradient(circle at 92% 14%, rgba(78, 140, 163, .16), transparent 30rem),
    linear-gradient(180deg, #f1f2e7, #fbf5e7 62%, #edf2e7);
}

button,
a {
  font: inherit;
}

button {
  min-height: 46px;
  color: inherit;
}

button:focus-visible,
a:focus-visible {
  border-radius: 14px;
  outline: 4px solid rgba(221, 166, 76, .5);
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
}

.app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 54px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  font-weight: 900;
  letter-spacing: .055em;
  text-decoration: none;
}

.brand > span:last-child,
.brand b,
.brand small {
  display: block;
}

.brand small {
  margin-top: 4px;
  color: #81735d;
  font: 800 10px/1.2 Georgia, serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.brand-mark {
  display: grid !important;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 2px solid #f6e7be;
  border-radius: 17px;
  color: #fff8dc;
  background: #846b46;
  box-shadow: 0 5px 0 #604b31, 0 9px 18px rgba(74, 54, 29, .12);
  font-size: 26px;
}

.sound-button,
.quiet-button,
.hint-button,
.check-button,
.primary-button,
.secondary-button,
.route-button {
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  cursor: pointer;
  font-weight: 900;
}

.sound-button {
  min-width: 166px;
  padding: 0 17px;
}

.sound-button:hover,
.quiet-button:hover,
.secondary-button:hover {
  border-color: #b9a77f;
  background: #fffaf0;
}

.hero,
.panel,
.chronicle {
  border: 3px solid var(--line);
  border-radius: 38px;
  background: rgba(255, 253, 247, .97);
  box-shadow: 0 19px 44px rgba(70, 65, 45, .11);
}

.hero {
  display: grid;
  min-height: 555px;
  padding: 52px;
  grid-template-columns: 1fr 1.08fr;
  align-items: center;
  gap: 38px;
}

.eyebrow {
  margin: 0 0 9px;
  color: #8a6435;
  font: 900 13px/1.2 Georgia, serif;
  letter-spacing: .18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -.035em;
}

.hero h1 {
  max-width: 590px;
  margin-bottom: 20px;
  font: 900 clamp(48px, 6.2vw, 78px)/.96 "Trebuchet MS", sans-serif;
}

.lead {
  max-width: 570px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.55;
}

.hero-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
}

.primary-button,
.secondary-button {
  min-height: 58px;
  padding: 0 24px;
}

.primary-button {
  border-color: var(--green);
  color: white;
  background: var(--green);
  box-shadow: 0 8px 0 var(--green-dark);
}

.primary-button:hover {
  border-color: #58a987;
  background: #58a987;
}

.primary-button:active {
  box-shadow: 0 3px 0 var(--green-dark);
}

.hero-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 24px 0 0;
  color: #796c55;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.hero-note span {
  color: var(--green-dark);
  font-size: 18px;
}

.hero-art {
  min-width: 0;
}

.history-svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 16px 15px rgba(73, 58, 31, .12));
}

.history-paper {
  fill: #f8ebce;
  stroke: #d2a55c;
  stroke-width: 5;
}

.breakfast-plate {
  fill: #fffaf0;
  stroke: #d2a55c;
  stroke-width: 6;
}

.breakfast-bowl {
  fill: #d9874d;
  stroke: #9e5732;
  stroke-width: 6;
}

.breakfast-rim {
  fill: #f7d78d;
  stroke: #9e5732;
  stroke-width: 6;
}

.breakfast-berry {
  fill: #d96f62;
  stroke: #a84d45;
  stroke-width: 4;
}

.breakfast-spoon {
  fill: #78a89d;
  stroke: #426f68;
  stroke-linejoin: round;
  stroke-width: 6;
}

.breakfast-napkin {
  fill: #fff8e7;
  stroke: #8a70a1;
  stroke-width: 5;
}

.history-line {
  fill: none;
  stroke: #8e7150;
  stroke-linecap: round;
  stroke-width: 9;
}

.history-node {
  fill: #fff7d6;
  stroke: #8e7150;
  stroke-width: 6;
}

.pyramid-shape {
  fill: #d8a95d;
  stroke: #9b6b32;
  stroke-width: 5;
}

.castle-shape {
  fill: #8875a5;
  stroke: #5b4d73;
  stroke-width: 5;
}

.factory-shape {
  fill: #5d9892;
  stroke: #356c67;
  stroke-width: 5;
}

.rocket-shape {
  fill: #e17a62;
  stroke: #a64e3d;
  stroke-width: 5;
}

.rocket-window {
  fill: #d7f0ee;
  stroke: #456f70;
  stroke-width: 4;
}

.rocket-fire {
  fill: #efb445;
}

.history-svg text {
  fill: #6e5a3e;
  font: 900 13px "Trebuchet MS", sans-serif;
  text-anchor: middle;
}

.routes {
  margin-top: 64px;
}

.section-heading,
.chronicle-head,
.pool-heading,
.board-title,
.game-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading h2,
.chronicle-head h2 {
  margin-bottom: 0;
  font-size: clamp(35px, 4.8vw, 56px);
  line-height: 1.02;
}

.section-heading > p {
  max-width: 340px;
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
  text-align: right;
}

.route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.route-card {
  position: relative;
  display: flex;
  min-height: 390px;
  padding: 28px;
  overflow: hidden;
  flex-direction: column;
  border: 3px solid var(--line);
  border-radius: 31px;
  background: var(--paper);
  box-shadow: 0 12px 0 #d8d0b7;
}

.route-card::after {
  position: absolute;
  width: 150px;
  height: 150px;
  right: -58px;
  bottom: 78px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--route) 17%, transparent);
  content: "";
}

.route-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin-bottom: 21px;
  place-items: center;
  border: 3px solid color-mix(in srgb, var(--route) 45%, white);
  border-radius: 22px;
  color: white;
  background: var(--route);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--route) 70%, black);
  font: 900 30px/1 Georgia, serif;
}

.route-card h3 {
  margin-bottom: 12px;
  font-size: 28px;
  line-height: 1.08;
}

.route-card > p:not(.eyebrow) {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.route-stats {
  display: grid;
  margin: auto 0 18px;
  gap: 5px;
  color: #776850;
  font-size: 12px;
  font-weight: 900;
}

.route-button {
  position: relative;
  z-index: 1;
  min-height: 54px;
  border-color: var(--route);
  color: var(--route);
}

.route-button:hover {
  color: white;
  background: var(--route);
}

.chronicle {
  margin-top: 68px;
  padding: 38px;
}

.chronicle-head {
  margin-bottom: 25px;
}

.chronicle-head strong {
  padding: 10px 17px;
  border-radius: 16px;
  color: white;
  background: var(--green);
  font-size: 20px;
}

.chronicle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.chronicle-card {
  display: flex;
  min-width: 0;
  min-height: 78px;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 2px dashed #d9d0ba;
  border-radius: 18px;
  color: #8a8171;
  background: #f7f5ed;
}

.chronicle-card > span {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: 13px;
  background: #e7e3d6;
  font-weight: 900;
}

.chronicle-card small,
.chronicle-card b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chronicle-card small {
  margin-bottom: 4px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.chronicle-card b {
  font-size: 13px;
}

.chronicle-card.is-open {
  border-style: solid;
  border-color: #add0b7;
  color: var(--ink);
  background: #eef7ee;
}

.chronicle-card.is-open > span {
  color: white;
  background: var(--green);
}

.panel {
  padding: 38px;
}

.game-heading {
  align-items: center;
  margin-bottom: 26px;
}

.game-heading h1 {
  margin-bottom: 7px;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1;
}

.game-heading > div:first-child > p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.progress-box {
  display: flex;
  min-width: 330px;
  align-items: center;
  gap: 14px;
}

.progress-box > div {
  height: 13px;
  flex: 1;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e0d4;
}

.progress-box i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), #7cba90);
}

.progress-box b {
  min-width: 42px;
}

.era-ruler {
  display: grid;
  min-height: 52px;
  margin-bottom: 19px;
  padding: 0 20px;
  grid-template-columns: auto 1fr auto 1fr auto;
  align-items: center;
  gap: 12px;
  border: 2px solid #e2d4b6;
  border-radius: 18px;
  color: #836638;
  background: #fff7df;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}

.era-ruler i {
  height: 3px;
  border-radius: 999px;
  background: #d7b269;
}

.era-ruler b {
  font-size: 23px;
}

.timeline-board,
.event-pool {
  border: 3px solid var(--line);
  border-radius: 28px;
}

.timeline-board {
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(137, 102, 52, .05) 1px, transparent 1px) 0 0 / 44px 44px,
    #fff9e8;
}

.board-title {
  align-items: center;
  margin-bottom: 17px;
}

.board-title h2,
.pool-heading h2 {
  margin-bottom: 0;
  font-size: 30px;
}

.board-title > span {
  padding: 8px 13px;
  border-radius: 13px;
  color: #76552a;
  background: #f1ddb1;
  font-weight: 900;
}

.timeline-slots {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.timeline-slots::before {
  position: absolute;
  z-index: 0;
  height: 5px;
  right: 5%;
  bottom: 30px;
  left: 5%;
  border-radius: 999px;
  background: #b48c4c;
  content: "";
}

.timeline-slot {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  min-height: 170px;
  padding: 16px;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  gap: 10px;
  border: 2px dashed #cdbb91;
  border-radius: 20px;
  background: rgba(255, 253, 247, .88);
  text-align: left;
}

.timeline-slot > span {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 12px;
  color: white;
  background: #8a6a3b;
  font-weight: 900;
}

.timeline-slot b {
  align-self: center;
  font-size: 15px;
  line-height: 1.3;
}

.timeline-slot small {
  color: #8c6532;
  font-weight: 900;
}

.timeline-slot.is-filled {
  border-style: solid;
  border-color: #c9ae72;
  cursor: pointer;
  box-shadow: 0 6px 0 #dfd2b5;
}

.timeline-slot.is-filled:hover {
  border-color: #9b773f;
  background: #fffdf7;
  box-shadow: 0 6px 0 #cdb88e, 0 0 0 5px rgba(221, 166, 76, .12);
}

.timeline-slot.is-hinted {
  border-color: var(--gold);
  box-shadow: 0 0 0 5px rgba(221, 166, 76, .25);
}

.event-pool {
  margin-top: 18px;
  padding: 24px;
  background: #f7f8f1;
}

.pool-heading {
  align-items: center;
  margin-bottom: 17px;
}

.pool-heading > p {
  max-width: 340px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.event-card {
  display: grid;
  min-width: 0;
  min-height: 128px;
  padding: 16px 18px;
  grid-template-columns: minmax(105px, auto) 1fr auto;
  align-items: center;
  gap: 14px;
  border: 3px solid #d9d2bf;
  border-radius: 20px;
  background: var(--paper);
  cursor: pointer;
  text-align: left;
}

.event-card small {
  padding: 9px 10px;
  border-radius: 12px;
  color: #795b31;
  background: #f3dfb2;
  font-weight: 900;
  text-align: center;
}

.event-card b {
  font-size: 15px;
  line-height: 1.32;
}

.event-card span {
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.event-card:hover:not(:disabled) {
  border-color: #94bba6;
  background: #f7fcf7;
  box-shadow: 0 0 0 5px rgba(75, 157, 121, .1);
}

.event-card.is-selected {
  opacity: .58;
  border-style: dashed;
  background: #e9eee7;
}

.event-card.is-hinted {
  opacity: 1;
  border-color: var(--gold);
  background: #fff8da;
  box-shadow: 0 0 0 5px rgba(221, 166, 76, .23);
}

.feedback-zone {
  min-height: 108px;
  margin-top: 18px;
}

.feedback-zone:not(:empty) {
  min-height: 0;
  margin-bottom: 18px;
}

.feedback {
  display: flex;
  min-height: 102px;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 3px solid #d9d2bd;
  border-radius: 23px;
  background: #fbfaf5;
}

.feedback.success {
  border-color: #9bc5aa;
  background: #edf8ef;
}

.feedback.error {
  border-color: #e3a098;
  background: #fff0ed;
}

.feedback.hint {
  border-color: #e0bf75;
  background: #fff8dc;
}

.feedback-icon {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 15px;
  color: white;
  background: var(--green);
  font-size: 25px;
  font-weight: 900;
}

.feedback.error .feedback-icon {
  background: var(--red);
}

.feedback.hint .feedback-icon {
  color: #72521e;
  background: #f1c45d;
}

.feedback > div {
  min-width: 0;
  flex: 1;
}

.feedback strong,
.feedback p,
.feedback small {
  display: block;
}

.feedback strong {
  margin-bottom: 5px;
  font-size: 18px;
}

.feedback p {
  margin-bottom: 5px;
  color: #5d706a;
  font-weight: 800;
  line-height: 1.4;
}

.feedback small {
  color: #6f765d;
  font-weight: 800;
}

.feedback .primary-button {
  flex: 0 0 auto;
}

.game-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.game-actions > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.quiet-button,
.hint-button,
.check-button {
  min-height: 52px;
  padding: 0 18px;
}

.hint-button {
  border-color: #dfbd72;
  color: #775525;
  background: #fff8df;
}

.hint-button:hover:not(:disabled) {
  background: #ffefb7;
}

.check-button {
  min-width: 194px;
  border-color: var(--green);
  color: white;
  background: var(--green);
  box-shadow: 0 6px 0 var(--green-dark);
}

.check-button:hover:not(:disabled) {
  background: #57a783;
}

.check-button:disabled,
.hint-button:disabled,
.quiet-button:disabled {
  opacity: .45;
  box-shadow: none;
}

.result {
  min-height: 670px;
  padding: 64px;
  text-align: center;
}

.result-seal {
  display: grid;
  width: 98px;
  height: 98px;
  margin: 0 auto 25px;
  place-items: center;
  border: 5px double #c48e3a;
  border-radius: 50%;
  color: #fff5d7;
  background: #9b7240;
  box-shadow: 0 11px 0 #71502c;
  font: 900 46px/1 Georgia, serif;
}

.result h1 {
  margin-bottom: 16px;
  font-size: clamp(46px, 6.5vw, 76px);
  line-height: 1;
}

.result > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.stars {
  margin: 28px 0;
  color: var(--gold);
  font-size: 55px;
  letter-spacing: .08em;
  text-shadow: 0 5px 0 #bd842c;
}

.result-stats {
  display: grid;
  max-width: 850px;
  margin: 0 auto 34px;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.result-stats > div {
  padding: 22px;
  border: 2px solid #d7d6c5;
  border-radius: 22px;
  background: #f1f6ec;
}

.result-stats strong,
.result-stats span {
  display: block;
}

.result-stats strong {
  margin-bottom: 5px;
  font-size: 35px;
}

.result-stats span {
  color: var(--muted);
  font-weight: 900;
}

.result-actions {
  justify-content: center;
}

@media (max-width: 900px) {
  .hero {
    padding: 38px;
    grid-template-columns: 1fr;
  }

  .hero-copy {
    max-width: 700px;
  }

  .hero-art {
    max-width: 650px;
    margin: 0 auto;
  }

  .route-grid {
    grid-template-columns: 1fr;
  }

  .route-card {
    min-height: 300px;
  }

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

  .game-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .progress-box {
    width: 100%;
    min-width: 0;
  }

  .timeline-slots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline-slots::before {
    display: none;
  }

  .event-card {
    grid-template-columns: 115px 1fr;
  }

  .event-card span {
    grid-column: 2;
  }

  .feedback.success {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .feedback.success .primary-button {
    width: 100%;
  }
}

@media (max-width: 700px) {
  .app {
    width: min(1120px, calc(100% - 20px));
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .brand b {
    font-size: 13px;
  }

  .brand small {
    display: none;
  }

  .sound-button {
    width: 48px;
    min-width: 48px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    font-size: 0;
  }

  .sound-button::first-letter {
    color: var(--ink);
    font-size: 19px;
  }

  .hero,
  .panel,
  .chronicle {
    border-radius: 27px;
  }

  .hero,
  .panel {
    padding: 24px;
  }

  .hero h1 {
    font-size: 46px;
  }

  .lead {
    font-size: 16px;
  }

  .section-heading,
  .chronicle-head,
  .pool-heading,
  .board-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .section-heading > p,
  .pool-heading > p {
    max-width: none;
    text-align: left;
  }

  .route-card {
    padding: 23px;
  }

  .chronicle {
    padding: 24px;
  }

  .chronicle-grid {
    grid-template-columns: 1fr;
  }

  .era-ruler {
    padding: 0 12px;
    gap: 7px;
    font-size: 9px;
  }

  .timeline-board,
  .event-pool {
    padding: 17px;
    border-radius: 22px;
  }

  .event-grid {
    grid-template-columns: 1fr;
  }

  .event-card {
    min-height: 112px;
  }

  .game-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .game-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .game-actions .check-button {
    grid-column: 1 / -1;
  }

  .result {
    min-height: 620px;
    padding: 36px 24px;
  }

  .result-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .hero {
    min-height: 0;
  }

  .hero h1 {
    font-size: 40px;
  }

  .hero-actions,
  .hero-actions button,
  .result-actions,
  .result-actions button {
    width: 100%;
  }

  .routes {
    margin-top: 48px;
  }

  .section-heading h2,
  .chronicle-head h2 {
    font-size: 38px;
  }

  .timeline-slots {
    grid-template-columns: 1fr;
  }

  .timeline-slot {
    min-height: 135px;
  }

  .event-card {
    padding: 14px;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .event-card small {
    justify-self: start;
  }

  .event-card span {
    grid-column: auto;
  }

  .feedback {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .feedback-icon {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .game-actions > div {
    grid-template-columns: 1fr;
  }

  .game-actions .check-button {
    grid-column: auto;
  }

  .stars {
    font-size: 43px;
  }
}

/* Первая бюджетная мастерская */
.budget-svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 16px 15px rgba(73, 58, 31, .12));
}

.budget-paper {
  fill: #f5e8c9;
  stroke: #c9a45f;
  stroke-width: 5;
}

.pig-body,
.pig-ear {
  fill: #eaa28b;
  stroke: #a95e52;
  stroke-width: 7;
}

.pig-eye,
.pig-nostril {
  fill: #31564f;
}

.pig-snout {
  fill: #f3b6a2;
  stroke: #a95e52;
  stroke-width: 5;
}

.pig-leg,
.pig-tail,
.coin-slot {
  fill: none;
  stroke: #a95e52;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 8;
}

.budget-coin {
  fill: #f4c95e;
  stroke: #ba7c28;
  stroke-width: 6;
}

.coin-sign {
  fill: #7d5721;
  font: 900 30px "Trebuchet MS", sans-serif;
  text-anchor: middle;
}

.mini-envelope {
  fill: #fff9e9;
  stroke: #8170a1;
  stroke-width: 5;
}

.env-b {
  stroke: #3f8d7d;
}

.envelope-fold {
  fill: none;
  stroke: #9c8357;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.budget-game-panel {
  padding-bottom: 34px;
}

.budget-brief {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
  margin-top: 28px;
  padding: 24px 26px;
  border: 2px solid #dfbf78;
  border-radius: 24px;
  background: #fff7d8;
}

.budget-brief .brief-icon {
  display: grid;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: #fffdf7;
  font-size: 28px;
  place-items: center;
}

.budget-brief .eyebrow {
  margin-bottom: 5px;
}

.budget-brief h2 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(22px, 3vw, 31px);
  line-height: 1.3;
}

.wallet {
  display: grid;
  grid-template-columns: minmax(210px, .7fr) 1.3fr;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
  padding: 20px 24px;
  border: 2px solid var(--line);
  border-radius: 24px;
  background: #fffdf8;
}

.wallet > div:first-child {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 4px 12px;
}

.wallet .eyebrow {
  grid-column: 1 / -1;
  margin: 0;
}

.wallet strong {
  font-size: 32px;
}

.wallet span {
  color: var(--muted);
  font-weight: 800;
}

.wallet-coins {
  display: grid;
  grid-template-columns: repeat(10, minmax(42px, 1fr));
  gap: 7px;
}

.wallet-coins i {
  display: grid;
  aspect-ratio: 1;
  border: 3px solid #b87827;
  border-radius: 50%;
  color: #74501f;
  background: #f4c95e;
  box-shadow: inset 0 0 0 3px #ffe9a3, 0 4px 0 #c9963d;
  font-style: normal;
  font-size: 13px;
  font-weight: 900;
  place-items: center;
  transition: opacity .18s ease, filter .18s ease;
}

.wallet-coins i.is-used {
  opacity: .19;
  filter: grayscale(1);
}

.budget-workspace {
  margin-top: 18px;
  padding: 24px;
  border: 2px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 253, 247, .8);
}

.envelope-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.budget-envelope {
  min-width: 0;
  padding: 20px;
  border: 3px solid #ded8c7;
  border-radius: 25px;
  background: #fffefa;
  box-shadow: 0 8px 0 rgba(93, 76, 44, .12);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.budget-envelope[data-kind="spend"] {
  --envelope-accent: #d8874b;
}

.budget-envelope[data-kind="save"] {
  --envelope-accent: #8170a1;
}

.budget-envelope[data-kind="gift"] {
  --envelope-accent: #3f8d7d;
}

.budget-envelope.is-hinted {
  border-color: var(--gold);
  background: #fff8dc;
  box-shadow: 0 0 0 5px rgba(221, 166, 76, .18), 0 8px 0 rgba(93, 76, 44, .12);
}

.envelope-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.envelope-heading > span {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 15px;
  background: color-mix(in srgb, var(--envelope-accent) 16%, white);
  font-size: 24px;
  place-items: center;
}

.envelope-heading small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.envelope-heading h3 {
  margin: 2px 0 0;
  font-size: 23px;
}

.budget-envelope > strong {
  display: block;
  margin-top: 20px;
  color: var(--envelope-accent);
  font-size: 35px;
}

.coin-dots {
  display: grid;
  grid-template-columns: repeat(5, 14px);
  gap: 6px;
  min-height: 36px;
  margin: 13px 0 15px;
}

.coin-dots i {
  width: 14px;
  height: 14px;
  border: 2px solid #d7d1c3;
  border-radius: 50%;
  background: #f3f0e8;
}

.coin-dots i.is-filled {
  border-color: var(--envelope-accent);
  background: var(--envelope-accent);
}

.stepper {
  display: grid;
  grid-template-columns: 50px 1fr 50px;
  align-items: center;
  gap: 8px;
}

.stepper button {
  min-width: 50px;
  min-height: 50px;
  border: 2px solid var(--envelope-accent);
  border-radius: 15px;
  color: var(--envelope-accent);
  background: #fff;
  cursor: pointer;
  font-size: 29px;
  font-weight: 900;
  transition: color .18s ease, background .18s ease;
}

.stepper button:hover:not(:disabled) {
  color: #fff;
  background: var(--envelope-accent);
}

.stepper button:active:not(:disabled) {
  background: color-mix(in srgb, var(--envelope-accent) 84%, black);
}

.stepper button:disabled {
  border-color: #dedbd1;
  color: #b9b6ad;
  background: #f2f0e9;
}

.stepper span {
  min-width: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

@media (max-width: 820px) {
  .wallet {
    grid-template-columns: 1fr;
  }

  .envelope-grid {
    grid-template-columns: 1fr;
  }

  .budget-envelope {
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto;
    align-items: center;
    gap: 8px 18px;
  }

  .budget-envelope > strong {
    margin-top: 0;
    text-align: right;
  }

  .coin-dots {
    margin: 8px 0 0;
  }

  .stepper {
    min-width: 250px;
  }
}

@media (max-width: 520px) {
  .budget-brief {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  .budget-brief .brief-icon {
    width: 48px;
    height: 48px;
  }

  .wallet {
    padding: 18px;
  }

  .wallet-coins {
    grid-template-columns: repeat(5, 1fr);
  }

  .budget-workspace {
    padding: 17px;
  }

  .budget-envelope {
    display: block;
    padding: 17px;
  }

  .budget-envelope > strong {
    margin-top: 14px;
    text-align: left;
  }

  .coin-dots {
    margin: 10px 0 14px;
  }

  .stepper {
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
