.game {
  position: relative;
}

.game-info {
  background-color: #d2bb82;
  color: #fff;
  text-shadow: 1px 1px #8a7a58;
  font-size: 16px;
  line-height: 1.35;
  font-weight: 500;
  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: 20px;
}

.game-shell {
  position: relative;
  background: url("../img/carpet.png");
  background-color: #efe7d4;
  border: 1px solid #ece3cd;
  border-radius: 8px;
  padding: 20px;
  min-height: 520px;
  overflow: hidden;
}

.game-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(247, 242, 231, 0.22) 0%, rgba(247, 242, 231, 0.14) 100%);
  pointer-events: none;
}

.game-shell > * {
  position: relative;
  z-index: 1;
}

.game-step {
  display: none;
}

.game-step.is-active {
  display: block;
  animation: game-step-in 0.22s ease;
}

#step-ritual-1.is-active,
#step-ritual-2.is-active,
#step-compute.is-active {
  min-height: 460px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

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

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

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

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

.intro-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;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  backdrop-filter: blur(1.5px);
}

.ritual-entry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

.intro-rune-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(58px, 1fr));
  gap: 10px;
}

.intro-rune {
  min-height: 62px;
  border: 1px solid rgba(188, 171, 141, 0.78);
  border-radius: 14px;
  box-shadow: 1px 1px 2px 0 rgb(0 0 0 / 10%);
  background-color: rgba(255, 252, 246, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro-rune img {
  width: 50px;
  height: 50px;
}

.ritual-focus-panel {
  min-height: 100%;
}

.ritual-panel,
.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;
  min-height: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  backdrop-filter: blur(1.5px);
}

.ritual-panel .ritual-bag-wrap {
  display: flex;
  justify-content: center;
}

.ritual-mix-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.ritual-status-inline {
  margin: 0;
  min-width: 0;
  width: 100%;
  text-align: left;
  line-height: 1.35;
}

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

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

.ritual-status {
  margin: 10px 0 14px;
  color: #4f4438;
  font-weight: 500;
}

.ritual-bag-wrap {
  margin: 0;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.ritual-mix-row .ritual-bag-wrap {
  margin: 0;
}

.ritual-mix-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 280px;
  max-width: 320px;
}

.ritual-mix-controls .game-btn {
  width: 100%;
}

.bag-btn {
  position: relative;
  border-radius: 12px;
  border: 1px solid #d7cfbe;
  background-color: #ffffffbf;
  padding: 8px;
  cursor: pointer;
}

.bag-btn.is-prompting {
  animation: bag-prompt 1.3s ease-in-out infinite;
}

.bag-btn img {
  max-width: 100%;
  height: auto;
}

.bag-shake {
  animation: bag-shake 0.92s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
}

@keyframes bag-shake {
  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }
  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

@keyframes bag-prompt {
  0%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow: 0 0 0 0 rgba(167, 133, 66, 0);
  }
  50% {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 0 7px rgba(167, 133, 66, 0.16);
  }
}

.draw-spread {
  margin: 0 0 18px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
}

.spread-slot {
  background-color: rgba(247, 240, 226, 0.62);
  border-radius: 8px;
  border: 1px solid rgba(192, 174, 144, 0.68);
  overflow: hidden;
  backdrop-filter: blur(1.2px);
}

.spread-slot-title {
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
  text-transform: uppercase;
  background-color: rgba(241, 232, 215, 0.72);
  border-bottom: 1px solid rgba(198, 180, 149, 0.62);
  color: #4f4438;
}

.spread-slot-body {
  min-height: 130px;
  display: flex;
  padding: 8px;
  align-items: center;
  justify-content: center;
}

.spread-slot-placeholder {
  color: #8a7f69;
  font-size: 13px;
}

.spread-rune {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.spread-rune img {
  width: 58px;
  height: 58px;
}

.spread-rune figcaption {
  text-align: center;
  font-size: 12px;
  color: #4f4438;
  line-height: 1.2;
}

.spread-rune.is-reversed img {
  transform: rotate(180deg);
}

.game-rune-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  column-gap: 12px;
  row-gap: 12px;
}

