:root {
  color-scheme: light;
  --text: #0f1419;
  --muted: #687280;
  --faint: #9aa2ad;
  --line: #e6e9ee;
  --field: #f3f5f8;
  --field-hover: #eceff3;
  --accent: #f2611d;
  --accent-hover: #df5512;
  --accent-soft: #fff0e7;
  --green: #16a34a;
  --red: #e5484d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 20, 25, 0.05), 0 14px 40px rgba(15, 20, 25, 0.12);
  --shadow-lg: 0 2px 6px rgba(15, 20, 25, 0.06), 0 24px 60px rgba(15, 20, 25, 0.22);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #c4def2;
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  isolation: isolate;
}
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }
:focus-visible { outline: 3px solid rgba(242, 97, 29, 0.45); outline-offset: 2px; }

/* ---------- backdrop: blurred blocky landscape ---------- */
.backdrop {
  position: fixed; left: -40px; top: -40px; z-index: -2;
  width: calc(100% + 80px); height: calc(100% + 80px);
  object-fit: cover;
  pointer-events: none;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 40%, rgba(255, 255, 255, 0.35) 100%);
}

/* ---------- titlebar ---------- */
.titlebar {
  position: relative; z-index: 2;
  height: 52px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.edition-switch {
  display: flex; gap: 2px; padding: 4px;
  background: rgba(255, 255, 255, 0.7); border-radius: 12px;
}
.edition-switch[hidden] { display: none; }
.edition-switch button {
  border: 0; background: transparent; padding: 5px 14px; border-radius: 9px;
  color: #3c4450; font-size: 13px; font-weight: 600;
}
.edition-switch button.is-active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

/* ---------- stage ---------- */
.stage {
  position: relative; z-index: 2;
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 0 24px 24px;
}
.brand { text-align: center; }
.brand-row { display: flex; align-items: center; justify-content: center; gap: 16px; }
.logo {
  width: 52px; height: 60px; display: block; flex: none;
  shape-rendering: crispEdges;
  filter: drop-shadow(0 4px 14px rgba(255, 120, 30, 0.35));
}
h1 {
  margin: 0; color: #fff;
  font: 800 64px/1 var(--font-display);
  letter-spacing: -0.055em;
  text-shadow: 0 4px 24px rgba(20, 40, 70, 0.3), 0 1px 2px rgba(20, 40, 70, 0.2);
}
.tagline {
  margin: 8px 0 0; color: #fff;
  font-size: 18px; font-weight: 600; letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgba(20, 40, 70, 0.35);
}

.panel {
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  box-shadow: var(--shadow);
  animation: rise-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.panel[hidden] { display: none; }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { color: var(--text); font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }

.input-wrap {
  display: flex; align-items: center; gap: 12px;
  height: 50px; padding: 0 8px 0 11px;
  background: var(--field); border: 1.5px solid transparent; border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.input-wrap:focus-within { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(242, 97, 29, 0.12); }
.input-wrap:focus-within:has(input:invalid) { border-color: var(--red); box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.12); }
.input-wrap input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent; font-size: 16px; font-weight: 500;
}
.input-wrap input::placeholder { color: var(--faint); }
.avatar {
  width: 28px; height: 28px; flex: none;
  border-radius: 6px; image-rendering: pixelated;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.pill {
  flex: none; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  background: #e9ecf0;
}

/* ---------- version picker ---------- */
.picker-wrap { position: relative; }
.picker {
  width: 100%; height: 50px;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--field); border: 1.5px solid transparent; border-radius: var(--radius);
  text-align: left; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.picker:hover { background: var(--field-hover); }
.picker[aria-expanded="true"] { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px rgba(242, 97, 29, 0.12); }
.picker-name { flex: 1 1 auto; min-width: 0; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chevron { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.2s; }
.picker[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.badge {
  flex: none; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge[hidden] { display: none; }
.badge.release { color: #15803d; background: #e7f7ec; }
.badge.snapshot { color: #b45309; background: #fef3dc; }
.badge.modded { color: #6d28d9; background: #f1ebfe; }
.badge.download { color: var(--accent); background: var(--accent-soft); }
.badge.legacy { color: #4b5563; background: #eef0f3; }

.menu {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 8px);
  padding: 10px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: top center;
}
.menu[hidden] { display: none; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu-search {
  width: 100%; height: 40px; padding: 0 12px; margin-bottom: 4px;
  background: var(--field); border: 1.5px solid transparent; border-radius: 11px; outline: 0; font-size: 14px;
}
.menu-search:focus { border-color: var(--accent); background: #fff; }
.menu-search::placeholder { color: var(--faint); }
.menu-list { position: relative; max-height: 248px; overflow-y: auto; scrollbar-width: thin; }
.menu-group {
  padding: 10px 12px 4px; color: var(--faint);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
}
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 0; border-radius: 11px; background: transparent; text-align: left;
}
.menu-item:hover, .menu-item.is-focused { background: var(--field); }
.menu-item .item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.menu-item .item-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .item-sub { color: var(--muted); font-size: 12px; }
.menu-item[aria-selected="true"] { background: var(--accent-soft); }
.menu-item[aria-selected="true"] .item-name { color: var(--accent); }
.item-icon { width: 14px; height: 14px; flex: none; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.item-icon.is-installed { stroke: var(--green); }
.item-icon.is-download { stroke: var(--faint); }
.menu-item:hover .item-icon.is-download { stroke: var(--text); }
.menu-tabs { display: flex; gap: 4px; padding: 6px 0 6px; overflow-x: auto; scrollbar-width: none; }
.menu-tab {
  flex: none; padding: 5px 11px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600;
}
.menu-tab:hover { color: var(--text); background: var(--field); }
.menu-tab[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.menu-empty { padding: 18px 10px; color: var(--muted); text-align: center; }

/* ---------- field extras ---------- */
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 24px; }
.field-value { font-size: 14px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.field-hint { color: var(--muted); font-size: 12.5px; }

.mini-switch { display: flex; gap: 2px; padding: 3px; background: var(--field); border-radius: 10px; }
.mini-switch button {
  border: 0; background: transparent; padding: 3px 11px; border-radius: 8px;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.mini-switch button:hover { color: var(--text); }
.mini-switch button[aria-checked="true"] { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

.input-wrap[hidden] { display: none; }
.account-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-name.is-empty { color: var(--faint); font-weight: 500; }
.small-button {
  flex: none; padding: 6px 12px; border-radius: 9px; border: 0;
  background: #fff; color: var(--text); font-size: 12.5px; font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.small-button:hover { background: #fafbfc; }
.account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.account-sub { color: var(--muted); font-size: 12px; }

/* Microsoft sign-in button: white, with the four-colour logo. */
.mc-button {
  width: 100%; height: 50px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--text);
  font-weight: 600; font-size: 15px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.mc-button[hidden] { display: none; }
.mc-button:hover { border-color: #d5dae1; box-shadow: 0 4px 14px rgba(15, 20, 25, 0.08); }
.mc-button:active { transform: translateY(1px); }
.mc-button.is-stone { height: 44px; border-color: transparent; background: var(--field); color: var(--muted); font-size: 14px; }
.mc-button.is-stone:hover { background: var(--field-hover); color: var(--text); box-shadow: none; }
.mc-button-logo { width: 20px; height: 20px; flex: none; display: grid; place-items: center; }
.mc-button-logo.is-large { width: 40px; height: 40px; }
.ms-mark { width: 100%; height: 100%; display: block; }

.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer;
}
.slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) var(--fill, 0%), #e3e7ec var(--fill, 0%));
}
.slider::-moz-range-track { height: 6px; border-radius: 999px; background: #e3e7ec; }
.slider::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.08);
}
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); }

.toggle-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  background: var(--field); border-radius: 16px;
  cursor: pointer;
}
.toggle-icon {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 11px; background: var(--accent-soft);
}
.toggle-icon svg { width: 18px; height: 18px; fill: var(--accent); }
.toggle-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toggle-title { font-weight: 700; font-size: 14.5px; }
.toggle-sub { color: var(--muted); font-size: 12.5px; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 46px; height: 28px; border-radius: 999px; position: relative; cursor: pointer;
  background: #d5dae1; transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

.cancel-link {
  align-self: center; margin-top: -8px; padding: 2px 10px; border: 0; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.cancel-link:hover { color: var(--text); text-decoration: underline; }
.cancel-link[hidden] { display: none; }

/* ---------- play ---------- */
.play {
  position: relative; overflow: hidden;
  height: 64px;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  border: 0; border-radius: 18px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(242, 97, 29, 0.35);
  transition: transform 0.12s, box-shadow 0.2s, background 0.2s;
}
.play::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: rgba(255, 255, 255, 0.22);
  transform-origin: left; transform: scaleX(var(--progress, 0));
  transition: transform 0.25s ease;
}
.play > * { position: relative; z-index: 1; }
.play:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 10px 28px rgba(242, 97, 29, 0.42); }
.play:active:not(:disabled) { transform: translateY(1px); }
.play:disabled { cursor: default; }
.play:disabled:not(.is-launching):not(.is-running) { background: #c9ced6; box-shadow: none; }

.play-icon { width: 28px; height: 28px; flex: none; display: grid; place-items: center; }
.play-icon svg { width: 22px; height: 22px; fill: currentColor; }
.play-text { display: flex; flex-direction: column; align-items: flex-start; }
.play-label { font: 700 20px/1.1 var(--font-display); letter-spacing: -0.02em; }
.play-sub { font-size: 12.5px; font-weight: 500; opacity: 0.85; }

.play.is-launching { background: #e8763f; }
.play.is-launching .play-icon svg { display: none; }
.play.is-launching .play-icon::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.play.is-running { background: var(--green); box-shadow: 0 8px 22px rgba(22, 163, 74, 0.35); }
.play.is-running .play-icon svg { display: none; }
.play.is-running .play-icon::before {
  content: ""; width: 12px; height: 12px; border-radius: 50%; background: currentColor;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: scale(0.6); opacity: 0.5; } }

/* Ely.by */
.ely-mark {
  width: 20px; height: 20px; flex: none;
  display: grid; place-items: center;
  border-radius: 6px; background: #207e5c; color: #fff;
  font: 800 13px/1 var(--font-display);
}
.ely-mark.is-large { width: 40px; height: 40px; border-radius: 11px; font-size: 24px; }
.ely-modal { gap: 14px; }
.ely-fields { display: grid; gap: 10px; align-self: stretch; }
.ely-fields .input-wrap { cursor: text; }
.ely-fields input { text-align: left; }
.modal-error { margin: -2px 0 0; color: var(--red); font-size: 13px; font-weight: 500; }
.modal-error[hidden] { display: none; }
.primary-button {
  align-self: stretch; height: 50px; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 18px rgba(242, 97, 29, 0.3);
  transition: background 0.15s;
}
.primary-button:hover:not(:disabled) { background: var(--accent-hover); }
.primary-button:disabled { opacity: 0.7; cursor: default; }
.modal-links { display: flex; justify-content: space-between; align-self: stretch; }
.link-button { border: 0; background: none; padding: 4px 2px; color: var(--muted); font-size: 13px; font-weight: 600; }
.link-button:hover { color: var(--text); text-decoration: underline; }
#ely-register { color: #207e5c; }

/* ---------- bedrock ---------- */
.bedrock-status { display: flex; align-items: center; gap: 10px; color: #3c4450; font-weight: 500; padding: 4px 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.dot.ok { background: var(--green); box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.15); }

/* ---------- footer & toast ---------- */
.footer {
  position: relative; z-index: 1; flex: none;
  display: flex; justify-content: center;
  padding: 0 24px 14px;
}
.footer span:not(:empty) {
  max-width: 100%; padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #3c4450; font-size: 12px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: 52px;
  max-width: min(560px, calc(100vw - 48px));
  padding: 12px 18px; border-radius: 14px;
  background: #fff; box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500; line-height: 1.45;
  user-select: text; -webkit-user-select: text;
  transform: translateX(-50%);
  animation: toast-in 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast[hidden] { display: none; }
.toast.error { box-shadow: var(--shadow-lg), inset 3px 0 0 var(--red); }
.toast.error::before { content: "⚠︎ "; color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- sign-in modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center; padding: 24px;
  background: rgba(15, 20, 25, 0.35);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade 0.2s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 380px; padding: 26px 24px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
  background: #fff; border-radius: 24px;
  box-shadow: var(--shadow-lg);
  animation: rise-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal h2 { margin: 0; font: 700 22px/1.2 var(--font-display); letter-spacing: -0.03em; }
.mc-modal-head { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mc-modal-body { display: flex; flex-direction: column; align-items: center; gap: 12px; align-self: stretch; }
.mc-modal-body[hidden] { display: none; }
.modal-text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.device-code-hint { margin-top: -6px; color: var(--faint); font-size: 12px; }
.device-code {
  margin: 2px 0; padding: 14px 22px; border-radius: 14px;
  border: 1.5px dashed #d5dae1; background: var(--field); color: var(--text);
  font: 700 28px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: 0.14em;
}
.device-code:hover { border-color: var(--accent); background: var(--accent-soft); }
.modal-status { margin: 2px 0 0; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.spinner {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid #e3e7ec; border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@media (max-height: 760px) {
  .stage { gap: 18px; }
  .logo { width: 40px; height: 46px; }
  h1 { font-size: 50px; }
  .tagline { display: none; }
  .panel { gap: 14px; padding: 18px 20px; }
}

@media (max-height: 640px) {
  .stage { gap: 14px; }
  h1 { font-size: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
