.cn-shell {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 12px 14px 28px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.cn-topbar,
.cn-status,
.cn-controls,
.cn-stats,
.cn-actions {
  display: flex;
  align-items: center;
}

.cn-topbar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cn-stats {
  flex-wrap: wrap;
  gap: 8px;
}

.cn-stats span {
  min-width: 60px;
  padding: 7px 9px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  box-shadow: var(--cg-shadow);
}

.cn-stats b,
.cn-stats small {
  display: block;
  line-height: 1.1;
}

.cn-stats b {
  font-size: 17px;
  font-weight: 800;
}

.cn-stats small {
  margin-top: 2px;
  color: var(--cg-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.cn-controls {
  justify-content: flex-end;
  gap: 8px;
}

.cn-iconbtn,
.cn-share,
.cn-btn,
.cn-submit,
.cn-close {
  min-height: 44px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--cg-shadow);
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, opacity 140ms ease;
}

.cn-iconbtn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  padding: 0;
  font-size: 18px;
}

.cn-iconbtn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cn-share,
.cn-btn,
.cn-submit {
  padding: 0 14px;
}

.cn-submit {
  min-width: 104px;
  background: var(--cg-ink);
  color: var(--cg-panel);
}

.cn-iconbtn:hover,
.cn-share:hover,
.cn-btn:hover,
.cn-submit:hover,
.cn-close:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--cg-ink) 35%, var(--cg-line));
}

.cn-iconbtn:focus-visible,
.cn-share:focus-visible,
.cn-btn:focus-visible,
.cn-submit:focus-visible,
.cn-close:focus-visible,
.cn-tile:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cg-blue) 55%, white);
  outline-offset: 3px;
}

.cn-iconbtn:disabled,
.cn-share:disabled,
.cn-btn:disabled,
.cn-submit:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.cn-status {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.cn-day {
  color: var(--cg-muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.cn-mistakes {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--cg-muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.cn-mistakes i {
  width: 12px;
  height: 12px;
  border: 1px solid color-mix(in srgb, var(--cg-muted) 38%, var(--cg-line));
  border-radius: 50%;
  background: var(--cg-panel);
}

.cn-mistakes i.cn-used {
  border-color: var(--cg-red);
  background: var(--cg-red);
}

.cn-board {
  display: grid;
  gap: 8px;
}

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

.cn-tile {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1.4;
  min-height: 58px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--cg-line) 82%, var(--cg-ink));
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  font: inherit;
  font-size: clamp(12px, 3vw, 16px);
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  overflow-wrap: anywhere;
  cursor: pointer;
  box-shadow: var(--cg-shadow);
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.cn-tile.cn-small {
  font-size: clamp(10px, 2.35vw, 13px);
}

.cn-tile.cn-tiny {
  font-size: clamp(9px, 2vw, 11px);
}

.cn-tile:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--cg-blue) 38%, var(--cg-line));
}

.cn-tile.cn-selected {
  border-color: var(--cg-ink);
  background: var(--cg-ink);
  color: var(--cg-panel);
  transform: translateY(-2px);
}

.cn-tile.cn-shaking {
  animation: cn-shake 420ms ease both;
}

.cn-band {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #171b1d;
  text-align: center;
  box-shadow: var(--cg-shadow);
  animation: cn-band-in 220ms ease both;
}

.cn-band strong {
  font-size: 15px;
  font-weight: 950;
  text-transform: uppercase;
}

.cn-band span {
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
}

.cn-band.cn-new {
  animation: cn-band-in 260ms ease both, cn-pop 520ms ease both;
}

.cn-tier-yellow {
  background: #dac756;
}

.cn-tier-green {
  background: color-mix(in srgb, var(--cg-green) 82%, white);
  color: white;
}

.cn-tier-blue {
  background: color-mix(in srgb, var(--cg-blue) 86%, white);
  color: white;
}

.cn-tier-purple {
  background: #8b55aa;
  color: white;
}

.cn-actions {
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.cn-shell.cn-shuffling .cn-grid {
  animation: cn-soft-shuffle 180ms ease both;
}

.cn-shell.cn-complete .cn-actions {
  opacity: 0.78;
}

.cn-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(30, 37, 40, 0.34);
}

.cn-overlay[hidden] {
  display: none;
}

.cn-dialog {
  position: relative;
  width: min(100%, 460px);
  padding: 22px;
  border: 1px solid var(--cg-line);
  border-radius: 8px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  box-shadow: 0 22px 70px rgba(30, 37, 40, 0.22);
  animation: cn-dialog-in 180ms ease both;
}

.cn-dialog h2 {
  margin: 0 44px 10px 0;
  font-size: 24px;
  line-height: 1.1;
}

.cn-dialog p {
  margin: 0 0 12px;
  color: var(--cg-muted);
  line-height: 1.5;
}

.cn-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.cn-help-tiers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.cn-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

@keyframes cn-shake {
  0%, 100% { transform: translateX(0) translateY(-2px); }
  18% { transform: translateX(-7px) translateY(-2px); }
  36% { transform: translateX(7px) translateY(-2px); }
  54% { transform: translateX(-5px) translateY(-2px); }
  72% { transform: translateX(5px) translateY(-2px); }
}

@keyframes cn-band-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cn-pop {
  45% { transform: scale(1.02); }
}

@keyframes cn-soft-shuffle {
  45% { opacity: 0.72; transform: scale(0.985); }
}

@keyframes cn-dialog-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .cn-shell {
    padding: 10px 10px 24px;
  }

  .cn-topbar {
    align-items: flex-start;
  }

  .cn-stats span {
    min-width: 52px;
    padding: 6px 7px;
  }

  .cn-stats b {
    font-size: 15px;
  }

  .cn-share {
    width: 64px;
    padding: 0 8px;
  }

  .cn-grid {
    gap: 6px;
  }

  .cn-tile {
    min-height: 52px;
    padding: 5px;
    border-radius: 7px;
  }

  .cn-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cn-btn,
  .cn-submit {
    min-width: 0;
    padding: 0 8px;
    font-size: 13px;
  }
}
