:root {
  --bg: #070812;
  --panel: rgba(16, 18, 38, 0.88);
  --panel-bright: rgba(26, 29, 61, 0.92);
  --text: #f3f7ff;
  --muted: #9fa9c8;
  --line: rgba(128, 156, 255, 0.22);
  --cyan: #47f5ff;
  --violet: #9d6bff;
  --magenta: #ff4fd8;
  --danger: #ff668a;
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(71, 245, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 80% 10%, rgba(157, 107, 255, 0.24), transparent 26rem),
    linear-gradient(135deg, #04050d 0%, #0b1024 48%, #160a2c 100%);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(320px, 1.1fr);
  gap: 24px;
  align-items: center;
  padding: 32px 0;
}

.control-panel,
.number-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--panel), rgba(8, 10, 25, 0.92));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(18px);
}

.control-panel {
  padding: 24px;
}

.title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow,
.stage-label {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.3rem);
  line-height: 0.95;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(71, 245, 255, 0.34);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--cyan);
  background: rgba(71, 245, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
}

.input-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  color: var(--text);
  background: rgba(4, 6, 18, 0.72);
  outline: none;
  box-shadow: inset 0 0 26px rgba(71, 245, 255, 0.04);
}

textarea:focus {
  border-color: rgba(71, 245, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(71, 245, 255, 0.12), inset 0 0 26px rgba(71, 245, 255, 0.05);
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

button,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

button:hover,
.file-button:hover {
  transform: translateY(-1px);
}

button:active,
.file-button:active {
  transform: translateY(0);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.secondary-button {
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #050713;
  font-weight: 900;
  box-shadow: 0 0 28px rgba(71, 245, 255, 0.22);
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.file-button {
  border: 1px solid rgba(157, 107, 255, 0.42);
  color: var(--text);
  background: rgba(157, 107, 255, 0.13);
  font-weight: 800;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.number-stage {
  min-height: 530px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 5vw, 44px);
  text-align: center;
}

.current-number {
  width: 100%;
  min-height: 150px;
  display: grid;
  place-items: center;
  margin: 10px 0 26px;
  overflow-wrap: anywhere;
  color: var(--cyan);
  font-size: clamp(3rem, 13vw, 8rem);
  font-weight: 900;
  line-height: 0.98;
  text-shadow:
    0 0 14px rgba(71, 245, 255, 0.95),
    0 0 38px rgba(157, 107, 255, 0.82),
    0 0 70px rgba(255, 79, 216, 0.35);
}

.next-button {
  width: min(100%, 420px);
  min-height: 74px;
  margin: 0 auto 28px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--magenta), var(--violet) 52%, var(--cyan));
  color: #ffffff;
  font-size: clamp(1.15rem, 4vw, 1.65rem);
  font-weight: 950;
  box-shadow: 0 0 42px rgba(157, 107, 255, 0.38), 0 16px 36px rgba(0, 0, 0, 0.36);
}

.progress-wrap {
  width: min(100%, 520px);
  margin: 0 auto;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.progress-track {
  height: 14px;
  overflow: hidden;
  border: 1px solid rgba(71, 245, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
  box-shadow: 0 0 22px rgba(71, 245, 255, 0.66);
  transition: width 220ms ease;
}

.is-error {
  color: var(--danger);
  border-color: rgba(255, 102, 138, 0.45);
  background: rgba(255, 102, 138, 0.08);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .number-stage {
    min-height: 430px;
    order: -1;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1080px);
    padding: 10px 0;
    gap: 10px;
  }

  .control-panel,
  .number-stage {
    border-radius: 18px;
    padding: 18px;
  }

  .title-row,
  .progress-meta {
    flex-direction: column;
    align-items: stretch;
  }

  .status-pill {
    width: fit-content;
  }
}
