.sn-shell {
  box-sizing: border-box;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 24px;
  color: var(--cg-ink);
  font-family: Inter, Arial, sans-serif;
}

.sn-shell *,
.sn-shell *::before,
.sn-shell *::after {
  box-sizing: border-box;
}

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

.sn-statline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.sn-stat {
  min-width: 70px;
  padding: 8px 10px;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff, #eef4ee);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.sn-stat span {
  display: block;
  color: var(--cg-muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sn-stat strong {
  display: block;
  margin-top: 2px;
  color: var(--cg-ink);
  font-size: 19px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sn-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.sn-btn {
  padding: 0 14px;
}

.sn-btn:hover,
.sn-close:hover {
  transform: translateY(-1px);
  border-color: rgba(29, 127, 98, 0.5);
}

.sn-btn:focus-visible,
.sn-close:focus-visible,
.sn-seg-btn:focus-visible,
.sn-canvas:focus-visible {
  outline: 3px solid rgba(49, 95, 157, 0.35);
  outline-offset: 3px;
}

.sn-primary {
  border-color: transparent;
  background: linear-gradient(180deg, #2aa073, var(--cg-green));
  color: #fff;
}

.sn-icon-btn {
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.sn-icon-btn svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sn-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid #0d2018;
  border-radius: 14px;
  background: #10241a;
  box-shadow: var(--cg-shadow);
  touch-action: none;
}

.sn-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  max-height: min(86vh, 720px);
  min-height: 300px;
  cursor: pointer;
  touch-action: none;
}

.sn-veil {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  gap: 8px;
  width: min(88%, 330px);
  padding: 18px;
  border: 1px solid rgba(127, 209, 138, 0.28);
  border-radius: 14px;
  background: rgba(11, 27, 19, 0.9);
  color: #eaf6ec;
  text-align: center;
  box-shadow: 0 24px 60px rgba(4, 14, 9, 0.55);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -44%) scale(0.94);
  transition: opacity 200ms ease, transform 260ms cubic-bezier(0.2, 0.9, 0.3, 1.25), visibility 0s linear 260ms;
}

.sn-veil.sn-show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
  transition-delay: 0s;
}

.sn-start {
  pointer-events: none;
}

.sn-veil strong {
  font-size: 23px;
  line-height: 1.1;
}

.sn-veil span,
.sn-veil p {
  margin: 0;
  color: rgba(214, 236, 219, 0.78);
  font-size: 14px;
  line-height: 1.35;
}

.sn-veil em {
  color: #9ff0b4;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sn-final-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 2px 0;
}

.sn-final-grid div {
  padding: 6px 2px;
  border: 1px solid rgba(127, 209, 138, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.sn-final-grid span {
  display: block;
  color: rgba(214, 236, 219, 0.66);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sn-final-grid strong {
  display: block;
  margin-top: 2px;
  color: #eaf6ec;
  font-size: 16px;
  line-height: 1;
}

.sn-result-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.sn-result-row .sn-btn {
  flex: 1 1 auto;
}

.sn-modes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 20px;
  margin-top: 14px;
}

.sn-modegroup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sn-modelabel {
  color: var(--cg-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sn-seg {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--cg-line);
  border-radius: 10px;
  background: var(--cg-panel);
  box-shadow: 0 8px 20px rgba(33, 43, 40, 0.08);
}

.sn-seg-btn {
  min-height: 44px;
  min-width: 66px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--cg-line);
  border-radius: 0;
  background: transparent;
  color: var(--cg-muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.sn-seg-btn:first-child {
  border-left: 0;
}

.sn-seg-btn:hover {
  background: rgba(29, 127, 98, 0.1);
  color: var(--cg-ink);
}

.sn-seg-btn[aria-pressed="true"] {
  background: linear-gradient(180deg, #2aa073, var(--cg-green));
  color: #fff;
}

.sn-hint {
  margin: 8px 0 0;
  color: var(--cg-muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.sn-pad {
  display: none;
  grid-template-columns: repeat(3, 66px);
  grid-template-rows: repeat(2, 54px);
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.sn-pad-btn {
  padding: 0;
  font-size: 17px;
  line-height: 1;
  color: var(--cg-teal);
}

.sn-pad-up { grid-column: 2; grid-row: 1; }
.sn-pad-left { grid-column: 1; grid-row: 2; }
.sn-pad-down { grid-column: 2; grid-row: 2; }
.sn-pad-right { grid-column: 3; grid-row: 2; }

@media (pointer: coarse) {
  .sn-pad {
    display: grid;
  }
}

.sn-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 26, 19, 0.42);
}

.sn-modal-card {
  position: relative;
  width: min(100%, 460px);
  max-height: 84vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--cg-line);
  border-radius: 14px;
  background: var(--cg-panel);
  color: var(--cg-ink);
  box-shadow: 0 24px 70px rgba(30, 37, 40, 0.22);
}

.sn-modal-card h2 {
  margin: 0 48px 12px 0;
  font-size: 24px;
  line-height: 1.1;
}

.sn-modal-card p {
  margin: 10px 0 0;
  color: var(--cg-muted);
  line-height: 1.45;
}

.sn-close {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.sn-is-hidden {
  display: none !important;
}

@media (max-width: 560px) {
  .sn-shell {
    padding: 0 10px 18px;
  }

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

  .sn-statline,
  .sn-actions {
    justify-content: center;
  }

  .sn-stat {
    flex: 1 1 66px;
    min-width: 0;
    padding: 7px 8px;
    text-align: center;
  }

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

  .sn-canvas {
    max-height: min(58vh, 460px);
    min-height: 280px;
  }

  .sn-modes {
    gap: 8px 14px;
  }

  .sn-modegroup {
    gap: 6px;
  }

  .sn-seg-btn {
    min-width: 58px;
    padding: 0 8px;
  }
}