.game-rune-list .game-rune {
  min-height: 64px;
  border: 1px solid rgba(186, 168, 137, 0.76);
  border-radius: 14px;
  box-shadow: 1px 1px 2px 0 rgb(0 0 0 / 10%);
  background-color: rgba(255, 252, 246, 0.72);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.game-rune-list .game-rune img {
  width: 100%;
  max-width: 50px;
  height: auto;
}

.game-rune-list .game-rune:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 2px 6px 8px 0 rgb(0 0 0 / 16%);
}

.game-rune-list .game-rune.is-picking {
  pointer-events: none;
}

.game-rune-list .game-rune.is-picked {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.draw-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  background: linear-gradient(180deg, rgba(248, 240, 226, 0.74) 0%, rgba(241, 232, 215, 0.64) 100%);
  border: 1px solid rgba(189, 170, 136, 0.68);
  border-radius: 10px;
  padding: 10px 12px;
  backdrop-filter: blur(1.5px);
}

.compute-loader {
  position: relative;
  width: 150px;
  height: 74px;
  margin: 0 auto 8px;
}

.compute-loader-embers {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 88px;
  height: 22px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: radial-gradient(circle at center, rgba(214, 165, 75, 0.52) 0%, rgba(140, 101, 45, 0.24) 56%, rgba(110, 79, 33, 0) 100%);
  animation: embers-pulse 2.1s ease-in-out infinite;
}

.compute-smoke {
  position: absolute;
  bottom: 16px;
  left: 50%;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.7) 0%, rgba(222, 214, 196, 0.42) 60%, rgba(222, 214, 196, 0) 100%);
  filter: blur(0.5px);
  opacity: 0;
}

.compute-smoke-1 {
  width: 26px;
  height: 18px;
  margin-left: -40px;
  animation: compute-smoke-rise 2.8s ease-in-out infinite;
}

.compute-smoke-2 {
  width: 30px;
  height: 20px;
  margin-left: -6px;
  animation: compute-smoke-rise 2.8s ease-in-out infinite 0.48s;
}

.compute-smoke-3 {
  width: 24px;
  height: 16px;
  margin-left: 24px;
  animation: compute-smoke-rise 2.8s ease-in-out infinite 0.96s;
}

.compute-stage {
  margin: 0 0 10px;
  text-align: center;
  font-size: 15px;
  color: #3f3729;
  min-height: 22px;
}

.compute-panel.is-running .compute-progress-bar {
  background: linear-gradient(90deg, #705939 0%, #b08b55 45%, #7b6340 100%);
  background-size: 200% 100%;
  animation: compute-progress-shimmer 1.1s linear infinite;
}

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

.compute-log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: rgba(251, 246, 236, 0.66);
  border: 1px solid rgba(197, 180, 151, 0.64);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  color: #5b524d;
}

.compute-log-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: #8c7654;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

@keyframes compute-smoke-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.8);
  }
  18% {
    opacity: 0.62;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -44px) scale(1.24);
  }
}

@keyframes embers-pulse {
  0%,
  100% {
    opacity: 0.72;
    transform: translateX(-50%) scale(0.95);
  }
  50% {
    opacity: 0.96;
    transform: translateX(-50%) scale(1.06);
  }
}

@keyframes compute-progress-shimmer {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 200% 0;
  }
}

.result-block {
  border: 1px solid rgba(193, 174, 141, 0.68);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(250, 244, 232, 0.74) 0%, rgba(244, 235, 220, 0.66) 100%);
  padding: 14px;
  margin-top: 14px;
  backdrop-filter: blur(1.4px);
}

.result-block-title {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 20px;
  color: #4f4438;
}

.result-summary-text {
  margin-bottom: 0;
  font-size: 16px;
  color: #5b524d;
}

