:root {
  --bg: #fafaf9;
  --text: #1a1a1a;
  --text-dim: #999;
  --text-mid: #666;
  --border: #e5e5e3;
  --accent: #d97706;
  --accent-hover: #b45309;
  --green: #16a34a;
  --red: #dc2626;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  height: 100%;
  -webkit-font-smoothing: antialiased;
}

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
}

.content {
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.content.has-result {
  max-width: 80vw;
}

.content.has-result .eyebrow,
.content.has-result h1,
.content.has-result .subtitle {
  display: none;
}

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 16px;
}

h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  line-height: 1.1;
  margin-bottom: 8px;
}

h1 sup {
  font-size: 0.45em;
  vertical-align: super;
  color: var(--accent);
}

.subtitle {
  font-size: 15px;
  color: var(--text-mid);
  margin-bottom: 36px;
}

/* ---- Form ---- */

.form {
  text-align: left;
}

.form.hidden { display: none; }

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}

.input-row input:focus {
  border-color: var(--accent);
}

.input-row input::placeholder {
  color: #bbb;
}

.input-row button {
  padding: 12px 24px;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  position: relative;
  white-space: nowrap;
}

.input-row button:hover {
  background: #333;
}

.input-row button.loading .btn-label { opacity: 0; }
.input-row button.loading .btn-spinner { opacity: 1; }

.btn-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.15s;
}

.btn-spinner svg {
  animation: spin 0.8s linear infinite;
}

/* ---- Result ---- */

.result { margin-top: 24px; text-align: left; animation: fadeIn 0.3s ease; }
.result.hidden { display: none; }

.result-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.result-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.result-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mid);
  flex: 1;
}

.reset-btn {
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 500;
}

.reset-btn:hover { text-decoration: underline; }

.result-frame {
  width: 100%;
  height: 75vh;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}

.result-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.open-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
}

.open-link:hover { color: var(--text); }

/* ---- Error ---- */

.error {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  font-size: 13px;
  color: var(--red);
  text-align: left;
  animation: fadeIn 0.2s ease;
}

.error.hidden { display: none; }

/* ---- Footer ---- */

.foot {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

.foot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
}

/* ---- Animations ---- */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

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