:root {
  --bg: #f6f8fc;
  --text: #12223d;
  --muted: #677590;
  --line: #d6deea;
  --brand: #155ff4;
  --brand-strong: #0e45b2;
  --brand-soft: rgba(21, 95, 244, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 10%, rgba(21, 95, 244, 0.11) 0, transparent 34%),
    radial-gradient(circle at 86% 18%, rgba(75, 136, 255, 0.1) 0, transparent 28%),
    linear-gradient(170deg, #f7f9fd 0%, #eef3fb 100%);
}

.screen {
  min-height: 100vh;
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 20px;
  display: grid;
  place-items: center;
}

.launch-btn {
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-size: clamp(1.15rem, 2.1vw, 1.4rem);
  font-weight: 600;
  padding: 24px 46px;
  min-width: min(92vw, 480px);
  min-height: 86px;
  cursor: pointer;
  box-shadow: 0 16px 36px rgba(21, 95, 244, 0.34);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.launch-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(21, 95, 244, 0.38);
}

.launch-btn:disabled {
  opacity: 0.7;
  cursor: progress;
  transform: none;
}

.live-panel {
  width: min(92vw, 620px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px 22px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(3px);
  box-shadow: 0 10px 28px rgba(18, 34, 61, 0.09);
}

.scanner {
  position: relative;
  width: 128px;
  height: 128px;
  margin: 2px auto 16px;
}

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

.ring-1 {
  border-top-color: var(--brand);
  border-right-color: var(--brand);
  animation: spin 2.2s linear infinite;
}

.ring-2 {
  inset: 16px;
  border-bottom-color: #3f8cff;
  border-left-color: #3f8cff;
  animation: spin-rev 1.7s linear infinite;
}

.ring-3 {
  inset: 34px;
  border-top-color: #7cb4ff;
  border-right-color: #7cb4ff;
  animation: spin 1.15s linear infinite;
}

.dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  margin: -5px;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(21, 95, 244, 0.42);
  animation: pulse 1.35s ease-out infinite;
}

.phase {
  margin: 0 0 7px;
  text-align: center;
  font-size: clamp(1.06rem, 2.2vw, 1.2rem);
  font-weight: 700;
}

.phrase {
  margin: 0 0 14px;
  text-align: center;
  color: var(--muted);
  min-height: 1.45em;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.93rem;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8edf6;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #4f9cff);
  transition: width 0.32s ease;
}

.status {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.93rem;
  min-height: 1.4em;
}

.result-panel {
  width: min(92vw, 780px);
  text-align: center;
}

.result-title {
  margin: 0 0 8px;
  font-size: clamp(1.55rem, 3.2vw, 2.25rem);
  font-weight: 800;
}

.result-label {
  margin: 0 0 14px;
  color: var(--muted);
}

.result-id-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
  margin-bottom: 14px;
  box-shadow: 0 10px 24px rgba(18, 34, 61, 0.08);
  overflow-x: auto;
}

.result-id-box code {
  display: block;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: clamp(0.84rem, 2.2vw, 1.2rem);
  font-weight: 700;
  color: #10223f;
  line-height: 1.5;
  white-space: normal;
  word-break: break-all;
}

.result-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.copy-btn {
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  font-size: 0.98rem;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
}

.copy-hint {
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 1.2em;
}

.stress-sandbox {
  display: none;
}

.stress-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.stress-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
}

.stress-status,
.stress-age {
  text-align: right;
}

.state-idle .live-panel,
.state-idle .result-panel {
  display: none;
}

.state-running .launch-btn,
.state-running .result-panel {
  display: none;
}

.state-finished .launch-btn,
.state-finished .live-panel {
  display: none;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes spin-rev {
  from {
    transform: rotate(360deg);
  }
  to {
    transform: rotate(0deg);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(21, 95, 244, 0.42);
  }
  70% {
    box-shadow: 0 0 0 17px rgba(21, 95, 244, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(21, 95, 244, 0);
  }
}

@media (max-width: 700px) {
  .screen {
    padding: 18px 14px;
  }

  .launch-btn {
    min-height: 78px;
    padding: 18px 24px;
  }
}
