:root {
  --bg: #f4f6fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-soft: #475569;
  --text-faint: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18), 0 2px 8px -4px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% -10%, var(--bg-grad-1), var(--bg-grad-2));
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.55;
}

.wrap {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 48px 20px 24px;
  flex: 1;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.brand .logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--accent);
  border-radius: 10px;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.6);
}
.brand .logo svg { width: 22px; height: 22px; }
.brand h1 {
  font-size: 19px;
  font-weight: 650;
  margin: 0;
  letter-spacing: -0.01em;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.lead {
  text-align: center;
  color: var(--text-soft);
  margin: -8px 0 26px;
  font-size: 15px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 14px 16px;
  font-size: 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  background: #fcfdff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.row {
  display: flex;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.field { flex: 1; min-width: 180px; }

select {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text);
  background: #fcfdff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  font-weight: 600;
  border-radius: 12px;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
}
button:active { transform: translateY(1px); }

.btn-primary {
  width: 100%;
  margin-top: 22px;
  padding: 15px 20px;
  font-size: 15.5px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary svg { width: 18px; height: 18px; }

.btn-ghost {
  padding: 11px 16px;
  font-size: 14px;
  color: var(--accent);
  background: var(--accent-soft);
}
.btn-ghost:hover { background: #e0e7ff; }

.hint {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.hint svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 2px; }

/* link result */
.result { display: none; }
.result.show { display: block; }
.form-view.hide { display: none; }

.link-box {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  align-items: stretch;
}
.link-box input {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  outline: none;
}
.copy-btn {
  padding: 0 18px;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.copy-btn:hover { background: var(--accent-hover); }
.copy-btn.ok { background: var(--success); }

.banner {
  display: flex;
  gap: 10px;
  padding: 13px 15px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 18px;
  align-items: flex-start;
}
.banner svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.banner.success { background: var(--success-soft); color: #065f46; }
.banner.warn { background: #fffbeb; color: #92400e; }
.banner.danger { background: var(--danger-soft); color: #991b1b; }
.banner.info { background: var(--accent-soft); color: #3730a3; }
.banner.tip { margin-top: 18px; margin-bottom: 0; }

.meta {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

.error {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: 10px;
  font-size: 14px;
}
.error.show { display: block; }

/* reveal page */
.secret-box {
  position: relative;
  margin-top: 8px;
}
.secret-box textarea {
  background: #f8fafc;
  min-height: 130px;
}
.center { text-align: center; }
.big-icon {
  width: 64px;
  height: 64px;
  margin: 4px auto 18px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--accent-soft);
}
.big-icon svg { width: 32px; height: 32px; }
.big-icon.gone { background: var(--danger-soft); }
.title-lg { font-size: 21px; font-weight: 650; margin: 0 0 8px; letter-spacing: -0.01em; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer {
  text-align: center;
  padding: 24px 20px 32px;
  font-size: 12.5px;
  color: var(--text-faint);
}
footer a { color: var(--text-soft); text-decoration: none; }
footer a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* layout helpers (kept in CSS so a strict CSP without 'unsafe-inline' applies them) */
.again-btn { margin-top: 18px; width: 100%; }
.lead-tight { margin-bottom: 22px; }
.reveal-btn { margin-top: 0; }
.copy-block { width: 100%; margin-top: 14px; justify-content: center; padding: 13px; }
.gone-link { display: inline-block; text-decoration: none; margin-top: 6px; }
