/* MCBot – Handy-Version, "Amethyst-Geode" */

@font-face { font-family: 'Pixelify'; src: url('/fonts/pixelify-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Pixelify'; src: url('/fonts/pixelify-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('/fonts/figtree-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('/fonts/figtree-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('/fonts/figtree-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('/fonts/figtree-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --bg: #1C1A29;
  --bar: #18162A;
  --panel: #252236;
  --panel-2: #2E2A42;
  --line: #3A3552;
  --line-2: #4A4466;
  --text: #ECE8F7;
  --muted: #A39CBD;
  --faint: #6F6890;
  --accent: #B794F6;
  --accent-2: #9D72F0;
  --accent-ink: #1C1A29;
  --ok: #4FB8A3;
  --warn: #E9B949;
  --err: #E5534B;
  --meat: #C98A4B;
  --font: 'Figtree', -apple-system, system-ui, sans-serif;
  --pixel: 'Pixelify', 'Figtree', sans-serif;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  overflow: hidden;
}
input, textarea, select, button { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
svg { flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px calc(16px + var(--sr)) calc(24px + var(--sb)) calc(16px + var(--sl));
}

/* ---------- Knöpfe & Felder ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:active { background: var(--accent-2); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger-soft { background: rgba(229, 83, 75, .14); border-color: rgba(229, 83, 75, .45); color: #F4A39E; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: #F08A84; font-weight: 500; }
.btn-dashed { background: transparent; border: 1.5px dashed var(--line-2); color: var(--muted); width: 100%; min-height: 54px; margin-top: 12px; }
.btn-big { min-height: 52px; font-size: 16px; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.wide { width: 100%; }

.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--bar);
  font-size: 16px; /* verhindert das Hineinzoomen auf dem iPhone */
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus { border-color: var(--accent); }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23A39CBD' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
textarea.input { resize: vertical; }
.input.color { padding: 4px; height: 46px; }
.lbl { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px 2px; }
.desc { display: block; color: var(--faint); font-size: 13px; margin: 4px 2px 0; }
.err {
  background: rgba(229, 83, 75, .12);
  border: 1px solid rgba(229, 83, 75, .4);
  color: #F6B2AD;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin: 10px 0;
}

/* Schalter */
.sw {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 51px;
  height: 31px;
  border-radius: 99px;
  background: var(--line);
  position: relative;
  transition: background .2s;
  margin: 0;
}
.sw::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
  transition: transform .2s;
}
.sw:checked { background: var(--ok); }
.sw:checked::after { transform: translateX(20px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.toggle-row span { display: flex; flex-direction: column; }
.toggle-row small { color: var(--muted); font-size: 13px; }
.toggle-row.small { font-size: 15px; margin: 4px 0; }

/* ---------- Koppeln ---------- */

.pair { overflow-y: auto; }
.pair-inner {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
  padding: calc(48px + var(--st)) 24px calc(32px + var(--sb));
  text-align: center;
}
.pair-logo { width: 84px; height: 84px; border-radius: 20px; box-shadow: 0 10px 30px rgba(157, 114, 240, .25); }
.pair h1 { font-family: var(--pixel); font-weight: 600; font-size: 38px; margin-top: 14px; letter-spacing: .5px; }
.pair .lead { color: var(--muted); margin: 6px 0 26px; }
.pair form { text-align: left; }
.code-input {
  width: 100%;
  height: 72px;
  border-radius: 14px;
  border: 1.5px solid var(--line-2);
  background: var(--bar);
  text-align: center;
  font-family: var(--pixel);
  font-size: 38px;
  letter-spacing: 6px;
  outline: none;
}
.code-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(183, 148, 246, .18); }
.code-input::placeholder { color: var(--line-2); }
.sub { color: var(--faint); font-size: 13px; margin: 8px 2px 18px; }
.pair .btn-big { width: 100%; }
.hint {
  text-align: left;
  background: rgba(183, 148, 246, .1);
  border: 1px solid rgba(183, 148, 246, .35);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 15px;
}
.hint ol { margin: 8px 0 8px; padding-left: 20px; }
.hint li { margin: 4px 0; }
.hint small { color: var(--muted); font-size: 13px; display: block; }
.share-ico { vertical-align: -3px; color: #4C9BFF; }
.token-alt { margin-top: 28px; text-align: left; color: var(--muted); font-size: 14px; }
.token-alt summary { cursor: pointer; text-align: center; list-style: none; }
.token-alt summary::-webkit-details-marker { display: none; }
.token-alt form { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- Kopfzeile ---------- */

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(6px + var(--st)) calc(8px + var(--sr)) 6px calc(14px + var(--sl));
  min-height: calc(52px + var(--st));
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-family: var(--pixel); font-weight: 600; font-size: 24px; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--err); box-shadow: 0 0 0 3px rgba(229, 83, 75, .2); transition: background .3s; }
.conn-dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(79, 184, 163, .2); }
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 10px;
  color: var(--muted);
}
.icon-btn:active { background: var(--panel-2); }
.icon-btn-spacer { width: 44px; }
.back { margin-left: -8px; color: var(--accent); }
.d-title { flex: 1; text-align: center; font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner { background: rgba(233, 185, 73, .14); color: var(--warn); font-size: 14px; text-align: center; padding: 7px 12px; border-bottom: 1px solid rgba(233, 185, 73, .3); }

/* ---------- Liste ---------- */

.summary { color: var(--muted); font-size: 15px; margin: 4px 2px 10px; }
.summary b { color: var(--ok); font-family: var(--pixel); font-size: 20px; margin-right: 2px; }
.all-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.bot-list { display: flex; flex-direction: column; gap: 10px; }
.bot-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: transform .08s, background .15s;
}
.bot-card:active { transform: scale(.985); background: var(--panel-2); }
.head {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--panel-2);
  display: grid;
  place-items: center;
  font-family: var(--pixel);
  font-size: 22px;
  color: var(--accent);
}
.head img { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.bc-meta { flex: 1; min-width: 0; }
.bc-name { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-sub { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 2px; min-width: 0; }
.bc-srv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px 1px 7px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-2);
  color: var(--muted);
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.s-online { color: var(--ok); background: rgba(79, 184, 163, .14); }
.pill.s-connecting, .pill.s-queued, .pill.s-reconnecting { color: var(--warn); background: rgba(233, 185, 73, .13); }
.pill.s-error { color: var(--err); background: rgba(229, 83, 75, .13); }
.round {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
}
.round.go { background: rgba(79, 184, 163, .16); color: var(--ok); }
.round.stop { background: rgba(229, 83, 75, .14); color: var(--err); }
.round:active { transform: scale(.92); }
.vitals { display: flex; gap: 6px; margin-top: 7px; max-width: 180px; }
.vitals.big { max-width: none; margin-top: 8px; }
.bar { flex: 1; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.vitals.big .bar { height: 7px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .4s; }
.bar.hp i { background: var(--err); }
.bar.food i { background: var(--meat); }
.empty { color: var(--faint); text-align: center; padding: 36px 12px; font-size: 15px; }

/* ---------- Ein Bot ---------- */

.d-head { flex: none; padding: 14px calc(16px + var(--sr)) 12px calc(16px + var(--sl)); background: var(--bar); }
.dh-row { display: flex; gap: 14px; align-items: center; }
.dh-row .head { width: 64px; height: 64px; border-radius: 12px; }
.dh-meta { flex: 1; min-width: 0; }
.dh-name { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; }
.dh-srv { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tabs {
  flex: none;
  display: flex;
  gap: 4px;
  padding: 0 calc(12px + var(--sr)) 0 calc(12px + var(--sl));
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.tab {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 11px 0 12px;
  color: var(--muted);
  font-weight: 600;
  position: relative;
}
.tab.active { color: var(--text); }
.tab.active::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.d-body { padding-bottom: 16px; }

.chat-filter { display: flex; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 99px; padding: 5px 13px; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.log { font-size: 14.5px; line-height: 1.4; -webkit-user-select: text; user-select: text; }
.ll { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid rgba(58, 53, 82, .5); word-break: break-word; }
.ll time { flex: none; color: var(--faint); font-size: 12px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.ll.sent span { color: #D6C4FB; }
.ll .you { color: var(--accent); }
.ll.warn span { color: var(--warn); }
.ll.error span { color: #F08A84; }
.ll.info span { color: var(--muted); }

.chatbar {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 8px calc(12px + var(--sr)) calc(8px + var(--sb)) calc(12px + var(--sl));
  background: var(--bar);
  border-top: 1px solid var(--line);
}
.chatbar .input { min-height: 44px; border-radius: 22px; padding: 10px 16px; }
.send { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.send:active { transform: scale(.92); }

.note { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.act-group { margin-bottom: 18px; }
.act-group h3 { font-family: var(--pixel); font-weight: 600; font-size: 17px; color: var(--accent); margin: 0 2px 8px; }
.act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.act {
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-weight: 600;
  font-size: 14.5px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  line-height: 1.25;
}
.act:active { background: var(--panel-2); transform: scale(.97); }
.act:disabled { opacity: .4; }
.act.danger { color: #F4A39E; border-color: rgba(229, 83, 75, .35); }
.act .more { font-style: normal; color: var(--faint); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card h3 { font-size: 15px; margin-bottom: 8px; }
.card.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.card.grid small, .card.info small { display: block; color: var(--faint); font-size: 12px; }
.card.grid b { font-size: 15px; word-break: break-word; }
.card.info { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.near { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(58, 53, 82, .6); }
.near:last-child { border-bottom: 0; }
.near small { color: var(--muted); }

/* ---------- Bottom-Sheet ---------- */

.sheet-bg { position: fixed; inset: 0; background: rgba(8, 6, 16, .55); opacity: 0; transition: opacity .2s; z-index: 20; }
.sheet-bg.open { opacity: 1; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel);
  border-top: 1px solid var(--line-2);
  border-radius: 20px 20px 0 0;
  padding: 6px calc(18px + var(--sr)) calc(18px + var(--sb)) calc(18px + var(--sl));
  transform: translateY(100%);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
  z-index: 21;
}
.sheet.open { transform: none; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 12px; }
.sheet h2 { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.sheet .muted { margin-bottom: 12px; font-size: 15px; }
.sheet-form .pf { margin-bottom: 14px; }
.sheet-btns { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 18px; }
.row2 { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-row output { flex: none; min-width: 64px; text-align: right; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
input[type=range] { flex: 1; accent-color: var(--accent); height: 30px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span { display: inline-block; border: 1px solid var(--line-2); border-radius: 99px; padding: 6px 13px; font-size: 14px; color: var(--muted); }
.chip-check input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 34dvh; overflow-y: auto; background: var(--bar); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; }
.pick input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.pick .head { width: 26px; height: 26px; border-radius: 5px; font-size: 14px; }
.pick > span:not(.pill) { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.fav {
  flex: none;
  text-align: left;
  border: 1px solid var(--line-2);
  background: var(--bar);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  max-width: 200px;
}
.fav small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav.on { border-color: var(--accent); background: rgba(183, 148, 246, .12); }

.steps { padding-left: 22px; margin: 0 0 14px; color: var(--muted); }
.steps li { margin: 6px 0; }
.steps b { color: var(--text); }
.code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bar);
  border: 1px dashed var(--accent);
  border-radius: 14px;
  padding: 12px 12px 12px 18px;
  margin-bottom: 12px;
}
.code-box span { font-family: var(--pixel); font-size: 30px; letter-spacing: 3px; color: var(--accent); -webkit-user-select: all; user-select: all; }
.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); margin: 16px 0 0; font-size: 15px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-done { text-align: center; padding-top: 8px; }
.big-check { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: rgba(79, 184, 163, .16); color: var(--ok); display: grid; place-items: center; font-size: 32px; font-weight: 700; }

.menu-list { display: flex; flex-direction: column; background: var(--bar); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.menu-item { border: 0; background: transparent; text-align: left; padding: 14px 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.menu-item:last-child { border-bottom: 0; }
.menu-item:active { background: var(--panel-2); }
.menu-item.danger { color: #F08A84; }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + var(--sb));
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  width: max-content;
  padding: 11px 16px;
  border-radius: 12px;
  background: #F2EEFB;
  color: #1C1A29;
  font-weight: 600;
  font-size: 14.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 40;
  pointer-events: none;
  word-break: break-word;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--err); color: #fff; }

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