.result-actions-list {
  margin: 0;
  padding-left: 22px;
}

.result-actions-list li {
  margin-bottom: 8px;
  color: #5b524d;
}

.ending-inter {
  box-shadow: 1px 1px 4px 0 rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 14px;
  margin-top: 12px;
  border: 1px solid #e4dccb;
}

.ending-inter .ending-inter-header {
  padding: 7px 10px;
  background-color: #f5f0e4;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ending-inter .ending-inter-header .rune-header-title {
  margin: 0;
  font-size: 18px;
  color: #4f4438;
}

.ending-inter .ending-inter-header span {
  font-weight: 600;
  display: block;
  height: 22px;
  width: 22px;
  color: #fff;
  background-color: #8f7c5c;
  border-radius: 50%;
  text-align: center;
  line-height: 22px;
  font-size: 12px;
}

.ending-inter .ending-inter-body {
  display: flex;
  gap: 14px;
  margin-top: 10px;
}

.ending-inter .rune-img {
  flex: 0 0 90px;
  min-height: 90px;
  display: flex;
  border-radius: 12px;
  border: 1px solid #d7cfbe;
  background-color: #fff;
}

.ending-inter .rune-img img {
  width: 62px;
  height: 62px;
  margin: auto;
}

.ending-inter .rune-img.is-reversed img {
  transform: rotate(180deg);
}

.ending-inter .rune-content {
  flex: 1;
}

.ending-inter .rune-content-title {
  color: #4f4438;
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 600;
}

.ending-inter .rune-content-title span {
  text-decoration: underline;
}

.ending-inter .rune-content-text {
  font-size: 15px;
  font-weight: 300;
  color: #5f5550;
  margin-bottom: 8px;
}

