/* Inter (variable), self-hosted. SIL Open Font License 1.1 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter-cyrillic-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter-cyrillic-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(fonts/inter-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #0c0c0d;
  --border: #26262a;
  --border-strong: #3a3a40;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #1185fe;
  --accent-hover: #3d9bff;
  --error: #ff6b6b;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

main { width: 100%; max-width: 400px; }

.brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0 0 32px;
  text-align: center;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px;
}

h1 {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 8px;
}

.lead { color: var(--muted); margin: 0 0 28px; font-size: 15px; }

label {
  display: block;
  font-size: 14px;
  font-weight: 550;
  margin-bottom: 8px;
}

.field { position: relative; }

.field span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

input {
  width: 100%;
  height: 48px;
  padding: 0 14px 0 32px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #63636b; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(17 133 254 / .25); }
input:disabled { opacity: .6; }

.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background-color .15s, border-color .15s, opacity .15s;
}

.primary {
  width: 100%;
  height: 48px;
  margin-top: 24px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
}
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary:focus-visible, .secondary:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 3px; }
.primary:disabled { opacity: .6; cursor: progress; }

.secondary {
  height: 40px;
  padding: 0 16px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-size: 14px;
}
.secondary:hover { border-color: var(--muted); }

.error { color: var(--error); font-size: 14px; margin: 16px 0 0; }

.status { color: var(--muted); font-size: 14px; text-align: center; margin: 16px 0 0; }

.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.profile img { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--border); }
.profile .name { font-size: 18px; font-weight: 650; margin: 0; }
.profile .handle { color: var(--muted); font-size: 15px; margin: 0; }

.did {
  font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
  word-break: break-all;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 20px;
}

/* ---------- Signed-in view ---------- */

#session { display: grid; gap: 16px; }
#session .card { padding: 24px; }
#session .profile { margin-bottom: 16px; }
.profile-text { flex: 1; min-width: 0; }
.profile-text p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#session .did { margin: 0; }

h2 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}

.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row.spaced { margin-top: 18px; }
.optional { color: var(--muted); font-weight: 400; }
.count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.over { color: var(--error); }

input.plain { padding-left: 14px; }

textarea {
  width: 100%;
  min-height: 88px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  outline: none;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
textarea::placeholder { color: #63636b; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(17 133 254 / .25); }

#world-message { font-size: 14px; margin: 16px 0 0; }
#world-message.ok { color: #4ade80; }
#world-message.error { color: var(--error); }

.secondary.small { height: 34px; padding: 0 12px; font-size: 13px; flex-shrink: 0; }

.muted { color: var(--muted); font-size: 15px; margin: 0; }

.worlds { list-style: none; margin: 0; padding: 0; }
.worlds li {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.worlds li:first-child { border-top: 0; padding-top: 0; }
.worlds li > div { min-width: 0; }
.world-name { font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.world-description { color: var(--muted); font-size: 15px; margin: 4px 0 0; overflow-wrap: anywhere; white-space: pre-line; }
.world-meta { color: #63636b; font-size: 13px; margin: 6px 0 0; }

.worlds li { flex-direction: column; gap: 12px; }
.world-text { min-width: 0; width: 100%; }
.world-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.world-progress { font-size: 14px; color: var(--muted); margin: 8px 0 0; overflow-wrap: anywhere; }
.world-progress.error { color: var(--error); }

/* label / link styled as button */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background-color .15s, border-color .15s, opacity .15s;
}
.button.secondary { color: var(--text); border: 1px solid var(--border-strong); }
.button.disabled { opacity: .5; pointer-events: none; }
.primary.small { width: auto; height: 34px; margin: 0; padding: 0 14px; font-size: 13px; color: #fff; }
a.primary { background: var(--accent); }
a.primary:hover { background: var(--accent-hover); }
.secondary.danger:hover { border-color: var(--error); color: var(--error); }

footer { text-align: center; color: #63636b; font-size: 13px; margin-top: 24px; }
footer a { color: var(--muted); }

[hidden] { display: none !important; }
