.lng-inline-app {
  --ink: #18202a;
  --muted: #637084;
  --rose: #e64874;
  --sun: #ffbf3f;
  --mint: #16b68e;
  --blue: #2877dc;
  --violet: #7357e8;
  --paper: rgba(255, 255, 255, 0.92);
  --line: rgba(24, 32, 42, 0.12);
  --shadow: 0 14px 38px rgba(31, 38, 65, 0.1);
  box-sizing: border-box;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: transparent;
  border-radius: 8px;
  overflow: visible;
}

.lng-inline-app * {
  box-sizing: border-box;
}

.lng-inline-app button,
.lng-inline-app input {
  font: inherit;
}

.lng-inline-app button {
  cursor: pointer;
}

.app-shell {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.hero,
.control-panel,
.draw-panel,
.history-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 250px;
  padding: clamp(24px, 5vw, 58px);
  overflow: hidden;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.6;
  background:
    linear-gradient(90deg, rgba(230, 72, 116, 0.09) 1px, transparent 1px),
    linear-gradient(0deg, rgba(40, 119, 220, 0.08) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(90deg, #000, transparent 74%);
}

.hero-copy,
.hero-meter {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--violet);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.lng-inline-app h1,
.lng-inline-app h2,
.lng-inline-app p {
  overflow-wrap: anywhere;
}

.lng-inline-app h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 5.6rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.lng-inline-app h2 {
  margin: 0;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.05;
}

.tagline {
  max-width: 670px;
  margin: 18px 0 0;
  color: #35465a;
  font-size: clamp(1.03rem, 2vw, 1.28rem);
  font-weight: 650;
}

.hero-meter {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 10px;
  transform: rotate(-3deg);
}

.hero-meter span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 3px solid rgba(24, 32, 42, 0.12);
  border-radius: 8px;
  color: white;
  font-size: 2.6rem;
  font-weight: 950;
  box-shadow: 0 14px 30px rgba(24, 32, 42, 0.18);
}

.hero-meter span:nth-child(1) {
  background: var(--rose);
}

.hero-meter span:nth-child(2) {
  background: var(--blue);
  transform: translateY(18px);
}

.hero-meter span:nth-child(3) {
  background: var(--mint);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 18px;
  margin-top: 18px;
  align-items: stretch;
}

.control-panel,
.draw-panel,
.history-panel {
  padding: clamp(18px, 3vw, 28px);
}

.section-heading {
  margin-bottom: 18px;
}

.lng-inline-app label {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: #334257;
  font-size: 0.86rem;
  font-weight: 850;
}

.lng-inline-app input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(24, 32, 42, 0.18);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.86);
  font-weight: 750;
  outline: none;
}

.lng-inline-app input[type="checkbox"] {
  width: 22px;
  min-height: 22px;
  accent-color: var(--violet);
}

.lng-inline-app input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(40, 119, 220, 0.14);
}

.check-control {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(24, 32, 42, 0.12);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.74);
}

.check-control span {
  line-height: 1.3;
}

.terms-link {
  border: 0;
  padding: 0;
  color: var(--violet);
  background: transparent;
  font-weight: 950;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.split-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.chip-button,
.secondary-button {
  border: 1px solid rgba(24, 32, 42, 0.13);
  border-radius: 8px;
  color: #2a3443;
  background: white;
  font-weight: 900;
}

.chip-button {
  min-height: 38px;
  font-size: 0.82rem;
}

.primary-button,
.secondary-button {
  min-height: 50px;
  padding: 0 18px;
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--violet) 48%, var(--blue));
  font-weight: 950;
  box-shadow: 0 16px 34px rgba(115, 87, 232, 0.27);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.form-hint,
.muted {
  color: var(--muted);
  line-height: 1.5;
}

.form-hint {
  margin: 14px 0 0;
  font-size: 0.9rem;
}

.draw-panel {
  display: flex;
  flex-direction: column;
}

.draw-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.lock-badge {
  display: inline-flex;
  min-width: 90px;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  color: white;
  background: var(--mint);
  font-size: 0.78rem;
  font-weight: 950;
}

.lock-badge.is-locked {
  background: var(--rose);
}

.number-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  min-height: 430px;
  margin-top: 24px;
  align-content: start;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 230px;
  border: 2px dashed rgba(24, 32, 42, 0.16);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-symbol {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  color: white;
  background: var(--sun);
  font-size: 3rem;
  font-weight: 950;
  box-shadow: 0 16px 38px rgba(255, 191, 63, 0.28);
}

.number-card {
  display: grid;
  grid-template-columns: minmax(76px, 0.7fr) minmax(126px, 1.3fr);
  align-items: center;
  gap: 10px;
  min-height: 64px;
  border: 1px solid rgba(24, 32, 42, 0.12);
  border-radius: 8px;
  padding: 10px 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.7)),
    var(--accent);
  box-shadow: 0 16px 38px rgba(24, 32, 42, 0.12);
  transform: translateY(14px) scale(0.96);
  opacity: 0;
}

.number-card.is-visible {
  animation: popIn 420ms ease forwards;
}

.group-label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 950;
  text-transform: uppercase;
}

.group-label span:last-child {
  color: var(--violet);
}

.number-window {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  min-height: 44px;
  margin-top: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.45rem, 2rem, 2.1rem);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  line-height: 1;
}

.digit {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
}

.number-window.is-spinning .digit {
  animation: digitPulse 120ms linear infinite;
}

.draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 22px;
}

.secondary-button {
  flex: 1;
  min-width: 145px;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.insight-strip div {
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.74);
}

.insight-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.insight-strip strong {
  display: block;
  margin-top: 5px;
  font-size: 0.94rem;
}

.history-panel {
  margin-top: 18px;
}

.terms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.terms-grid article {
  border: 1px solid rgba(24, 32, 42, 0.1);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
}

.terms-grid h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.terms-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(24, 32, 42, 0.58);
}

.modal-backdrop[hidden] {
  display: none;
}

.terms-modal {
  width: min(880px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 28px);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 80px rgba(24, 32, 42, 0.28);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(24, 32, 42, 0.14);
  border-radius: 50%;
  color: var(--ink);
  background: white;
  font-size: 1.2rem;
  font-weight: 950;
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.modal-actions .primary-button {
  width: auto;
  min-width: 180px;
  margin-top: 0;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(24, 32, 42, 0.1);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.74);
}

.history-item strong {
  display: block;
}

.history-item span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 5;
  max-width: min(420px, calc(100% - 28px));
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  background: #18202a;
  box-shadow: 0 16px 44px rgba(24, 32, 42, 0.26);
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes popIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes digitPulse {
  0% {
    transform: translateY(-3px);
    opacity: 0.7;
  }
  100% {
    transform: translateY(3px);
    opacity: 1;
  }
}

@media (max-width: 860px) {
  .hero,
  .workbench {
    grid-template-columns: 1fr;
  }

  .hero {
    display: grid;
  }

  .hero-meter {
    grid-template-columns: repeat(3, minmax(62px, 78px));
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 18px, 1160px);
    padding-top: 10px;
  }

  .split-fields,
  .quick-row,
  .terms-grid,
  .insight-strip {
    grid-template-columns: 1fr;
  }

  .draw-header,
  .history-item {
    display: grid;
  }

  .number-stage {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .number-card {
    grid-template-columns: minmax(72px, 0.7fr) minmax(116px, 1.3fr);
  }

  .modal-header {
    grid-template-columns: 1fr auto;
  }
}
