.tool-frame--playful .tool-header-block {
  max-width: 26rem;
}

.tool-frame--playful .page-subtitle {
  max-width: 24rem;
}

.wordle-ui {
  display: block;
}

.wordle-cabinet {
  position: relative;
  display: grid;
  gap: 0.8rem;
  padding: clamp(0.9rem, 2vw, 1.15rem);
  border-radius: 1.75rem;
  border: 1px solid rgba(129, 168, 255, 0.18);
  background:
    radial-gradient(circle at top left, rgba(255, 149, 77, 0.24), transparent 26%),
    radial-gradient(circle at 90% 10%, rgba(88, 210, 255, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(20, 21, 36, 0.98), rgba(10, 13, 26, 0.98));
  box-shadow: 0 30px 60px rgba(4, 10, 24, 0.42);
}

.wordle-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.wordle-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(129, 168, 255, 0.18);
  background: rgba(27, 38, 61, 0.58);
  color: rgba(220, 231, 255, 0.92);
  font-size: 0.82rem;
}

.wordle-hud__button {
  margin-left: auto;
  min-width: 7.5rem;
}

.wordle-stage {
  display: grid;
  grid-template-columns: minmax(0, 19.25rem) minmax(15rem, 17.5rem);
  justify-content: center;
  gap: 0.9rem;
  align-items: start;
}

.wordle-main {
  display: grid;
  gap: 0.7rem;
  width: min(100%, 19.25rem);
}

.wordle-sidecar {
  display: grid;
  gap: 0.65rem;
  padding: 0.8rem;
  border-radius: 1.3rem;
  border: 1px solid rgba(103, 131, 190, 0.18);
  background: linear-gradient(180deg, rgba(17, 24, 42, 0.85), rgba(11, 16, 31, 0.94));
  max-width: 17.5rem;
}

.wordle-statcard {
  min-width: 0;
  padding: 0.7rem 0.8rem;
  border-radius: 0.95rem;
  border: 1px solid rgba(92, 125, 187, 0.16);
  background: rgba(15, 22, 38, 0.62);
}

.wordle-statcard__label {
  display: block;
  margin-bottom: 0.2rem;
  color: rgba(153, 179, 230, 0.82);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wordle-statcard__value {
  color: rgba(243, 247, 255, 0.96);
  font-size: 0.92rem;
  line-height: 1.2;
}

.wordle-stat__value--mono {
  font-family: "Consolas", "SFMono-Regular", monospace;
  letter-spacing: 0.12em;
  font-size: 0.82rem;
}

.wordle-feedback {
  min-height: 3rem;
  padding: 0.72rem 0.82rem;
  border-radius: 1rem;
  border: 1px solid rgba(110, 145, 210, 0.22);
  background: rgba(24, 34, 56, 0.78);
  color: rgba(239, 245, 255, 0.96);
  line-height: 1.35;
}

.wordle-feedback[data-tone="success"] {
  border-color: rgba(111, 222, 140, 0.4);
  background: rgba(17, 66, 40, 0.92);
}

.wordle-feedback[data-tone="warn"] {
  border-color: rgba(255, 195, 98, 0.42);
  background: rgba(75, 53, 10, 0.92);
}

.wordle-feedback[data-tone="danger"] {
  border-color: rgba(245, 123, 112, 0.42);
  background: rgba(86, 24, 28, 0.94);
}

.wordle-board-frame {
  width: 100%;
  margin-inline: 0;
  padding: 0.75rem;
  border-radius: 1.3rem;
  border: 1px solid rgba(100, 129, 186, 0.18);
  background:
    linear-gradient(180deg, rgba(14, 20, 37, 0.9), rgba(7, 11, 24, 0.96)),
    repeating-linear-gradient(90deg, rgba(96, 140, 216, 0.04) 0 1px, transparent 1px 20px);
}

.wordle-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.32rem;
}

