/* ================================================================ Opium
   Login — Apple liquid glass. Ambient colour washes sit behind a
   frosted card; light and dark share the same variables. Also owns the
   dark-mode tokens for this page (styles.css only ships light). */

:root {
  --ink-2: #3c3c3c;
  --bg-raise: #ffffff;
  --accent: #171717;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --good: #178252;
  --bad: #c22f35;
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-line: rgba(24, 24, 24, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.9);
}

html[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --bg-raise: #090909;
  --card: rgba(33, 33, 33, 0.55);
  --ink: #f0f0f0;
  --ink-2: #cfcfcf;
  --muted: #9b9ba4;
  --muted-2: #7b7b85;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #f4f4f4;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --good: #4cc38a;
  --bad: #e5646a;
  --glass: rgba(33, 33, 33, 0.55);
  --glass-strong: rgba(33, 33, 33, 0.72);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-line: rgba(255, 255, 255, 0.08);
  --glass-highlight: rgba(255, 255, 255, 0.07);
}

.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
html[data-theme='dark'] body.auth-body { background-color: var(--bg); }

/* ------------------------------------------------------- ambient washes */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.ambient span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
}
.ambient-a { width: 560px; height: 560px; top: -180px; left: -120px; background: rgba(24, 24, 24, 0.06); }
.ambient-b { width: 480px; height: 480px; bottom: -160px; right: -100px; background: rgba(24, 24, 24, 0.04); }
.ambient-c { width: 420px; height: 420px; top: 30%; left: 58%; background: rgba(24, 24, 24, 0.05); }
html[data-theme='dark'] .ambient-a { background: rgba(255, 255, 255, 0.1); }
html[data-theme='dark'] .ambient-b { background: color-mix(in srgb, var(--accent) 20%, transparent); }
html[data-theme='dark'] .ambient-c { background: rgba(255, 255, 255, 0.06); }

/* the mark is drawn light, so flip it on light backgrounds */
html:not([data-theme='dark']) .auth-mark,
html:not([data-theme='dark']) .brand img { filter: invert(1); }

/* ---------------------------------------------------------------- card */
.auth-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px 70px;
}

.auth-card {
  width: 100%;
  max-width: 412px;
  padding: 36px 34px 30px;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 2px 8px color-mix(in srgb, var(--accent) 6%, transparent),
    0 28px 70px -30px color-mix(in srgb, var(--accent) 30%, transparent);
  backdrop-filter: blur(30px) saturate(1.7);
  -webkit-backdrop-filter: blur(30px) saturate(1.7);
  text-align: center;
}

.auth-mark { margin: 0 auto 18px; }

.auth-card h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.auth-lede {
  margin: 8px 0 26px;
  font-size: 14px;
  color: var(--muted);
}

/* -------------------------------------------------------------- buttons */
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  border-radius: 16px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  text-decoration: none;
}
.auth-btn:hover { transform: translateY(-1px); }
.auth-btn:active { transform: translateY(0) scale(0.99); }

.auth-discord {
  background: linear-gradient(180deg, #6473f4, #4f5ae8);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 14px 30px -14px rgba(88, 101, 242, 0.9);
}
.auth-discord:hover { background: linear-gradient(180deg, #5865f2, #4752e8); }

.auth-local {
  background: var(--glass-strong);
  border-color: var(--glass-line);
  color: var(--ink);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.auth-local:hover {
  border-color: var(--line-strong);
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 10px 24px -16px color-mix(in srgb, var(--accent) 30%, transparent);
}
.auth-local[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* -------------------------------------------------------------- details */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted-2);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-error {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(226, 61, 67, 0.1);
  border: 1px solid rgba(194, 47, 53, 0.3);
  color: #a32222;
  font-size: 12.5px;
  line-height: 1.5;
}
html[data-theme='dark'] .auth-error {
  background: rgba(229, 72, 77, 0.16);
  border-color: rgba(229, 72, 77, 0.4);
  color: #ffb3b6;
}

.auth-foot {
  margin-top: 26px;
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
}

/* ---------------------------------------------------------- access key sign-in */

.auth-key { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.auth-key-label { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2); }

.auth-input {
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-raise);
  color: var(--ink);
  caret-color: var(--ink);
  font: inherit;
  font-size: 16px;
  letter-spacing: 0.08em;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input:hover { border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.auth-input:focus { border-color: color-mix(in srgb, var(--accent) 30%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.auth-input::placeholder { color: var(--muted); font-size: 12px; letter-spacing: normal; opacity: 1; }
.auth-input[aria-invalid='true'] { border-color: var(--bad); }
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 100px var(--bg-raise) inset;
  caret-color: var(--ink);
}
.auth-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@media (max-width: 480px) {
  .auth-main { padding: 28px 16px 40px; }
  .auth-card { padding: 28px 22px; border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-btn, .auth-input { transition: none; }
}

[hidden] { display: none !important; }

/* liquid glass II */
.auth-card { background-image: linear-gradient(180deg, var(--glass-highlight), transparent 38%); }
.ambient span { animation: ambient-float 26s ease-in-out infinite alternate; }
.ambient-b { animation-delay: -9s; }
.ambient-c { animation-delay: -17s; }
@keyframes ambient-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(42px, 26px, 0) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { .ambient span { animation: none; } }
.auth-input { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18); }
.auth-input:focus { box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.auth-discord { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 8px 22px -8px rgba(88, 101, 242, 0.55); }
