.game {
  position: relative;
  width: 100%;
  min-width: 0;
}

.game-info {
  background-color: #d2bb82;
  color: #fff;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 500;
  text-shadow: 1px 1px #8a7a58;
  border-radius: 2px;
  text-transform: uppercase;
  box-shadow: 1px 2px 6px 0 rgba(0, 0, 0, 0.14);
  padding: 2px 5px;
  text-align: center;
  margin-bottom: 60px;
}

.game-carpet {
  position: relative;
  background: url("../img/carpet.png");
  background-color: #140f01;
  border: 1px solid #0a0801;
  padding: 10px;
  padding-bottom: 62px;
  border-radius: 7px;
}
.game-carpet.open {
  min-height: 650px;
  height: auto;
}
.game-carpet.is-computing {
  min-height: auto;
  padding-bottom: 20px;
}

.card-list.is-hidden {
  display: none;
}

.game-result {
  display: none;
  margin-top: 80px;
  justify-content: center;
  gap: 7%;
  flex-wrap: wrap;
}
.game-result.show {
  display: flex;
}

.step-compute {
  display: none;
  margin-top: 20px;
}
.step-compute.show {
  display: block;
  animation: game-step-in 0.24s ease;
}

.step-compute-header {
  background: linear-gradient(180deg, rgba(249, 242, 229, 0.84) 0%, rgba(244, 236, 222, 0.75) 100%);
  border: 1px solid rgba(188, 168, 133, 0.72);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 3px 8px 0 rgb(0 0 0 / 8%);
}

.step-compute-title {
  color: #4f4438;
  margin: 0 0 8px;
  font-size: 24px;
}

.step-compute-text {
  margin: 0;
  color: #5f554a;
  font-size: 16px;
}

.compute-panel {
  background: linear-gradient(180deg, rgba(250, 243, 229, 0.74) 0%, rgba(244, 235, 220, 0.66) 100%);
  border: 1px solid rgba(190, 170, 136, 0.64);
  border-radius: 10px;
  padding: 14px;
}

.compute-stage {
  margin: 0 0 12px;
  color: #4f4438;
  font-weight: 500;
}

.compute-progress {
  height: 8px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background-color: #d8cfbc;
  border: 1px solid #c9bea7;
}

.compute-progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7c6644 0%, #b08f5a 100%);
  transition: width 0.22s linear;
}

.compute-log {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}

.compute-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(188, 168, 133, 0.28);
  border-radius: 8px;
  background-color: rgba(255, 251, 243, 0.76);
  color: #5a5045;
  padding: 8px 10px;
  font-size: 14px;
}

.compute-log-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid #b8a173;
  color: #5a4d3f;
  font-weight: 600;
  background-color: #efe3cb;
  flex-shrink: 0;
}

.actions-start {
  display: flex;
  gap: 6px;
  margin: 40px 20px 90px 20px;
  justify-content: center;
}
.actions-start .game-btn {
  border-color: #d2bb82;
}
.actions-start.hide {
  display: none;
}

.actions-end {
  position: absolute;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: linear-gradient(180deg, rgba(92, 74, 46, 0.82) 0%, rgba(80, 64, 40, 0.9) 100%);
  bottom: 0;
  border-radius: 0 0 7px 7px;
  padding: 10px;
}
.actions-end .game-btn {
  border-color: rgba(126, 103, 66, 0.78);
}
.actions-end.hide {
  display: none;
}
.actions-end.is-empty {
  display: none;
}

@keyframes game-step-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media screen and (max-width: 1200px) {
  .game-info .only-desktop {
    display: none;
  }
}
@media screen and (max-width: 900px) {
  .actions-start {
    margin: 40px 20px 40px 20px;
  }
  .game-carpet.open {
    min-height: 590px;
  }
}
@media screen and (max-width: 900px) {
  .flip-card {
    width: 110px;
  }
}
@media screen and (max-width: 600px) {
  .actions-start {
    margin: 20px;
    justify-content: center;
    flex-wrap: nowrap;
  }
  .actions-end {
    flex-wrap: wrap;
    justify-content: center;
  }
  .actions-start .game-btn {
    width: auto;
    max-width: none;
    padding: 7px 16px;
    font-size: 14px;
  }
  .actions-end .game-btn {
    width: 100%;
    max-width: 280px;
  }
  .game-info { margin-bottom: 40px; }
  .game-result {
    margin-top: 40px;
    gap: 15px;
  }
  .flip-card {
    width: 82px;
  }
  .step-compute-title {
    font-size: 21px;
  }
}
@media screen and (max-width: 480px) {
  .game-result {
    gap: 10px;
  }
  .flip-card {
    width: 74px;
  }
}
.ending {
  display: none;
}
.ending.show {
  display: block;
}

