:root {
  color-scheme: light dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --blue: #175cd3;
  --blue-hover: #1849a9;
  --text: #101828;
  --text-secondary: #475467;
  --text-muted: #667085;
  --surface: #fff;
  --canvas: #f8fafc;
  --border: #d0d5dd;
  --border-subtle: #eaecf0;
  --focus: #2e90fa;
  --success: #027a48;
  --success-halo: #d1fadf;
  --error: #b42318;
  --error-bg: #fef3f2;
  --error-border: #fecdca;
  --info-bg: #f2f4f7;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); background: var(--canvas); }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1040px) / 2));
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -.4px;
  text-decoration: none;

  picture, img { display: block; }
  img { width: auto; max-width: 180px; height: 36px; object-fit: contain; object-position: left center; }
}

main { width: min(100% - 32px, 560px); margin: 76px auto 48px; }
.panel { padding: 36px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 12px; box-shadow: 0 2px 8px rgb(16 24 40 / 4%); }
h1 { margin: 0; font-size: 30px; line-height: 38px; font-weight: 600; letter-spacing: -.5px; }
.intro { margin: 8px 0 30px; color: var(--text-secondary); font-size: 16px; line-height: 24px; }
form { display: grid; gap: 22px; }
.field { display: grid; gap: 7px; }
label { font-size: 14px; line-height: 20px; font-weight: 600; }
input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
  font-size: 16px;
  box-shadow: 0 1px 2px rgb(16 24 40 / 5%);

  &::placeholder { color: var(--text-muted); opacity: .8; }
  &:hover { border-color: var(--text-muted); }
}

input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.hint { color: var(--text-muted); font-size: 13px; line-height: 18px; }

#submit-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  margin-top: 2px;
  padding: 0 18px;
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 7px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;

  &:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
  &:disabled { cursor: wait; opacity: .8; }
  svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
}

.spinner { display: none; width: 16px; height: 16px; border: 2px solid rgb(255 255 255 / 45%); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
form[aria-busy="true"] {
  .spinner { display: inline-block; }
  #submit-button svg { display: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.message { margin: 18px 0 0; padding: 12px 14px; border-radius: 7px; font-size: 14px; line-height: 20px; }
.message.error { color: var(--error); background: var(--error-bg); border: 1px solid var(--error-border); }
.message.info { color: var(--text-secondary); background: var(--info-bg); border: 1px solid var(--border-subtle); }
.result { margin-top: 24px; padding: 18px; background: var(--canvas); border: 1px solid var(--border); border-radius: 8px; }
.result-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.result h2 { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-halo); }
.result-link-row { display: flex; align-items: center; gap: 12px; }
.result-link-row a { min-width: 0; overflow-wrap: anywhere; color: var(--blue); font-size: 15px; line-height: 22px; text-underline-offset: 3px; }
.copy-button { flex: 0 0 auto; min-height: 36px; padding: 0 12px; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.copy-button:hover { background: var(--canvas); }
.expiry { margin: 12px 0 0; color: var(--text-muted); font-size: 13px; line-height: 18px; }
[hidden] { display: none !important; }

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #84adff;
    --blue-hover: #b2ccff;
    --text: #f2f4f7;
    --text-secondary: #c0c8d4;
    --text-muted: #98a2b3;
    --surface: #1d232e;
    --canvas: #131820;
    --border: #475467;
    --border-subtle: #303a49;
    --focus: #84caff;
    --success: #75e0a7;
    --success-halo: #064e3b;
    --error: #fda29b;
    --error-bg: #3b1b1b;
    --error-border: #7a271a;
    --info-bg: #252e3b;
  }

  #submit-button {
    color: #101828;
    background: #84adff;
    border-color: #84adff;

    &:hover { color: #101828; background: #b2ccff; border-color: #b2ccff; }
  }
  .spinner { border-color: rgb(16 24 40 / 35%); border-top-color: #101828; }
}

@media (max-width: 540px) {
  .topbar { height: 64px; padding: 0 20px; }
  .brand img { max-width: 160px; height: 32px; }
  main { width: min(100% - 24px, 560px); margin-top: 36px; }
  .panel { padding: 25px 20px; }
  h1 { font-size: 27px; line-height: 35px; }
  .intro { margin-bottom: 25px; }
  .result { padding: 15px; }
  .result-link-row { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media (prefers-color-scheme: dark) {
  .brand .light-logo-fallback { background: #fff; padding: 5px 8px; border-radius: 4px; }
}
