.lg-shell {
  --lg-a0: #1d7f62;
  --lg-a1: #127a89;
  --lg-a2: #315f9d;
  --lg-a3: #c8621f;
  --lg-lab: 100px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px 24px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.cg-shell-game .cg-stage-main #game-root > .lg-shell {
  max-width: min(100%, 1080px) !important;
}

.lg-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.lg-statline,
.lg-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.lg-stat {
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid var(--cg-line);
  border-radius: 9px;
  background: var(--cg-panel);
  box-shadow: 0 3px 10px rgba(33, 43, 40, 0.06);
}

.lg-stat span {
  display: block;
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.lg-stat strong {
  display: flex;
  align-items: center;
  height: 20px;
  font-size: 17px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lg-hearts {
  gap: 3px;
}

.lg-hearts i {
  width: 14px;
  height: 14px;
  background: var(--cg-red);
  clip-path: polygon(50% 92%, 6% 44%, 6% 22%, 22% 6%, 40% 8%, 50% 22%, 60% 8%, 78% 6%, 94% 22%, 94% 44%);
  transition: transform 200ms ease, background 200ms ease;
}

.lg-hearts i.lg-lost {
  background: #cfd5d1;
  transform: scale(0.8);
}

.lg-btn,
.lg-close {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(33, 43, 40, 0.06);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.lg-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--cg-teal);
}

.lg-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.lg-btn.lg-on,
.lg-btn.lg-primary {
  background: var(--cg-teal);
  border-color: var(--cg-teal);
  color: #fff;
}

.lg-icon {
  padding: 0;
  font-size: 18px;
}

.lg-prog {
  height: 5px;
  margin-bottom: 10px;
  border-radius: 3px;
  background: #dfe6e1;
  overflow: hidden;
}

.lg-prog i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--cg-teal), var(--cg-green));
  transition: width 260ms ease;
}

.lg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.lg-main {
  min-width: 0;
}