.ending-inter .rune-content-text span {
  font-weight: 600;
  color: #4f4438;
}
.ending-inter .rune-content-more {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.4;
}
.ending-inter .rune-content-more a {
  color: var(--pink-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ending-inter .rune-content-more a:hover,
.ending-inter .rune-content-more a:focus-visible {
  color: var(--lightpink-color);
}

.ending-after {
  margin-top: 18px;
}

.ending-after .game-btn {
  display: inline-block;
  text-align: center;
}

.ending-cta {
  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: 24px;
  margin-bottom: 16px;
  text-align: center;
}
.ending-cta-title {
  font-size: 19px;
  font-weight: 600;
  color: #4f4438;
  margin: 0 0 8px;
}
.ending-cta-text {
  font-size: 15px;
  color: #3f3729;
  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: #3f3729;
  text-decoration: underline;
  cursor: pointer;
}
.ending-cta-retry:hover {
  color: #4f4438;
}

.game-btn {
  font-weight: 600;
  padding: 6px 24px;
  border-radius: 4px;
  font-size: 15px;
  background-color: #fff;
  border: 1px solid rgba(175, 154, 115, 0.45);
  color: #544a45;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
  cursor: pointer;
  text-decoration: none;
  transition: 0.2s ease-in-out;
}

.game-btn-gold {
  background: linear-gradient(180deg, #e0d1af 0%, #cdb280 100%);
  border-color: #c0a06b;
  color: #fff;
  text-shadow: none;
}

.game-btn.right-arrow::after {
  display: inline-block;
  content: ">>";
  margin-left: 7px;
  font-size: 14px;
  font-weight: 300;
  color: #6f6257;
}

.game-btn-gold.right-arrow::after {
  color: #fff;
}

.game-btn:hover {
  background-color: #f7f4ef;
}

.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: linear-gradient(180deg, #e7d9ba 0%, #d6bc8b 100%);
  border-color: #c7a974;
  color: #fff;
}

.game-btn.game-btn-gold.disabled,
.game-btn.game-btn-gold:disabled {
  background: #e3dacb;
  border-color: #d1c4a9;
  color: #8f8166;
}

.game-btn.game-btn-gold.disabled.right-arrow::after,
.game-btn.game-btn-gold:disabled.right-arrow::after {
  color: #9a8e78;
}

.game-btn.hide {
  display: none;
}

.game-btn.left {
  border-radius: 10px 0 0 10px;
}

.game-btn.right {
  border-radius: 0 10px 10px 0;
}

.game-btn:focus-visible,
.bag-btn:focus-visible,
.game-rune:focus-visible {
  outline: 2px solid #6b5841;
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

@media screen and (max-width: 1200px) {
  .game-info .only-desktop {
    display: none;
  }
}

@media screen and (max-width: 980px) {
  .draw-spread {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .ritual-entry-layout {
    grid-template-columns: 1fr;
  }

  .ritual-mix-controls {
    min-width: 0;
    max-width: 100%;
  }
}

@media screen and (max-width: 680px) {
  .game-shell {
    padding: 12px;
    min-height: 420px;
  }

  #step-ritual-1.is-active,
  #step-ritual-2.is-active,
  #step-compute.is-active {
    min-height: 360px;
  }

  .ritual-panel,
  .compute-panel {
    min-height: 170px;
  }

  .draw-spread {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .draw-actions,
  .ritual-panel,
  .compute-panel,
  .intro-panel,
  .game-step-header {
    padding: 10px;
  }

  .ritual-mix-row {
    gap: 12px;
  }

  .ritual-mix-controls {
    width: 100%;
    align-items: stretch;
  }

  .ritual-status-inline {
    text-align: center;
  }

  .compute-loader {
    width: 130px;
    height: 66px;
  }

  .draw-actions {
    justify-content: stretch;
  }

  .draw-actions .game-btn {
    width: 100%;
  }

  .ending-inter .ending-inter-body {
    display: block;
  }

  .ending-inter .rune-img {
    margin-bottom: 12px;
  }

  .game-step-title {
    font-size: 20px;
  }
}

.desc-rune-list {
  max-width: 1000px;
  margin: 0 auto;
}

.desc-rune {
  margin: 12px 20px;
  padding-top: 12px;
  border-top: 1px solid #f1f1f1;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.desc-rune:first-of-type {
  border-top: unset;
}

.desc-rune .rune-img {
  opacity: 0.9;
  min-height: 98px;
  display: flex;
  padding: 2px;
  border-radius: 12px;
  border: 1px solid #d7cfbe;
}

.desc-rune .rune-img img {
  width: 82px;
  height: auto;
  margin: auto;
}

.desc-rune .rune-content-title {
  font-size: 18px;
  font-weight: 500;
  color: #4f4541;
  margin-bottom: 6px;
  line-height: 1.3;
}
.desc-rune .rune-content {
  display: flex;
  flex-direction: column;
}

.desc-rune .rune-content-text {
  font-size: 15px;
  font-weight: 400;
  color: #5f5551;
  margin-bottom: 8px;
  line-height: 1.45;
}

.desc-rune .rune-content-text span:first-of-type {
  font-size: 14px;
  font-weight: 500;
  color: #4f4541;
  text-transform: uppercase;
}

.desc-rune .rune-content-text strong {
  font-weight: 300;
  color: #4f4541;
}

.desc-rune .rune-content-text a {
  font-weight: 400;
  color: var(--pink-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.desc-rune .rune-content-text a:hover {
  color: var(--lightpink-color);
}
.desc-rune .rune-content-more {
  order: 10;
  margin: 4px 0 0;
  font-size: 13px;
  line-height: 1.4;
}
.desc-rune .rune-content-more a {
  color: var(--pink-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.desc-rune .rune-content-more a:hover,
.desc-rune .rune-content-more a:focus-visible {
  color: var(--lightpink-color);
}

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

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

  .desc-rune .rune-img {
    width: 84px;
    min-height: 84px;
    padding: 2px;
    border-radius: 10px;
  }

  .desc-rune .rune-img img {
    width: 68px;
  }

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

  .desc-rune .rune-content-text {
    margin-bottom: 8px;
    line-height: 1.45;
  }
}
