:root {
  --bg-0: #0a0b10;
  --bg-1: #10121a;
  --card-bg: rgba(22, 24, 34, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-0: #eef0f6;
  --text-1: #9a9db3;
  --accent: #7c5cff;
  --accent-2: #35d0ff;
  --danger: #ff5c7c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-0);
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(53, 208, 255, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-1), var(--bg-0));
  background-attachment: fixed;
}

.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 64px 24px 80px;
}

.back-link {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--text-1);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent-2);
}

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

.app-header h1 {
  margin: 0 0 8px;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, #fff, #b9b4ff 60%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitle {
  margin: 0;
  color: var(--text-1);
  font-size: 0.95rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 28px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 20px 60px rgba(0, 0, 0, 0.45);
}

.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-1);
  margin-bottom: 10px;
}

.source-input {
  width: 100%;
  min-height: 200px;
  resize: vertical;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 16px;
  color: var(--text-0);
  font-size: 1rem;
  line-height: 1.55;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.source-input::placeholder {
  color: #5a5d70;
}

.source-input:focus {
  border-color: rgba(124, 92, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.14);
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.hint {
  color: var(--text-1);
  font-size: 0.82rem;
}

.btn-glow {
  appearance: none;
  border: none;
  cursor: pointer;
  padding: 12px 26px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 6px 20px rgba(124, 92, 255, 0.35),
    0 0 24px rgba(53, 208, 255, 0.18);
  transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.2s ease;
}

.btn-glow:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.12) inset,
    0 10px 28px rgba(124, 92, 255, 0.5),
    0 0 40px rgba(53, 208, 255, 0.35);
  filter: brightness(1.05);
}

.btn-glow:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

.btn-glow:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 3px;
}

.result-section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.field-row .field-label {
  margin-bottom: 0;
}

.btn-copy {
  appearance: none;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-0);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.btn-copy:hover {
  background: rgba(124, 92, 255, 0.18);
  border-color: rgba(124, 92, 255, 0.45);
  color: #fff;
}

.btn-copy:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.result-output {
  margin: 0;
  min-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 16px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-0);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 7, 12, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlay-in 0.15s ease;
}

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

.modal {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 40px rgba(124, 92, 255, 0.15);
  animation: modal-in 0.18s ease;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-0);
}

.modal-body {
  margin: 0 0 22px;
  color: var(--text-1);
  font-size: 0.9rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-secondary {
  appearance: none;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-0);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  appearance: none;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--danger), #ff8a5c);
  border: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 8px 24px rgba(255, 92, 124, 0.3);
  transition: transform 0.15s ease, box-shadow 0.25s ease, filter 0.2s ease;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 10px 30px rgba(255, 92, 124, 0.45);
  filter: brightness(1.05);
}

.btn-secondary:focus-visible,
.btn-danger:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 520px) {
  .page {
    padding: 40px 16px 60px;
  }

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

  .btn-glow {
    width: 100%;
  }
}
