:root {
  --bg: #0d1216;
  --bg-2: #121a20;
  --card: rgba(22, 31, 38, 0.78);
  --card-solid: #172027;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e9e4d8;
  --muted: #98a2a8;
  --accent: #e8a33d;
  --accent-2: #f3c26f;
  --accent-ink: #1a1206;
  --danger: #e5645a;
  --ok: #6fbf8a;
  --prio-high: #e5645a;
  --prio-low: #5f8fb3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Cinzel', 'Trajan Pro', Georgia, 'Times New Roman', serif;
  --topbar-h: 58px;
  --nav-h: 62px;
  --gutter: 24px;
}

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

[hidden] {
  display: none !important;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 163, 61, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(80, 140, 170, 0.14), transparent 60%),
    radial-gradient(800px 600px at 50% 120%, rgba(60, 110, 80, 0.14), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
}

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  margin: 0;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- Formularelemente ---------- */
label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.hint {
  font-size: 0.8rem;
  opacity: 0.8;
}

input,
select {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

select {
  cursor: pointer;
}

select option {
  background: var(--card-solid);
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.22);
}

.btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 0.08s, background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
}

.btn.primary:hover {
  filter: brightness(1.06);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn.ghost:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.btn.small {
  padding: 7px 12px;
  font-size: 0.875rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.icon-btn.danger:hover {
  color: var(--danger);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible {
  outline: none;
}

.stack {
  display: grid;
  gap: 14px;
}

.form-error {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.4em;
  margin: 12px 0 0;
}

.notice {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  background: rgba(232, 163, 61, 0.07);
  border-radius: 0 8px 8px 0;
}

/* ---------- Auth ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 28px 20px;
}

.brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand h1 {
  font-size: 2rem;
  margin: 6px 0 4px;
  background: linear-gradient(180deg, #fff3da, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-logo {
  display: block;
  margin: 0 auto 10px;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(232, 163, 61, 0.18);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.tab {
  font: inherit;
  font-weight: 600;
  padding: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--card-solid);
  color: var(--text);
  box-shadow: 0 1px 0 var(--border-strong) inset;
}

.tabs:has(.tab[hidden]) {
  grid-template-columns: 1fr;
}

/* ---------- App ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(13, 18, 22, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  height: var(--topbar-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.logo-icon {
  display: block;
  border-radius: 9px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: none;
}

/* Wer gerade im Spiel ist – mittig in der Menüleiste, seitlich wischbar */
.viking-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.viking-bar::-webkit-scrollbar {
  display: none;
}

.viking {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  white-space: nowrap;
}

/* mittig, aber bei Überlänge links beginnend (sonst wird vorne abgeschnitten) */
.viking:first-child {
  margin-left: auto;
}

.viking:last-child {
  margin-right: auto;
}

.viking.online {
  border-color: rgba(111, 191, 138, 0.4);
  background: rgba(111, 191, 138, 0.08);
}

.viking.idle,
.viking.offline {
  color: var(--muted);
}

.user-chip {
  font-size: 0.875rem;
  color: var(--muted);
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.progress-card {
  padding: 20px 22px;
}

.progress-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.progress-head h2 {
  font-size: 1.35rem;
}

.progress-pct {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s ease;
}

.add-form {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.add-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 10px;
}

.private-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  width: fit-content;
}

.private-toggle input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-select {
  width: auto;
  padding: 7px 10px;
  font-size: 0.875rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.segmented {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.segmented button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--card-solid);
  color: var(--accent-2);
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.chip {
  font: inherit;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.chip:hover {
  color: var(--text);
}

.chip.active {
  border-color: var(--accent);
  color: var(--accent-2);
  background: rgba(232, 163, 61, 0.1);
}

.chip-count {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0 7px;
  color: var(--text);
}

/* ---------- Liste ---------- */
.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.todo {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 14px;
  padding: 14px 12px 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius-sm);
  animation: pop 0.2s ease;
  transition: border-color 0.15s, opacity 0.2s;
}

.todo[data-prio='2'] {
  border-left-color: var(--prio-high);
}

.todo[data-prio='1'] {
  border-left-color: var(--accent);
}

.todo[data-prio='0'] {
  border-left-color: var(--prio-low);
}

.todo:hover {
  border-color: var(--border-strong);
}

.todo.done {
  opacity: 0.55;
}

.todo.done .todo-text {
  text-decoration: line-through;
  text-decoration-color: var(--muted);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

.check {
  display: block;
  position: relative;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  cursor: pointer;
}

.check input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.check .box {
  display: block;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 2px solid var(--border-strong);
  transition: background 0.15s, border-color 0.15s;
}

.check input:checked + .box {
  background: var(--ok);
  border-color: var(--ok);
}

.check input:checked + .box::after {
  content: '';
  display: block;
  width: 6px;
  height: 11px;
  margin: 3px 0 0 7px;
  border: solid #0d1216;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.check input:focus-visible + .box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.todo-body {
  min-width: 0;
}

.todo-text {
  display: block;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  cursor: text;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--muted);
}

.badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.badge.prio-2 {
  color: var(--prio-high);
  background: rgba(229, 100, 90, 0.12);
}

.badge.prio-0 {
  color: var(--prio-low);
  background: rgba(95, 143, 179, 0.14);
}

.todo-actions {
  display: flex;
  gap: 2px;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.todo:hover .todo-actions,
.todo:focus-within .todo-actions {
  opacity: 1;
}

.editor {
  display: grid;
  gap: 8px;
}

.editor-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.edit-input,
.edit-select {
  padding: 8px 10px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin: 0;
}

/* ---------- Personen & Zuweisung ---------- */
.todo.mine {
  background: linear-gradient(90deg, rgba(232, 163, 61, 0.09), var(--card) 45%);
}

.todo.private {
  border-style: dashed;
  border-left-style: solid;
}

.private-badge {
  color: var(--accent-2);
  background: rgba(232, 163, 61, 0.12);
}

.done-by {
  color: var(--ok);
}

.assignees {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px 2px 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
}

.person.me {
  background: rgba(232, 163, 61, 0.14);
  color: var(--accent-2);
}

.avatar {
  --hue: 30;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  color: #0d1216;
  background: hsl(var(--hue) 55% 62%);
}

.nobody {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.claim-btn {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.claim-btn:hover {
  color: var(--accent-2);
  border-color: var(--accent);
}

.claim-btn.active:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.assign-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px 10px;
  margin: 0;
}

.assign-picker legend {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 4px;
}

.assign-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.assign-option input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

.assign-option input:disabled + .person {
  opacity: 0.35;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Layout: Welt | Aufgaben | Chat (volle Breite) ---------- */
.layout {
  display: grid;
  align-items: start;
  gap: 20px;
  padding: 20px var(--gutter) 40px;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-areas: 'tasks chat';
}

.layout.with-side {
  grid-template-columns: 300px minmax(0, 1fr) 380px;
  grid-template-areas: 'world tasks chat';
}

.main-col {
  grid-area: tasks;
}

.side-col {
  grid-area: world;
}

.chat-col {
  grid-area: chat;
}

.main-col,
.side-col {
  display: grid;
  gap: 16px;
  min-width: 0;
}

/* Seitenspalten bleiben beim Scrollen stehen */
.side-col,
.chat-col {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
}

.side-col {
  max-height: calc(100dvh - var(--topbar-h) - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
}

/* ---------- Chat ---------- */
.chat-col {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - var(--topbar-h) - 40px);
  min-height: 360px;
  overflow: hidden;
}

.chat-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.chat-head h2 {
  font-size: 1.1rem;
}

.chat-list {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.chat-day {
  align-self: center;
  margin: 12px 0 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.msg {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  column-gap: 8px;
  max-width: 88%;
}

.msg.first {
  margin-top: 8px;
}

.msg .avatar {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
  grid-row: span 2;
  align-self: end;
}

.msg:not(.last) .avatar {
  visibility: hidden;
}

.msg-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0 0 2px 4px;
}

.msg-meta strong {
  color: var(--text);
  font-weight: 600;
}

.msg-bubble {
  padding: 7px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  width: fit-content;
  max-width: 100%;
  line-height: 1.4;
}

.msg-bubble a {
  color: var(--accent-2);
}

.msg.own {
  align-self: flex-end;
  grid-template-columns: minmax(0, 1fr);
}

.msg.own .avatar {
  display: none;
}

.msg.own .msg-meta strong {
  color: var(--accent-2);
}

.msg.own .msg-meta {
  justify-content: flex-end;
  margin: 0 4px 2px 0;
}

.msg.own .msg-bubble {
  justify-self: end;
  background: linear-gradient(180deg, rgba(243, 194, 111, 0.28), rgba(232, 163, 61, 0.22));
  border: 1px solid rgba(232, 163, 61, 0.3);
}

.msg:not(.first) .msg-meta {
  display: none;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.chat-form textarea {
  flex: 1;
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 9px 14px;
  resize: none;
  max-height: 140px;
  line-height: 1.4;
  outline: none;
}

.chat-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, 0.22);
}

.chat-send {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.chat-send svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* ---------- Handy-Navigation ---------- */
.bottom-nav {
  display: none;
}

.world-card {
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.world-card h2 {
  font-size: 1.1rem;
}

.small-text {
  font-size: 0.8rem;
}

.boss-count {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--accent-2);
}

.world-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.server-status {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
}

.server-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.server-players:empty {
  display: none;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--border-strong);
}

.status-dot.on {
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(111, 191, 138, 0.2);
}

.status-dot.down {
  background: var(--danger);
}

.boss-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.boss {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  opacity: 0.6;
}

.boss.defeated {
  opacity: 1;
  border-color: rgba(111, 191, 138, 0.45);
  background: rgba(111, 191, 138, 0.08);
}

.boss-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--border-strong);
}

.boss.defeated .boss-num {
  background: var(--ok);
  border-color: var(--ok);
  color: #0d1216;
}

.boss-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.boss-info small {
  color: var(--muted);
  white-space: nowrap;
}

.next-boss {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.auto-hint {
  flex-basis: 100%;
}

.platform {
  font-size: 0.72rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.platform.steam {
  color: #8fb8de;
  background: rgba(102, 192, 244, 0.12);
}

.platform.xbox {
  color: #8fd18f;
  background: rgba(16, 124, 16, 0.2);
}

.world-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* ---------- Dialog & Toast ---------- */
.dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card-solid);
  color: var(--text);
  padding: 24px;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
}

.dialog h2 {
  font-size: 1.3rem;
}

.dialog .form-error {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  background: var(--card-solid);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  border-color: var(--danger);
  color: #ffd6d2;
}

/* ---------- Tablet & Handy: ein Bereich, Umschalten über die Leiste unten ---------- */
@media (max-width: 1199px) {
  .layout,
  .layout.with-side {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: none;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  }

  .layout > [data-pane] {
    grid-area: auto;
  }

  .layout[data-tab='tasks'] > :not([data-pane='tasks']),
  .layout[data-tab='chat'] > :not([data-pane='chat']),
  .layout[data-tab='world'] > :not([data-pane='world']) {
    display: none;
  }

  .side-col {
    position: static;
    max-height: none;
    overflow: visible;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
  }

  .chat-col {
    position: static;
    height: calc(100dvh - var(--topbar-h) - var(--nav-h) - env(safe-area-inset-bottom) - 40px);
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: rgba(13, 18, 22, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }

  .bottom-nav button {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .bottom-nav button.active {
    color: var(--accent-2);
  }

  .bottom-nav button.active::before {
    content: '';
    position: absolute;
    top: 0;
    width: 36px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--accent);
  }

  .nav-icon {
    font-size: 1.3rem;
    line-height: 1;
  }

  .nav-badge {
    position: absolute;
    top: 6px;
    left: calc(50% + 8px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 0.7rem;
    line-height: 18px;
    text-align: center;
  }

  .toast {
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
  }
}

@media (max-width: 560px) {
  :root {
    --gutter: 12px;
  }

  .layout {
    padding-top: 12px;
    gap: 12px;
  }

  .topbar-inner {
    padding: 0 12px;
  }

  .logo-text,
  .viking .platform {
    display: none;
  }

  .topbar-inner {
    gap: 8px;
  }

  .progress-card,
  .world-card {
    padding: 16px;
  }

  .progress-head h2 {
    font-size: 1.15rem;
  }

  .progress-pct {
    font-size: 1.5rem;
  }

  .add-form {
    padding: 12px;
  }

  .chat-col {
    height: calc(100dvh - var(--topbar-h) - var(--nav-h) - env(safe-area-inset-bottom) - 24px);
    border-radius: var(--radius-sm);
  }

  .msg {
    max-width: 94%;
  }

  .add-row {
    grid-template-columns: 1fr 1fr;
  }

  .add-row .btn {
    grid-column: 1 / -1;
  }

  .toolbar-right {
    width: 100%;
    justify-content: space-between;
  }

  .user-chip {
    max-width: 120px;
  }

  .todo {
    gap: 10px;
    padding: 12px 8px 12px 12px;
  }

  .todo-actions {
    opacity: 1;
    flex-direction: column;
  }

  .editor-row {
    grid-template-columns: 1fr;
  }
}

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