/* Patterns L4: Square Garden */

.square-page {
  --square-ink: #242318;
  --square-paper: #fff0cf;
  --square-leaf: #4e8b55;
  --square-gold: #dba94a;
  --square-seed: #a66e3a;
  --square-soil: #644936;
  color: var(--square-ink);
}

.square-topbar {
  border-color: rgba(78, 139, 85, 0.28);
}

.square-progressbar {
  background: rgba(255, 240, 207, 0.78);
  border: 1px solid rgba(78, 139, 85, 0.18);
  border-radius: 999px;
  height: 8px;
  margin: 0 auto 10px;
  max-width: 1180px;
  overflow: hidden;
}

.square-progressbar span {
  background: linear-gradient(90deg, var(--square-leaf), var(--square-gold), var(--square-seed));
  display: block;
  height: 100%;
  transition: width 320ms ease;
}

.square-progress {
  display: flex;
  gap: 7px;
  justify-content: center;
  margin: 0 auto 12px;
}

.square-progress__dot {
  background: rgba(36, 35, 24, 0.32);
  border: 1px solid rgba(255, 240, 207, 0.72);
  border-radius: 50%;
  height: 10px;
  width: 10px;
}

.square-progress__dot.is-current {
  background: var(--square-paper);
  box-shadow: 0 0 0 3px rgba(219, 169, 74, 0.22);
}

.square-progress__dot.is-filled {
  background: var(--square-gold);
  box-shadow: 0 0 12px rgba(219, 169, 74, 0.44);
}

.square-room {
  margin: 0 auto;
  max-width: 1180px;
}