.wordle-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-height: 2.4rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(104, 133, 188, 0.22);
  background: rgba(3, 8, 22, 0.96);
  color: rgba(246, 249, 255, 0.96);
  font-size: clamp(0.95rem, 1.6vw, 1.22rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wordle-tile[data-state="filled"] {
  border-color: rgba(150, 190, 255, 0.36);
}

.wordle-tile[data-state="match"] {
  border-color: rgba(113, 231, 150, 0.48);
  background: rgba(19, 91, 52, 0.98);
}

.wordle-tile[data-state="close"] {
  border-color: rgba(255, 204, 112, 0.48);
  background: rgba(115, 78, 15, 0.98);
}

.wordle-tile[data-state="miss"] {
  border-color: rgba(88, 107, 145, 0.42);
  background: rgba(34, 42, 60, 0.98);
  color: rgba(193, 203, 224, 0.88);
}

.wordle-legend {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.wordle-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: rgba(210, 221, 245, 0.88);
  font-size: 0.8rem;
}

.wordle-legend__item i {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
  background: rgba(53, 68, 98, 0.96);
}

.wordle-legend__item i[data-state="match"] {
  background: rgba(68, 183, 107, 0.98);
}

.wordle-legend__item i[data-state="close"] {
  background: rgba(220, 165, 44, 0.98);
}

.wordle-legend__item i[data-state="miss"] {
  background: rgba(92, 107, 138, 0.98);
}

.wordle-keyboard-shell {
  width: 100%;
  margin-inline: 0;
  padding: 0;
}

.wordle-keyboard {
  display: grid;
  gap: 0.3rem;
}

.wordle-keyboard-row {
  display: grid;
  grid-template-columns: repeat(20, minmax(0, 1fr));
  gap: 0.28rem;
}

.wordle-key {
  grid-column: span 2;
  min-height: 2rem;
  padding: 0.2rem 0.1rem;
  border: 1px solid rgba(120, 154, 223, 0.18);
  border-radius: 0.72rem;
  background: linear-gradient(180deg, rgba(37, 53, 84, 0.98), rgba(24, 34, 58, 0.98));
  color: rgba(244, 247, 255, 0.96);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.wordle-key:hover,
.wordle-key:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(154, 200, 255, 0.4);
  background: linear-gradient(180deg, rgba(52, 75, 114, 0.98), rgba(32, 46, 77, 0.98));
  outline: none;
}

.wordle-key[data-key-type="wide"] {
  grid-column: span 3;
  font-size: 0.68rem;
}

.wordle-key[data-state="match"] {
  background: linear-gradient(180deg, rgba(39, 133, 80, 0.98), rgba(27, 92, 56, 0.98));
}

.wordle-key[data-state="close"] {
  background: linear-gradient(180deg, rgba(158, 111, 22, 0.98), rgba(111, 76, 13, 0.98));
}

.wordle-key[data-state="miss"] {
  background: linear-gradient(180deg, rgba(70, 80, 101, 0.98), rgba(50, 59, 77, 0.98));
  color: rgba(198, 208, 226, 0.88);
}

.wordle-result-layer {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(7, 10, 18, 0.08), rgba(7, 10, 18, 0.24));
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 18;
}