.result-block {
  box-shadow: 1px 1px 4px 0 rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  padding: 20px;
  margin-top: 10px;
  background-color: #fff;
}
.result-block-title {
  margin: 0 0 10px;
  color: #d2bb82;
  font-size: 21px;
}
.result-summary-text {
  margin: 0;
  font-size: 16px;
  color: #5b524d;
}
.result-actions-list {
  margin: 0;
  padding-left: 20px;
  color: #5b524d;
}
.result-actions-list li + li {
  margin-top: 8px;
}

.ending-inter {
  box-shadow: 1px 1px 4px 0 rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  padding: 30px;
  margin-top: 10px;
}
.ending-inter .card-img {
  flex: 1;
}
.ending-inter .card-img img {
  width: 100%;
  border-radius: 4px;
  margin-top: 20px;
  box-shadow: unset;
  border: 1px solid #f1f1f1;
}
.ending-inter .card-content {
  flex: 5;
}
.ending-inter:first-of-type {
  border-top: unset;
  border-radius: 14px 14px 0 0;
}
.ending-inter:last-of-type {
  border-radius: 0 0 14px 14px;
}
.ending-inter .card-content-title {
  font-size: 18px;
  font-weight: 400;
  color: #514844;
}
.ending-inter .card-content-text {
  font-size: 16px;
  font-weight: 300;
  color: #605651;
}
.ending-inter .card-content-text span {
  font-weight: 400;
  color: #514844;
}
.ending-inter .card-content-more {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
}
.ending-inter .card-content-more a {
  color: var(--pink-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ending-inter .card-content-more a:hover,
.ending-inter .card-content-more a:focus-visible {
  color: var(--lightpink-color);
}
.ending-inter .card-content-text strong {
  font-weight: 500;
}
.ending-inter .ending-inter-header {
  padding: 7px 20px;
  background-color: #f1f1f1;
  border-radius: 8px 8px 2px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ending-inter .ending-inter-header .card-header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 400;
}
.ending-inter .ending-inter-header span {
  font-weight: 600;
  display: block;
  height: 20px;
  width: 20px;
  color: #fff;
  background-color: #ccc;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  font-size: 12px;
  border: 1px solid #c7c7c7;
}
.ending-inter .ending-inter-body {
  display: flex;
  gap: 30px;
}
.ending-inter .ending-inter-body .card-content-title {
  color: #d2bb82;
  margin-top: 30px;
  font-weight: 600;
}
.ending-inter .ending-inter-body .card-content-title span {
  text-decoration: underline;
}

.ending-after {
  margin-top: 30px;
}
.ending-after .game-btn {
  text-align: center;
  display: inline-block;
}
.ending-cta {
  background: linear-gradient(135deg, #fdf6ec 0%, #f8eed8 100%);
  border: 1px solid #d2bb82;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
  text-align: center;
}
.ending-cta-title {
  font-size: 19px;
  font-weight: 600;
  color: #8a6d3b;
  margin: 0 0 8px;
}
.ending-cta-text {
  font-size: 15px;
  color: #6b5a3a;
  margin: 0 0 16px;
}
.ending-cta .game-btn-gold {
  display: inline-block;
  font-size: 15px;
  padding: 10px 32px;
  line-height: 1.4;
}
.ending-cta-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ending-cta-retry {
  display: inline;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: inherit;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
  font-size: 13px;
  color: #8a6d3b;
  text-decoration: underline;
  cursor: pointer;
}
.ending-cta-retry:hover {
  color: #6b5a3a;
}

@media screen and (max-width: 800px) {
  .ending-inter {
    padding: 10px;
  }
  .ending-inter .ending-inter-body {
    gap: 10px;
  }
  .ending-inter .ending-inter-body .card-content-title {
    margin-top: 20px;
  }
}
@media screen and (max-width: 600px) {
  .ending-inter .ending-inter-body {
    display: block;
  }
}
.card-show {
  transition-property: opacity;
  animation: card-show 0.3s forwards;
}

@keyframes card-show {
  75% {
    opacity: 0.1;
  }
  to {
    opacity: 1;
  }
}
.desc-card-list {
  max-width: 1000px;
  margin: 0 auto;
}

.desc-card {
  margin: 12px 20px;
  padding-top: 12px;
  border-top: 1px solid #f1f1f1;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.desc-card:first-of-type {
  border-top: unset;
}
.ending-inter .card-img,
.desc-card .card-img {
  width: 100%;
  max-width: 102px;
}
.desc-card .card-img img {
  margin-bottom: 0;
  box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  max-width: 102px;
  width: 100%;
  height: auto;
}
.desc-card .card-content-title {
  font-size: 18px;
  font-weight: 500;
  color: #4f4541;
  margin-bottom: 6px;
  line-height: 1.3;
}
.desc-card .card-content {
  display: flex;
  flex-direction: column;
}
.desc-card .card-content-text {
  font-size: 15px;
  font-weight: 400;
  color: #5f5551;
  margin-bottom: 8px;
  line-height: 1.45;
}
.desc-card .card-content-text span:first-of-type {
  font-size: 14px;
  font-weight: 500;
  color: #4f4541;
  text-transform: uppercase;
}
.desc-card .card-content-text strong {
  font-weight: 300;
}
.desc-card .card-content-text a {
  font-weight: 400;
  color: var(--pink-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.desc-card .card-content-text a:hover {
  color: var(--lightpink-color);
}
.desc-card .card-content-more {
  order: 10;
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
}
.desc-card .card-content-more a {
  color: var(--pink-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.desc-card .card-content-more a:hover,
.desc-card .card-content-more a:focus-visible {
  color: var(--lightpink-color);
}

@media screen and (max-width: 640px) {
  .desc-card-list {
    margin: 12px auto;
  }

  .desc-card {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    align-items: start;
    margin: 16px;
    padding-top: 14px;
    gap: 14px;
  }

  .desc-card .card-img {
    max-width: 90px;
  }

  .desc-card .card-img img {
    max-width: 90px;
    margin-bottom: 0;
  }

  .desc-card .card-content-title {
    margin-bottom: 6px;
    line-height: 1.3;
  }

  .desc-card .card-content-text {
    margin-bottom: 8px;
    line-height: 1.45;
  }
}
.game-btn {
  font-weight: 600;
  padding: 7px 30px;
  border-radius: 4px;
  font-size: 16px;
  background-color: #fff;
  border: 3px solid transparent;
  color: #262626;
  box-shadow: 2px 2px 4px 0 rgba(0, 0, 0, 0.2);
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s ease-in-out;
}
.game-btn-gold {
  background-color: rgba(255, 255, 255, 0.92);
  border-color: #b99547;
  color: #8a6d3b;
  text-shadow: none;
}
.game-btn.right-arrow::after {
  display: inline-block;
  content: ">>";
  margin-left: 7px;
  font-size: 14px;
  font-weight: 300;
  color: #000;
}
.game-btn-gold.right-arrow::after {
  color: #8a6d3b;
}
.game-btn:hover {
  background-color: #f1f1f1;
}
.game-btn.disabled,
.game-btn:disabled {
  background-color: #ece8e2;
  border-color: #d7cec2;
  color: #8b8278;
  box-shadow: none;
  cursor: not-allowed;
}
.game-btn.game-btn-gold:hover {
  background-color: rgba(255, 255, 255, 0.98);
  border-color: #ad8a3f;
  color: #7a6032;
}
.game-btn.game-btn-gold.disabled,
.game-btn.game-btn-gold:disabled {
  background-color: rgba(255, 255, 255, 0.72);
  border-color: rgba(173, 138, 63, 0.42);
  color: #ab9573;
  text-shadow: none;
}

.game-btn.game-btn-gold.disabled.right-arrow::after,
.game-btn.game-btn-gold:disabled.right-arrow::after {
  color: #ab9573;
}
.game-btn.hide {
  display: none;
}
.game-btn.left {
  border-radius: 10px 0 0 10px;
}
.game-btn.right {
  border-radius: 0 10px 10px 0;
}

.card-list {
  list-style: none;
  padding: 0;
  display: flex;
  justify-content: center;
  margin-left: 50px;
}

.game-card {
  margin-left: -50px;
  width: 95px;
  z-index: 50;
  transition: margin 0.2s ease-in-out;
}
.game-card img {
  box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, 0.1);
  width: 100%;
  height: auto;
  border-radius: 7px;
}
.game-card.selected {
  box-shadow: unset;
}
.game-card.hide {
  z-index: -1;
  opacity: 0;
  visibility: hidden;
}
.game-card.active {
  cursor: pointer;
}
.game-card.active:not(.selected):hover {
  margin-top: -20px;
}

.flip-card {
  width: 130px;
  aspect-ratio: 130 / 243;
  perspective: 1000px;
  transform: rotateX(360deg);
}
.flip-card img {
  width: 100%;
}
.flip-card.reverse {
  transform: rotateX(360deg);
}
.flip-card.reverse .flip-card-front img {
  transform: rotate(180deg);
}
.flip-card.is-clickable {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.flip-card.is-clickable:hover {
  transform: translateY(-6px) rotateX(360deg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}
.flip-card.flipped {
  cursor: default;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-back, .flip-card-front {
  position: absolute;
  backface-visibility: hidden;
  width: 100%;
  height: 100%;
}

.flip-card-front {
  transform: rotateY(180deg);
}
