.lcs-game {
  display: grid;
  gap: 14px;
}

.lcs-topline {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lcs-stat {
  min-width: 0;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 9px 10px;
}

.lcs-stat span {
  display: block;
  color: #667085;
  font-size: 12px;
  line-height: 1.25;
}

.lcs-stat strong {
  display: block;
  margin-top: 2px;
  color: #17202a;
  font-size: 19px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.lcs-loom {
  display: grid;
  gap: 12px;
  overflow: hidden;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  padding: 14px;
  background:
    repeating-linear-gradient(0deg, rgba(15, 118, 110, 0.045) 0, rgba(15, 118, 110, 0.045) 1px, transparent 1px, transparent 14px),
    repeating-linear-gradient(90deg, rgba(37, 99, 235, 0.035) 0, rgba(37, 99, 235, 0.035) 1px, transparent 1px, transparent 18px),
    linear-gradient(180deg, #ffffff, #f6fafc);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 22px rgba(20, 31, 50, 0.07);
}

.lcs-brief,
.lcs-status {
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #344054;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.45;
}

.lcs-work {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(210px, 0.75fr);
  gap: 12px;
  align-items: start;
}

.lcs-grid-wrap,
.lcs-side {
  min-width: 0;
  display: grid;
  gap: 9px;
}

.lcs-band {
  min-height: 28px;
  display: flex;
  align-items: center;
  color: #475467;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.lcs-band-top {
  justify-content: end;
  padding-right: 4px;
}

.lcs-grid {
  display: grid;
  grid-template-columns: minmax(32px, 40px) repeat(4, minmax(44px, 1fr));
  gap: 4px;
  min-width: 0;
}

.lcs-axis,
.lcs-cell {
  min-width: 0;
  min-height: 44px;
  border-radius: 8px;
}

.lcs-axis {
  display: grid;
  place-items: center;
  border: 1px solid #d7dde6;
  background: #eef2f6;
  color: #344054;
  font-weight: 900;
  font-size: 14px;
}

.lcs-corner {
  color: #667085;
  font-size: 12px;
}

.lcs-cell {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  display: grid;
  place-items: center;
  grid-template-rows: 1fr auto;
  padding: 3px;
  touch-action: manipulation;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.lcs-cell:active {
  transform: scale(0.97);
}

.lcs-cell:disabled {
  cursor: default;
}

.lcs-num {
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
}

.lcs-pair {
  color: #667085;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.lcs-base {
  background: #f2f4f7;
  color: #667085;
}

.lcs-hidden {
  background: #f8fafc;
  color: #98a2b3;
}

.lcs-revealed {
  background: #ffffff;
}

.lcs-current {
  border-color: #b45309;
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.16);
  animation: lcs-pulse 820ms ease infinite;
}

.lcs-selected {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.lcs-path {
  border-color: #0284c7;
  background: #e0f2fe;
}

.lcs-woven {
  border-color: #0f766e;
  background: #d7f4ef;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.lcs-wrong {
  border-color: #b42318 !important;
  background: #fff1f0 !important;
  animation: lcs-shake 360ms ease;
}

.lcs-compare {
  min-height: 104px;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
  display: grid;
  gap: 8px;
  align-content: center;
}

.lcs-compare-title {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.lcs-pair-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.lcs-char,
.lcs-sign {
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  font-size: 22px;
  font-weight: 950;
}

.lcs-char {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #17202a;
}

.lcs-char-good {
  background: #d7f4ef;
  border-color: #0f766e;
  color: #0f514b;
}

.lcs-sign {
  background: #fff7ed;
  color: #92400e;
}

.lcs-sign-good {
  background: #d7f4ef;
  color: #0f514b;
}

.lcs-formula {
  border-radius: 8px;
  background: #f2f4f7;
  color: #344054;
  padding: 8px 9px;
  font-size: 14px;
  font-weight: 800;
}

.lcs-dir-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.lcs-dir {
  min-width: 0;
  min-height: 64px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  cursor: pointer;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 4px;
  touch-action: manipulation;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.lcs-dir:active {
  transform: scale(0.96);
}

.lcs-dir:disabled {
  opacity: 0.46;
  cursor: not-allowed;
  transform: none;
}

.lcs-dir-hot {
  border-color: #0f766e;
  background: #ecfdf5;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

.lcs-dir-wrong {
  border-color: #b42318 !important;
  background: #fff1f0 !important;
  animation: lcs-shake 360ms ease;
}

.lcs-dir-icon {
  font-size: 25px;
  font-weight: 950;
  line-height: 1;
}

.lcs-dir-value {
  color: #475467;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
  text-align: center;
}

.lcs-cloth {
  min-height: 60px;
  border: 1px dashed #98a2b3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px;
}

.lcs-slot {
  width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px dashed #b8c0cc;
  background:
    repeating-linear-gradient(45deg, #f2f4f7 0, #f2f4f7 5px, #ffffff 5px, #ffffff 10px);
}

.lcs-yarn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #0f766e;
  color: #ffffff;
  font-size: 20px;
  font-weight: 950;
  box-shadow: 0 8px 16px rgba(15, 118, 110, 0.18);
  animation: lcs-pop 260ms ease;
}

.lcs-status-good {
  border-color: #147d4f;
  background: #e7f6ef;
  color: #0f5132;
}

.lcs-status-warn {
  border-color: #b45309;
  background: #fff7ed;
  color: #7c2d12;
}

.lcs-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lcs-btn {
  min-height: 46px;
  border: 1px solid #d7dde6;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
  touch-action: manipulation;
}

.lcs-btn-primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #ffffff;
}

.lcs-cell:focus-visible,
.lcs-dir:focus-visible,
.lcs-btn:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

@keyframes lcs-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes lcs-pop {
  from { transform: translateY(4px) scale(0.82); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes lcs-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  70% { transform: translateX(4px); }
}

@media (max-width: 760px) {
  .lcs-work {
    grid-template-columns: 1fr;
  }

  .lcs-side {
    gap: 8px;
  }

  .lcs-compare {
    min-height: 92px;
  }
}

@media (max-width: 520px) {
  .lcs-loom {
    padding: 10px;
  }

  .lcs-topline {
    gap: 7px;
  }

  .lcs-stat {
    padding: 8px;
  }

  .lcs-stat strong {
    font-size: 17px;
  }

  .lcs-grid {
    grid-template-columns: minmax(30px, 34px) repeat(4, minmax(44px, 1fr));
    gap: 3px;
  }

  .lcs-axis,
  .lcs-cell {
    min-height: 44px;
    border-radius: 7px;
  }

  .lcs-num {
    font-size: 17px;
  }

  .lcs-pair {
    font-size: 9px;
  }

  .lcs-dir {
    min-height: 58px;
  }
}

@media (max-width: 380px) {
  .lcs-topline {
    grid-template-columns: 1fr;
  }

  .lcs-grid {
    grid-template-columns: 30px repeat(4, minmax(44px, 1fr));
    gap: 2px;
  }

  .lcs-cell {
    padding: 2px;
  }

  .lcs-pair {
    display: none;
  }

  .lcs-actions {
    grid-template-columns: 1fr;
  }
}