.square-room__scene {
  background:
    radial-gradient(circle at 18% 18%, rgba(219, 169, 74, 0.24), transparent 24%),
    radial-gradient(circle at 80% 32%, rgba(78, 139, 85, 0.24), transparent 24%),
    linear-gradient(180deg, rgba(255, 240, 207, 0.12), rgba(36, 35, 24, 0.18)),
    url("../img/arena-patterns-sequencegarden.jpg") center center / cover no-repeat;
  border: 1px solid rgba(255, 240, 207, 0.3);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(36, 35, 24, 0.34);
  height: min(740px, calc(100vh - 130px));
  min-height: 680px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.square-room__scene::before {
  background:
    repeating-linear-gradient(90deg, rgba(255, 240, 207, 0.055) 0 1px, transparent 1px 72px),
    radial-gradient(ellipse at 50% 76%, rgba(78, 139, 85, 0.18), transparent 46%),
    linear-gradient(180deg, rgba(20, 20, 20, 0.08), transparent 48%);
  content: "";
  inset: 0;
  position: absolute;
  z-index: 1;
}

.square-room__scene::after {
  background:
    repeating-linear-gradient(90deg, rgba(36, 35, 24, 0.12) 0 4px, transparent 4px 44px),
    linear-gradient(180deg, #6c7a4e, #3b4d35);
  border-top: 1px solid rgba(255, 240, 207, 0.2);
  bottom: -58px;
  box-shadow: 0 -20px 45px rgba(36, 35, 24, 0.3);
  content: "";
  height: 210px;
  left: -3%;
  position: absolute;
  right: -3%;
  transform: skewY(-2deg);
  z-index: -1;
}

.square-room__arches {
  display: flex;
  gap: 18px;
  left: 6%;
  position: absolute;
  top: 28px;
  z-index: 2;
}

.square-room__arches span {
  background: linear-gradient(180deg, rgba(255, 240, 207, 0.5), rgba(78, 139, 85, 0.48));
  border: 1px solid rgba(255, 248, 228, 0.28);
  border-radius: 28px 28px 4px 4px;
  height: 90px;
  width: 44px;
}

.square-room__lamps {
  inset: auto 5% 72px 5%;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.square-room__lamps span {
  background: radial-gradient(circle, #fff6ca 0 35%, var(--square-gold) 36% 58%, rgba(219, 169, 74, 0.08) 59%);
  border-radius: 50%;
  bottom: 0;
  box-shadow: 0 0 40px rgba(219, 169, 74, 0.5);
  height: 54px;
  position: absolute;
  width: 54px;
}

.square-room__lamps span:first-child { left: 0; }
.square-room__lamps span:last-child { right: 0; }

.square-room__prompt {
  left: 50%;
  max-width: min(720px, 66%);
  position: absolute;
  text-align: center;
  text-shadow: 0 3px 10px rgba(20, 18, 16, 0.56);
  top: 3%;
  transform: translateX(-50%);
  z-index: 5;
}

.square-room__prompt span,
.square-shelf__title span,
.square-prompt-card__title span,
.square-bed-card__title span,
.square-control-panel > span,
.square-readout span,
.square-why span {
  color: rgba(255, 248, 228, 0.84);
  display: block;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.square-room__prompt h1 {
  color: #fff7df;
  font-family: var(--font-display);
  font-size: clamp(1.28rem, 2.35vw, 2rem);
  line-height: 1.04;
  margin: 3px 0 0;
}

.square-shelf {
  background: linear-gradient(180deg, rgba(36, 35, 24, 0.9), rgba(44, 54, 40, 0.9));
  border: 2px solid rgba(255, 240, 207, 0.32);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(28, 26, 22, 0.28);
  left: 4%;
  padding: 9px 12px;
  position: absolute;
  right: 4%;
  top: 13%;
  z-index: 4;
}

.square-shelf__title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}

.square-shelf__title strong {
  color: #fff2c8;
  font-size: 0.82rem;
}

.square-shelf__rail {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.square-shelf__slot {
  background: rgba(255, 240, 207, 0.08);
  border: 1px dashed rgba(255, 240, 207, 0.28);
  border-radius: 6px;
  display: grid;
  min-height: 74px;
  padding: 6px;
  place-items: center;
}

.square-shelf__slot.is-current {
  border-color: rgba(219, 169, 74, 0.62);
}

.square-shelf__slot.is-filled {
  background: rgba(219, 169, 74, 0.13);
  border-style: solid;
}

.square-token {
  background: linear-gradient(180deg, #bfb49d, #706550);
  border: 2px solid rgba(255, 248, 228, 0.18);
  border-radius: 7px;
  color: #fff7df;
  display: grid;
  min-height: 60px;
  padding: 7px;
  place-items: center;
  text-align: center;
  width: 100%;
}

.square-token.is-filled {
  background: linear-gradient(180deg, #f0d07a, #9a7431);
  box-shadow: 0 0 18px rgba(219, 169, 74, 0.28);
}

.square-token span {
  font-size: 0.64rem;
  font-weight: 900;
  text-transform: uppercase;
}

.square-token strong {
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.25vw, 1.25rem);
  line-height: 1;
}

.square-steps {
  display: flex;
  gap: 8px;
  justify-content: center;
  left: 50%;
  position: absolute;
  top: 28%;
  transform: translateX(-50%);
  width: min(820px, 82%);
  z-index: 5;
}

.square-step {
  background: rgba(255, 240, 207, 0.13);
  border: 1px solid rgba(255, 240, 207, 0.24);
  border-radius: 999px;
  color: rgba(255, 248, 228, 0.74);
  flex: 1;
  font-size: 0.62rem;
  font-weight: 900;
  min-height: 34px;
  padding: 9px 10px;
  text-align: center;
  text-transform: uppercase;
}

.square-step--active {
  background: rgba(219, 169, 74, 0.92);
  color: #2a251b;
}

.square-step--complete {
  background: rgba(78, 139, 85, 0.88);
  color: #fff7df;
}

.square-step--pending {
  opacity: 0.58;
}

.square-workbench {
  align-items: stretch;
  bottom: 8%;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.85fr) minmax(230px, 0.72fr) minmax(180px, 0.54fr);
  left: 5%;
  position: absolute;
  right: 5%;
  top: 35%;
  z-index: 5;
}

.square-main-panel {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 0.9fr) minmax(240px, 1fr);
  min-width: 0;
}

.square-prompt-card,
.square-bed-card,
.square-control-panel {
  background: rgba(36, 35, 24, 0.84);
  border: 1px solid rgba(255, 240, 207, 0.24);
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(28, 26, 22, 0.28);
  color: #fff7df;
}

.square-prompt-card,
.square-bed-card {
  align-content: start;
  display: grid;
  gap: 14px;
  padding: 16px;
}

.square-prompt-card__title,
.square-bed-card__title {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.square-prompt-card__title strong,
.square-bed-card__title strong {
  color: #fff2c8;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.5vw, 1.4rem);
  line-height: 1;
}

.square-prompt-card p {
  color: rgba(255, 248, 228, 0.82);
  line-height: 1.35;
  margin: 0;
}

.square-sequence {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.square-sequence-stone {
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 248, 228, 0.35), transparent 26%),
    linear-gradient(180deg, #beb49c, #6f6552);
  border: 3px solid rgba(255, 248, 228, 0.22);
  border-radius: 8px;
  color: #fff7df;
  display: grid;
  min-height: 82px;
  padding: 8px;
  place-items: center;
  text-align: center;
}

.square-sequence-stone--blank {
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 248, 228, 0.32), transparent 26%),
    linear-gradient(180deg, #e3c875, #8b6b2f);
  border-color: rgba(255, 248, 228, 0.58);
}

.square-sequence-stone--blank.is-ready {
  animation: square-ready 900ms ease-in-out infinite;
}

.square-sequence-stone span {
  font-size: 0.62rem;
  font-weight: 900;
  opacity: 0.75;
}

.square-sequence-stone strong {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2vw, 2rem);
  line-height: 1;
}

.square-question {
  background: rgba(255, 248, 228, 0.12);
  border: 1px solid rgba(255, 248, 228, 0.18);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.square-question span,
.square-question em {
  color: rgba(255, 248, 228, 0.72);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.square-question strong {
  color: #ffe29b;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 3.6rem);
  line-height: 0.95;
}

.square-bed {
  aspect-ratio: 1;
  background:
    repeating-linear-gradient(90deg, rgba(255, 248, 228, 0.05) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(255, 248, 228, 0.05) 0 1px, transparent 1px 32px),
    linear-gradient(180deg, #77543b, var(--square-soil));
  border: 4px solid rgba(255, 248, 228, 0.24);
  border-radius: 8px;
  box-shadow: inset 0 0 28px rgba(28, 22, 16, 0.38);
  display: grid;
  gap: clamp(3px, 0.55vw, 6px);
  grid-template-columns: repeat(var(--side), minmax(0, 1fr));
  margin: 0 auto;
  max-height: 270px;
  max-width: 270px;
  min-height: 180px;
  padding: clamp(8px, 1vw, 12px);
  place-items: stretch;
  width: 100%;
}

.square-bed span {
  background: radial-gradient(circle at 35% 32%, #fff2a6 0 22%, var(--square-gold) 23% 54%, #8b6725 55%);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(28, 22, 16, 0.28);
  min-height: 0;
}

.square-bed__empty {
  align-self: center;
  color: rgba(255, 248, 228, 0.68);
  font-weight: 900;
  grid-column: 1;
  justify-self: center;
  text-align: center;
  text-transform: uppercase;
}

.square-control-panel {
  align-content: start;
  display: grid;
  gap: 12px;
  padding: 16px;
  text-align: center;
}

.square-counter {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
}

.square-counter button,
.square-counter__quick button {
  background: linear-gradient(180deg, #eee0bb, #b8a06c);
  border: 2px solid rgba(36, 35, 24, 0.22);
  border-radius: 8px;
  color: #29251a;
  cursor: pointer;
  font-family: var(--font-display);
  min-height: 42px;
}

.square-counter button {
  font-size: 1.2rem;
}

.square-counter button:disabled,
.square-counter__quick button:disabled {
  cursor: default;
  opacity: 0.45;
}

.square-counter strong {
  align-items: center;
  background: rgba(255, 248, 228, 0.12);
  border: 1px solid rgba(255, 248, 228, 0.22);
  border-radius: 8px;
  color: #ffe29b;
  display: flex;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 3.2rem);
  justify-content: center;
  line-height: 0.9;
  min-height: 72px;
}

.square-counter__quick {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.square-counter__quick button {
  font-size: 0.82rem;
}

.square-readout {
  background: rgba(255, 248, 228, 0.12);
  border: 1px solid rgba(255, 248, 228, 0.18);
  border-radius: 8px;
  padding: 10px;
}

.square-readout strong {
  color: #ffe29b;
  display: block;
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-top: 3px;
}

.square-lock {
  background: linear-gradient(180deg, #6f6b5e, #353127);
  border: 2px solid rgba(255, 240, 207, 0.28);
  border-radius: 8px;
  color: rgba(255, 248, 228, 0.72);
  cursor: default;
  display: grid;
  gap: 5px;
  min-height: 76px;
  padding: 10px;
  place-items: center;
}

.square-lock span {
  background: currentColor;
  border-radius: 999px;
  height: 6px;
  opacity: 0.42;
  width: 48px;
}

.square-lock strong {
  font-family: var(--font-display);
}

.square-lock.is-ready {
  background: linear-gradient(180deg, #e4bc59, #785b22);
  border-color: rgba(255, 247, 212, 0.76);
  box-shadow: 0 0 20px rgba(219, 169, 74, 0.38);
  color: #241f18;
  cursor: pointer;
}

.square-aldra {
  align-self: end;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 0;
  position: relative;
}

.square-aldra__head {
  background: linear-gradient(180deg, #f1c88c, #a0664e);
  border-radius: 50%;
  height: 46px;
  position: relative;
  width: 46px;
  z-index: 2;
}

.square-aldra__head span {
  background: rgba(36, 35, 24, 0.28);
  border-radius: 999px;
  height: 6px;
  left: 12px;
  position: absolute;
  top: 25px;
  width: 22px;
}

.square-aldra__body {
  background: linear-gradient(180deg, #efe0bc, #80654d);
  border-radius: 26px 26px 8px 8px;
  height: 94px;
  margin-top: -10px;
  width: 66px;
}

.square-aldra__spade {
  background: linear-gradient(180deg, #9a6d3a, #4b351d);
  border-radius: 999px;
  height: 132px;
  position: absolute;
  right: 24px;
  top: 34px;
  transform: rotate(-15deg);
  width: 7px;
}

.square-aldra__spade::before {
  background: var(--square-gold);
  border-radius: 3px 3px 14px 14px;
  content: "";
  height: 30px;
  left: -11px;
  position: absolute;
  top: -22px;
  width: 29px;
}

.square-aldra__bubble {
  background: rgba(36, 35, 24, 0.86);
  border: 1px solid rgba(255, 240, 207, 0.24);
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(28, 26, 22, 0.24);
  color: #fff7df;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.28;
  padding: 12px;
  text-align: center;
}

.square-why {
  background: rgba(255, 248, 228, 0.12);
  border: 1px solid rgba(255, 248, 228, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
}

.square-why p {
  color: rgba(255, 248, 228, 0.86);
  line-height: 1.35;
  margin: 4px 0 0;
}

.square-celebration {
  background: rgba(36, 35, 24, 0.9);
  border: 2px solid rgba(219, 169, 74, 0.56);
  border-radius: 8px;
  bottom: 24px;
  box-shadow: 0 18px 38px rgba(28, 26, 22, 0.34);
  color: #fff7df;
  display: grid;
  gap: 10px;
  left: 50%;
  max-width: 560px;
  padding: 16px;
  position: absolute;
  text-align: center;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 44px));
  z-index: 14;
}

.square-celebration > strong {
  color: #ffe29b;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.square-celebration > span {
  color: rgba(255, 248, 228, 0.78);
  font-weight: 900;
}

.square-reward {
  display: grid;
  height: 100%;
  padding: 34px;
  place-items: center;
  position: relative;
  z-index: 5;
}

.square-reward__card {
  background: rgba(36, 35, 24, 0.9);
  border: 2px solid rgba(219, 169, 74, 0.5);
  border-radius: 8px;
  box-shadow: 0 24px 54px rgba(28, 26, 22, 0.38);
  color: #fff7df;
  display: grid;
  gap: 16px;
  max-width: 900px;
  padding: 24px;
  text-align: center;
  width: min(900px, 100%);
}

.square-reward__copy span {
  color: #ffe29b;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.square-reward__copy h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
  margin: 4px 0 6px;
}

.square-reward__copy p {
  color: rgba(255, 248, 228, 0.82);
  margin: 0;
}

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

.square-reward__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.square-reward__badges span {
  background: rgba(255, 248, 228, 0.12);
  border: 1px solid rgba(255, 248, 228, 0.2);
  border-radius: 999px;
  color: #fff2c8;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 8px 12px;
}

.square-reward__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

@keyframes square-ready {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@media (max-width: 1080px) {
  .square-main-panel {
    grid-template-columns: 1fr;
  }

  .square-workbench {
    grid-template-columns: minmax(0, 1.45fr) minmax(230px, 0.85fr);
  }

  .square-aldra {
    display: none;
  }
}

@media (max-width: 980px) {
  .square-room__scene {
    height: auto;
    min-height: 1120px;
    overflow-y: auto;
  }

  .square-workbench {
    grid-template-columns: 1fr;
    position: relative;
    inset: auto;
    margin: 250px 20px 30px;
  }
}

@media (max-width: 720px) {
  .square-shelf__rail,
  .square-reward__tiles {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .square-steps {
    flex-direction: column;
    top: 24%;
  }

  .square-sequence {
    gap: 6px;
  }

  .square-sequence-stone {
    min-height: 68px;
    padding: 6px;
  }

  .square-room__prompt {
    max-width: calc(100% - 28px);
  }
}
