:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-muted: #f1f3f5;
  --text: #252a31;
  --muted: #757d89;
  --line: #d9dee6;
  --primary: #2477e8;
  --primary-hover: #1769d7;
  --success: #46ad4d;
  --success-hover: #399843;
  --danger: #ee3d3d;
  --shadow: 0 18px 44px rgba(21, 27, 38, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 246, 248, 0.92)),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: calc(100vh - 84px);
  display: grid;
  place-items: start center;
  padding: 62px 18px 28px;
}

.generator {
  width: min(100%, 500px);
  padding: 28px 30px 30px;
  background: var(--panel);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.app-header {
  text-align: center;
  margin-bottom: 28px;
}

.app-header h1 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 28px;
  line-height: 1.16;
  font-weight: 760;
}

.app-header p {
  margin: 0;
  color: #616975;
  font-size: 16px;
  line-height: 1.35;
}

.form-stack {
  display: grid;
  gap: 8px;
}

.field-label,
.compact-field span {
  color: #3e4652;
  font-size: 13px;
  font-weight: 700;
}

.secret-input,
.compact-field input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #121821;
  background: #ffffff;
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.secret-input {
  height: 44px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0;
}

.secret-input:focus,
.compact-field input:focus {
  border-color: rgba(36, 119, 232, 0.72);
  box-shadow: 0 0 0 4px rgba(36, 119, 232, 0.12);
}

.hint {
  margin: -2px 0 8px;
  color: #8a919d;
  font-size: 13px;
  line-height: 1.25;
}

.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.compact-field {
  display: grid;
  gap: 6px;
}

.compact-field input {
  height: 38px;
  padding: 0 12px;
  font-size: 14px;
}

.primary-button,
.copy-button,
.ghost-button {
  display: inline-grid;
  place-items: center;
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  color: #ffffff;
  cursor: pointer;
  font-weight: 720;
  transition: background 160ms ease, opacity 160ms ease, transform 120ms ease;
}

.primary-button {
  height: 44px;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-hover);
}

.copy-button {
  height: 30px;
  margin-top: 16px;
  background: var(--success);
}

.copy-button:hover:not(:disabled) {
  background: var(--success-hover);
}

.primary-button:active,
.copy-button:active:not(:disabled),
.ghost-button:active {
  transform: translateY(1px);
}

.copy-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.code-panel {
  position: relative;
  overflow: hidden;
  min-height: 90px;
  margin-top: 24px;
  padding: 20px 18px 18px;
  border-radius: var(--radius);
  background: var(--panel-muted);
  text-align: center;
}

.code-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 760;
}

.code-line strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.timer-line {
  min-height: 22px;
  margin-top: 4px;
  color: var(--danger);
  font-size: 15px;
  line-height: 1.3;
  font-weight: 760;
}

.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(36, 119, 232, 0.08);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--primary);
  transition: width 240ms linear;
}

.qr-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #edf0f4;
}

.qr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: #3e4652;
  font-size: 14px;
  font-weight: 760;
}

.ghost-button {
  width: auto;
  min-width: 88px;
  height: 30px;
  padding: 0 12px;
  color: var(--primary);
  background: #eaf2ff;
}

.ghost-button:hover {
  background: #dceaff;
}

#qr-canvas {
  display: block;
  width: 164px;
  height: 164px;
  margin: 0 auto;
  border: 1px solid #edf0f4;
  border-radius: var(--radius);
}

.message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--danger);
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
}

.message.is-ok {
  color: var(--success);
}

.footer {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 18px 22px;
  color: #a4abb6;
  font-size: 13px;
}

.footer a {
  color: var(--primary);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (max-width: 540px) {
  .page-shell {
    min-height: calc(100vh - 74px);
    padding-top: 24px;
  }

  .generator {
    padding: 24px 18px;
  }

  .app-header h1 {
    font-size: 25px;
  }

  .app-header p {
    font-size: 15px;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }

  .code-line {
    flex-direction: column;
    gap: 2px;
    font-size: 21px;
  }

  .footer {
    flex-wrap: wrap;
  }
}
