:root {
  --blue: #3b82f6;
  --indigo: #6366f1;
  --text: #eaf0f8;
  --muted: #9aa9c2;
  --field-bg: #2b3a52;
  --field-focus: #34455f;
  --border: #3d4d6a;
  --ok: #4ade80;
  --ok-bg: #173d27;
  --err: #fca5a5;
  --err-bg: #422020;
  --ring: rgba(96, 165, 250, 0.32);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 520px at 50% -8%, #3b4d6b 0%, transparent 62%),
    linear-gradient(180deg, #243149 0%, #1c2740 100%);
  background-attachment: fixed;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(env(safe-area-inset-top) + 18px) 22px
           calc(env(safe-area-inset-bottom) + 18px);
}

.card {
  width: 100%;
  max-width: 420px;
  margin: auto;
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* ---- header ---- */
.head { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; }
.logo-tile {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 100%);
  box-shadow: 0 8px 18px -6px rgba(99, 102, 241, 0.6);
}
.head-text h1 { font-size: 21px; margin: 0; letter-spacing: -0.02em; }
.head-text p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

/* ---- form ---- */
form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .field-label {
  font-weight: 600; font-size: 13px; color: var(--muted);
  letter-spacing: 0.01em;
}
.field small { font-weight: 400; opacity: 0.8; }

input[type="password"],
input[type="text"] {
  font-size: 17px; /* >=16px stops iOS auto-zoom */
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: var(--field-bg);
  color: var(--text);
  width: 100%;
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input::placeholder { color: #7e8ca6; }
input:focus {
  outline: none;
  background: var(--field-focus);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px var(--ring);
}

input[type="file"] {
  font-size: 14px; color: var(--muted);
  padding: 11px 12px;
  border: 1.5px dashed var(--border);
  border-radius: 13px;
  background: var(--field-bg);
  width: 100%;
}
input[type="file"]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 13px;
  margin-right: 10px; padding: 7px 12px;
  border: none; border-radius: 9px; cursor: pointer;
  color: #c7d2fe; background: #34406a;
}

/* ---- lettered-circle task-type toggle ---- */
.seg { display: flex; justify-content: center; gap: 26px; padding: 4px 0 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  cursor: pointer; user-select: none;
}
.circle {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 21px; font-weight: 700;
  color: var(--muted);
  background: var(--field-bg);
  border: 2px solid var(--border);
  transition: all 0.18s ease;
}
.cap { font-size: 12px; font-weight: 600; color: var(--muted); transition: color 0.18s; }
.seg label:active .circle { transform: scale(0.94); }

.seg input:checked + label .circle {
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 100%);
  border-color: transparent;
  box-shadow: 0 8px 18px -6px rgba(99, 102, 241, 0.75);
  transform: translateY(-1px);
}
.seg input:checked + label .cap { color: var(--text); }
.seg input:focus-visible + label .circle { box-shadow: 0 0 0 4px var(--ring); }

/* ---- send button ---- */
button#send {
  position: relative;
  margin-top: 6px;
  font-size: 17px; font-weight: 700; letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 100%);
  border: none; border-radius: 14px;
  padding: 16px; cursor: pointer;
  box-shadow: 0 12px 22px -10px rgba(59, 130, 246, 0.8);
  transition: transform 0.06s, box-shadow 0.2s, opacity 0.2s;
}
button#send:active { transform: translateY(1px) scale(0.99); }
button#send:disabled { cursor: progress; }
button#send.loading .btn-label { visibility: hidden; }
.spinner {
  display: none;
  position: absolute; top: 50%; left: 50%;
  width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
button#send.loading .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- status ---- */
.status {
  margin: 16px 0 0; padding: 0;
  font-size: 14.5px; font-weight: 600; text-align: center;
  min-height: 0; border-radius: 12px;
  transition: all 0.2s;
}
.status.ok, .status.err { padding: 12px 14px; }
.status.ok  { color: var(--ok);  background: var(--ok-bg); }
.status.err { color: var(--err); background: var(--err-bg); }