.wordle-result-layer.is-visible {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.wordle-result-card {
  width: min(100%, 22rem);
  position: relative;
  padding: 1.05rem 1.05rem 1.1rem;
  border-radius: 1.2rem;
  border: 1px solid rgba(122, 158, 224, 0.24);
  background: linear-gradient(180deg, rgba(17, 26, 47, 0.97), rgba(10, 16, 30, 0.99));
  box-shadow: 0 24px 48px rgba(5, 12, 26, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.wordle-result-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 0.22rem;
  background: linear-gradient(90deg, rgba(255, 182, 87, 0.95), rgba(102, 187, 255, 0.85));
}

.wordle-result-card[data-tone="success"] {
  border-color: rgba(111, 222, 140, 0.42);
  background: linear-gradient(180deg, rgba(20, 62, 39, 0.98), rgba(12, 34, 24, 0.98));
}

.wordle-result-card[data-tone="danger"] {
  border-color: rgba(245, 123, 112, 0.38);
  background: linear-gradient(180deg, rgba(78, 25, 30, 0.98), rgba(42, 14, 18, 0.98));
}

.wordle-result-card__kicker {
  margin: 0 0 0.3rem;
  color: rgba(176, 199, 245, 0.82);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wordle-result-card__title {
  margin: 0.1rem 0 0;
  color: rgba(244, 248, 255, 0.98);
  font-size: 1.55rem;
  line-height: 1.05;
}

.wordle-result-card__body {
  margin: 0.6rem 0 0;
  color: rgba(234, 241, 255, 0.94);
  line-height: 1.35;
}

.wordle-result-card__button {
  margin-top: 1rem;
  width: 100%;
}

@media (max-width: 840px) {
  .wordle-stage {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .wordle-main {
    justify-self: center;
  }

  .wordle-sidecar {
    width: min(100%, 19.25rem);
    margin-inline: auto;
    max-width: none;
  }
}

@media (min-width: 1180px) {
  .wordle-stage {
    grid-template-columns: minmax(21rem, 24rem) minmax(18.5rem, 21rem);
    max-width: 53rem;
    width: 100%;
    margin-inline: auto;
    gap: 1.25rem;
  }

  .wordle-main {
    width: min(100%, 24rem);
  }

  .wordle-sidecar {
    max-width: 21rem;
  }

  .wordle-board-frame,
  .wordle-keyboard-shell {
    width: 100%;
  }

  .wordle-tile {
    min-height: 2.7rem;
  }
}

@media (max-width: 640px) {
  .tool-frame--playful .tool-header-block {
    padding-inline: 0.45rem;
  }

  .wordle-cabinet {
    padding: 0.82rem;
    border-radius: 1.35rem;
    padding-bottom: 7rem;
  }

  .wordle-hud {
    gap: 0.4rem;
  }

  .wordle-hud__button {
    width: 100%;
    margin-left: 0;
  }

  .wordle-feedback {
    min-height: 2.8rem;
    font-size: 0.94rem;
  }

  .wordle-stage {
    gap: 0.6rem;
  }

  .wordle-main,
  .wordle-sidecar {
    width: 100%;
  }

  .wordle-board-frame {
    padding: 0.58rem;
  }

  .wordle-tile {
    min-height: 2.34rem;
    border-radius: 0.72rem;
  }

  .wordle-legend {
    gap: 0.48rem;
  }

  .wordle-key {
    min-height: 1.85rem;
    border-radius: 0.65rem;
    font-size: 0.72rem;
  }

  .wordle-key[data-key-type="wide"] {
    font-size: 0.62rem;
  }

  .wordle-keyboard-shell {
    position: fixed;
    left: max(0.7rem, env(safe-area-inset-left));
    right: max(0.7rem, env(safe-area-inset-right));
    bottom: calc(env(safe-area-inset-bottom) + 0.45rem);
    width: auto;
    max-width: 24rem;
    margin-inline: auto;
    padding: 0.5rem;
    border-radius: 1rem;
    border: 1px solid rgba(120, 154, 223, 0.2);
    background: rgba(9, 13, 26, 0.94);
    box-shadow: 0 -10px 30px rgba(4, 10, 24, 0.32);
    z-index: 20;
  }

  .wordle-result-layer {
    position: fixed;
    inset: 0;
    align-items: end;
    padding: 0.8rem;
    padding-bottom: calc(env(safe-area-inset-bottom) + 6.35rem);
    background: linear-gradient(180deg, rgba(7, 10, 18, 0.04), rgba(7, 10, 18, 0.42));
    z-index: 32;
  }

  .wordle-result-card {
    width: min(100%, 24rem);
    border-radius: 1.15rem;
  }
}
