.app-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 20px 16px 24px;
}

.topbar,
.game-layout,
.controls,
.game-over {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

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

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
}

.scoreboard {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.score-card {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  text-align: center;
}

.score-label,
.panel-label {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.score-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.4rem;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 18px;
  margin-top: 18px;
  padding: 18px;
}

.target-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.target-card {
  min-height: 250px;
  padding: 16px;
  background: var(--surface-strong);
  border-radius: 22px;
  border: 1px solid var(--line);
}

.target-value-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 68px;
  margin-bottom: 14px;
}

.target-value {
  font-size: clamp(2rem, 6vw, 3.6rem);
  font-weight: 800;
}

.status-text {
  min-height: 1.4em;
  margin: 0;
  font-weight: 700;
}

.play-area {
  display: flex;
}

.playfield {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: min(72vh, 760px);
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.1)),
    linear-gradient(180deg, #f2e4bc 0%, #ebc579 100%);
}

.lane-columns {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.lane-column {
  border-left: 1px dashed rgba(88, 53, 32, 0.14);
}

.lane-column:first-child {
  border-left: 0;
}

.falling-layer,
.impact-layer,
.floor-blocks {
  position: absolute;
  inset: 0;
}

.floor-blocks {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  padding: 12px 14px;
  gap: 12px;
}

.floor-slot {
  position: relative;
  height: 100%;
}

.number-block {
  position: absolute;
  left: 0;
  display: block;
  border: 2px solid rgba(61, 40, 27, 0.28);
  border-radius: 12px;
  color: #fffaf0;
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent),
    linear-gradient(180deg, var(--accent-soft), var(--accent));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.number-block.floor-block {
  bottom: 0;
}

.number-block.falling-block {
  top: 0;
  width: var(--unit-size);
}

.block-grid {
  position: absolute;
  inset: 0;
  display: grid;
  overflow: hidden;
  border-radius: 10px;
}

.block-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1;
}

.impact-rect {
  position: absolute;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 2px solid rgba(47, 83, 45, 0.28);
  border-radius: 14px;
  color: #f7fff9;
  font-weight: 900;
  font-size: clamp(1rem, 2.4vw, 1.6rem);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent),
    linear-gradient(180deg, #58b66d, #2f8f58);
  box-shadow: 0 14px 30px rgba(36, 99, 56, 0.24);
}

.impact-rect.impact-correct {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent),
    linear-gradient(180deg, #58b66d, #2f8f58);
  box-shadow: 0 14px 30px rgba(36, 99, 56, 0.24);
}

.impact-rect.impact-wrong {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent),
    linear-gradient(180deg, #d76565, #b83e3e);
  box-shadow: 0 14px 30px rgba(120, 36, 36, 0.24);
}

.target-grid {
  display: none;
  margin: 0 auto;
  overflow: hidden;
  border: 2px solid rgba(47, 83, 45, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent),
    linear-gradient(180deg, #58b66d, #2f8f58);
}

.grid-cell {
  min-width: 0;
  min-height: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.26);
  border-bottom: 1px solid rgba(255, 255, 255, 0.26);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
}

.control-button,
.restart-button {
  min-height: 72px;
  border: 0;
  border-radius: 20px;
  color: #fff8ef;
  font-weight: 800;
  font-size: 1.1rem;
  background:
    linear-gradient(180deg, #473321, #2d2017);
  box-shadow: 0 12px 26px rgba(45, 32, 23, 0.22);
}

.control-button:active,
.restart-button:active {
  transform: translateY(1px);
}

.control-button-drop {
  background:
    linear-gradient(180deg, #db6738, #af431f);
}

.game-over {
  margin-top: 18px;
  padding: 18px;
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .target-card {
    min-height: 200px;
  }
}

@media (min-width: 768px) and (max-width: 1180px) {
  .app-shell {
    padding: 14px 14px 18px;
  }

  .topbar {
    padding: 14px 16px;
  }

  .topbar h1 {
    font-size: clamp(1.35rem, 2.6vw, 2rem);
  }

  .scoreboard {
    gap: 8px;
  }

  .score-card {
    min-width: 78px;
    padding: 8px 10px;
  }

  .score-card strong {
    font-size: 1.15rem;
  }

  .game-layout {
    grid-template-columns: minmax(170px, 220px) 1fr;
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
  }

  .target-panel {
    gap: 10px;
  }

  .target-card {
    min-height: 168px;
    padding: 12px;
  }

  .target-value-wrap {
    min-height: 52px;
    margin-bottom: 10px;
  }

  .target-value {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
  }

  .status-text {
    font-size: 0.95rem;
  }

  .playfield {
    min-height: min(58vh, 620px);
  }

  .controls {
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
  }

  .control-button,
  .restart-button {
    min-height: 68px;
    font-size: 1rem;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-inline: 10px;
  }

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

  .controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .control-button,
  .restart-button {
    min-height: 64px;
  }
}

@media (max-width: 900px) {
  .playfield {
    min-height: min(54vh, 560px);
  }
}

@media (max-width: 820px) {
  .target-card {
    min-height: 156px;
  }

  .controls {
    position: sticky;
    bottom: 10px;
    z-index: 5;
  }
}