.lg-boardwrap {
  position: relative;
  padding: 24px 10px 12px;
  border: 1px solid #c9d6cf;
  border-radius: 16px;
  background:
    linear-gradient(180deg, #dcecf2 0, #eaf3ee 30%, #f6f1e2 30.1%, #f3ecd8 100%);
  box-shadow: var(--cg-shadow);
  overflow: hidden;
}

.lg-board {
  display: grid;
  gap: 6px;
}

.lg-row {
  display: grid;
  grid-template-columns: var(--lg-lab) repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.lg-hrow {
  align-items: end;
}

.lg-house {
  position: relative;
  height: 46px;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--hw) 0, color-mix(in srgb, var(--hw) 78%, #000) 100%);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 5px;
}

.lg-house.lg-h0 { --hw: #d0605c; }
.lg-house.lg-h1 { --hw: #dba043; }
.lg-house.lg-h2 { --hw: #52a078; }
.lg-house.lg-h3 { --hw: #6784c9; }

.lg-roof {
  position: absolute;
  left: -4px;
  right: -4px;
  top: -12px;
  height: 22px;
  background: color-mix(in srgb, var(--hw) 60%, #2a2320);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.lg-house b {
  position: relative;
  min-width: 26px;
  padding: 1px 0;
  border-radius: 6px 6px 2px 2px;
  background: rgba(255, 255, 255, 0.88);
  color: #2a2320;
  font-size: 15px;
  line-height: 20px;
  text-align: center;
}

.lg-cat {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  min-height: 44px;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--cg-muted);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.lg-cat .lg-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.lg-catname {
  overflow: hidden;
  text-overflow: ellipsis;
}

.lg-cat.lg-on {
  color: var(--cg-ink);
}

.lg-a0 { --c: var(--lg-a0); }
.lg-a1 { --c: var(--lg-a1); }
.lg-a2 { --c: var(--lg-a2); }
.lg-a3 { --c: var(--lg-a3); }

.lg-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: clamp(52px, 8.2vw, 74px);
  padding: 2px;
  border: 1px solid #d2d9d1;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--cg-ink);
  font: inherit;
  font-size: clamp(11px, 2.9vw, 15px);
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.05);
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.lg-cell.lg-open:not(.lg-has) {
  background: #fff;
  border-color: color-mix(in srgb, var(--c) 45%, #d2d9d1);
}

.lg-cell:not(.lg-has):hover {
  transform: translateY(-1px);
}

.lg-cell.lg-cur {
  border-color: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent);
}

.lg-cell.lg-has {
  border-color: transparent;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 82%, #fff) 0, var(--c) 55%, color-mix(in srgb, var(--c) 78%, #000) 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--c) 40%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: default;
}

.lg-cell.lg-fresh {
  animation: lg-pop 480ms cubic-bezier(0.2, 1.6, 0.4, 1);
}

.lg-cell.lg-fresh::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 12px;
  border: 3px solid var(--c);
  animation: lg-ring 560ms ease-out forwards;
  pointer-events: none;
}

.lg-cell.lg-bad {
  border-color: var(--cg-red);
  background: #fbe1df;
  animation: lg-nope 420ms ease;
}

.lg-cell.lg-x::before {
  content: '\00d7';
  position: absolute;
  color: var(--cg-red);
  font-size: 36px;
  font-weight: 400;
  line-height: 1;
  opacity: 0.7;
}

.lg-txt {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.lg-pips {
  position: absolute;
  right: 4px;
  bottom: 4px;
  display: none;
  gap: 2px;
}

.lg-pen .lg-pips {
  display: flex;
}

.lg-pips i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c);
}

.lg-pips i.lg-off {
  background: #d3d8d3;
}

.lg-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.lg-shake {
  animation: lg-shake 380ms ease;
}

.lg-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  background: rgba(244, 248, 244, 0.86);
  backdrop-filter: blur(4px);
  text-align: center;
}

.lg-overlay strong {
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.1;
}

.lg-overlay p,
.lg-overlay span {
  margin: 0;
  color: var(--cg-muted);
  font-size: 14px;
}

.lg-eyebrow {
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cg-teal) !important;
  font-size: 12px !important;
}

.lg-result-actions {
  display: flex;
  gap: 8px;
}

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

.lg-palette {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.lg-chip {
  min-height: 48px;
  min-width: 0;
  padding: 0 4px;
  border: 2px solid var(--c);
  border-radius: 10px;
  background: #fff;
  color: var(--c);
  font: inherit;
  font-size: clamp(12px, 3.2vw, 15px);
  font-weight: 800;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: transform 120ms ease, background 120ms ease;
}

.lg-chip.lg-gone {
  display: none;
}

.lg-chip.lg-sel {
  background: var(--c);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 12px color-mix(in srgb, var(--c) 40%, transparent);
}

.lg-chip.lg-used {
  border-style: dashed;
  opacity: 0.4;
  text-decoration: line-through;
}

.lg-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.lg-tools .lg-btn {
  padding: 0 6px;
  font-size: 13px;
}

.lg-side {
  min-width: 0;
}

.lg-cluehead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.lg-cluehead h2 {
  margin: 0;
  font-size: 15px;
}

.lg-cluehead span {
  color: var(--cg-muted);
  font-size: 12px;
  font-weight: 800;
}

.lg-clues {
  display: grid;
  gap: 6px;
}

.lg-clue {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}

.lg-clue-n {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e5ece8;
  font-size: 12px;
  font-weight: 800;
}

.lg-i {
  font-weight: 800;
  color: var(--c);
}

.lg-t0 { --c: var(--lg-a0); }
.lg-t1 { --c: var(--lg-a1); }
.lg-t2 { --c: var(--lg-a2); }
.lg-t3 { --c: var(--lg-a3); }
.lg-ih { color: #8a5a12; }

.lg-clue.lg-done {
  opacity: 0.45;
}

.lg-clue.lg-done .lg-clue-t {
  text-decoration: line-through;
}

.lg-tip {
  margin: 8px 0;
  color: var(--cg-muted);
  font-size: 12px;
}

.lg-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: #e5ece8;
}

.lg-seg-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--cg-muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.lg-seg-btn.lg-on {
  background: #fff;
  color: var(--cg-teal);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.lg-histline {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  color: var(--cg-muted);
  font-size: 12px;
  font-weight: 700;
}

.lg-histline b {
  color: var(--cg-ink);
}

.lg-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 28, 26, 0.5);
}

.lg-modal-card {
  position: relative;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  border-radius: 14px;
  background: #fff;
  font-size: 14px;
  line-height: 1.5;
}

.lg-modal-card h2 {
  margin: 0 0 8px;
}

.lg-close {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 0;
  font-size: 22px;
}

.lg-btn:focus-visible,
.lg-cell:focus-visible,
.lg-chip:focus-visible,
.lg-clue:focus-visible,
.lg-seg-btn:focus-visible,
.lg-cat:focus-visible {
  outline: 3px solid #175e49;
  outline-offset: 2px;
}

@keyframes lg-pop {
  0% { transform: scale(0.6); }
  100% { transform: scale(1); }
}

@keyframes lg-ring {
  0% { opacity: 0.9; transform: scale(0.9); }
  100% { opacity: 0; transform: scale(1.25); }
}

@keyframes lg-nope {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@keyframes lg-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  60% { transform: translateX(6px); }
}

@media (max-width: 899px) {
  .lg-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .lg-shell {
    --lg-lab: 58px;
    padding: 0 10px 20px;
  }
  .lg-stat {
    padding: 4px 7px;
  }
  .lg-stat-wide {
    display: none;
  }
  .lg-boardwrap {
    padding: 22px 6px 10px;
    border-radius: 12px;
  }
  .lg-board,
  .lg-row {
    gap: 4px;
  }
  .lg-catname {
    font-size: 9px;
  }
  .lg-cat {
    gap: 3px;
  }
  .lg-house {
    height: 38px;
  }
  .lg-house b {
    min-width: 22px;
    font-size: 13px;
    line-height: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lg-cell,
  .lg-cell.lg-fresh,
  .lg-cell.lg-bad,
  .lg-shake {
    animation: none;
  }
}
