:root {
  --bg: #f4f7ec;
  --surface: #ffffff;
  --surface-soft: #f7f9f2;
  --ink: #1e293b;
  --ink-muted: #64748b;
  --border: #dce5d1;

  --asphalt: #454954;
  --asphalt-dark: #353942;
  --road-yellow: #f7ca45;
  --grass: #6ec035;
  --grass-dark: #4f9e20;
  --curb: #e6d7c3;
  --curb-border: #bda992;

  --primary: #1f8a4c;
  --primary-hover: #17723d;
  --secondary: #2563eb;
  --secondary-hover: #1d4ed8;
  --accent: #f59e0b;
  --danger: #dc2626;
  --danger-soft: #fee2e2;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 18px 48px rgba(15, 23, 42, 0.22);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

#app {
  width: 100%;
  min-height: 100%;
}

.view {
  display: none;
  min-height: 100vh;
}

.view.active {
  display: flex;
  flex-direction: column;
}

.view--fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--ink-muted);
}

.small {
  font-size: 0.84rem;
}

.spacer {
  flex: 1;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--lg {
  padding: 14px 26px;
  font-size: 1.05rem;
  border-radius: 14px;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.84rem;
  border-radius: 9px;
}

.btn--primary {
  background: linear-gradient(180deg, #27a35b 0%, var(--primary) 100%);
  color: #fff;
  box-shadow: 0 4px 0 #135a30, 0 6px 14px rgba(31, 138, 76, 0.28);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #2bb564 0%, var(--primary-hover) 100%);
}

.btn--secondary {
  background: linear-gradient(180deg, #3b82f6 0%, var(--secondary) 100%);
  color: #fff;
  box-shadow: 0 4px 0 #1e40af, 0 6px 14px rgba(37, 99, 235, 0.24);
}

.btn--secondary:hover:not(:disabled) {
  background: linear-gradient(180deg, #4b8ff7 0%, var(--secondary-hover) 100%);
}

.btn--ghost {
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--border);
}

.btn--ghost:hover:not(:disabled) {
  background: #f1f5eb;
  border-color: #c2d1b2;
}

.btn--danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border: 2px solid #fecaca;
}

.btn--danger-soft:hover:not(:disabled) {
  background: #fecaca;
}

/* ==================== 1. STARTSIDAN ==================== */
#view-home {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  background: radial-gradient(circle at top, #e7f6d5 0%, #d2ecba 50%, #bddf9c 100%);
  overflow: hidden;
}

.home-bg-roads {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, transparent 46%, rgba(69, 73, 84, 0.08) 46%, rgba(69, 73, 84, 0.08) 54%, transparent 54%),
    linear-gradient(0deg, transparent 46%, rgba(69, 73, 84, 0.08) 46%, rgba(69, 73, 84, 0.08) 54%, transparent 54%);
  background-size: 260px 260px;
  pointer-events: none;
}

.home-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.home-hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.home-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid #a9cf82;
  color: #2f5d15;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 5px 14px;
  border-radius: 999px;
}

.home-title {
  margin: 0;
  font-size: clamp(2.8rem, 7vw, 4.4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #1e293b;
  text-shadow: 0 3px 0 rgba(255, 255, 255, 0.9);
}

.home-title span {
  color: #1f8a4c;
}

.home-subtitle {
  margin: 0;
  max-width: 580px;
  font-size: 1.08rem;
  line-height: 1.5;
  color: #334155;
}

.home-preview-strip {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 720px;
}

.home-preview-strip img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.18));
  transition: transform 0.2s ease;
}

.home-preview-strip img:hover {
  transform: translateY(-5px) scale(1.05);
}

.home-actions {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.hero-card {
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 24px 22px;
  border-radius: var(--radius-lg);
  border: 3px solid transparent;
  background: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  font-family: inherit;
}

.hero-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.hero-card--create {
  border-color: #93c5fd;
}

.hero-card--create:hover {
  border-color: #2563eb;
}

.hero-card--play {
  border-color: #86efac;
}

.hero-card--play:hover {
  border-color: #1f8a4c;
}

.hero-card__icon {
  font-size: 2.5rem;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-card--create .hero-card__icon {
  background: #dbeafe;
}

.hero-card--play .hero-card__icon {
  background: #dcfce7;
}

.hero-card__content h2 {
  margin: 0 0 6px;
  font-size: 1.45rem;
  color: var(--ink);
}

.hero-card__content p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.4;
  color: var(--ink-muted);
}

.hero-card__arrow {
  font-size: 1.5rem;
  font-weight: 900;
  color: #94a3b8;
  margin-left: auto;
}

.lan-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.88);
  color: #f8fafc;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-sm);
}

.lan-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

/* ==================== PANEL PAGES (BUILDER SELECT & PLAY SETUP) ==================== */
.panel-page {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px 18px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.panel-header h1 {
  margin: 0;
  font-size: 1.7rem;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.create-new-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #eff8e8 100%);
  border: 2px solid #b8db98;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
}

.create-new-banner h2 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}

.create-new-banner p {
  margin: 0;
  color: var(--ink-muted);
}

.section-label {
  margin: 6px 0 0;
  font-size: 1rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.town-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.town-card-grid--single {
  grid-template-columns: 1fr;
}

.town-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.town-card:hover {
  border-color: #86efac;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.town-card.selected {
  border-color: var(--primary);
  background: #f0fdf4;
  box-shadow: 0 0 0 3px rgba(31, 138, 76, 0.2);
}

.town-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.town-card__title {
  margin: 0;
  font-size: 1.15rem;
}

.town-card__meta {
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.town-card__mini-preview {
  display: grid;
  grid-template-columns: repeat(3, 32px);
  grid-template-rows: repeat(3, 32px);
  gap: 4px;
  background: var(--asphalt);
  padding: 5px;
  border-radius: 10px;
  width: fit-content;
}

.mini-cell {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background: #84c94b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mini-cell--torg {
  background: #e9d9bd;
  font-size: 0.7rem;
  font-weight: 800;
  color: #6b5336;
}

.mini-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.town-card__actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

/* ==================== 2. KARTBYGGAREN ==================== */
#view-builder {
  height: 100vh;
  overflow: hidden;
  background: #e9f0df;
}

.builder-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  background: #ffffff;
  border-bottom: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  z-index: 5;
}

.builder-topbar__left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 240px;
}

.town-name-field {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 360px;
}

.town-name-field span {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
}

.town-name-field input {
  width: 100%;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  font-family: inherit;
}

.town-name-field input:focus {
  outline: none;
  border-color: var(--primary);
}

.builder-topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.builder-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  overflow: hidden;
}

.builder-sidebar {
  background: #fff;
  border-right: 2px solid var(--border);
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-header h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.sidebar-header p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-muted);
  line-height: 1.4;
}

.building-palette {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.palette-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-soft);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.palette-card.selected-for-tap {
  border-color: var(--primary);
  background: #ecfdf5;
  box-shadow: 0 0 0 3px rgba(31, 138, 76, 0.2);
}

.palette-drag-handle {
  position: relative;
  width: 82px;
  height: 82px;
  flex-shrink: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2ebd6;
}

.palette-drag-handle:active {
  cursor: grabbing;
}

.palette-drag-handle img {
  width: 78px;
  height: 78px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.18));
}

.q-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: #64748b;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.q-badge--active {
  background: var(--primary);
}

.palette-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.palette-info h3 {
  margin: 0;
  font-size: 1rem;
}

.palette-theme {
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.3;
}

.palette-quiz-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.palette-actions {
  margin-top: 4px;
  display: flex;
  gap: 6px;
}

/* 3x3-kartan till höger med färdiga asfaltsvägar, gul mittlinje, övergångsställen & trottoarer */
.builder-map-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  gap: 10px;
}

.builder-map-hint {
  font-size: 0.88rem;
  color: #475569;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.8);
  padding: 6px 14px;
  border-radius: 999px;
}

.builder-board-frame {
  background: var(--asphalt);
  padding: 24px;
  border-radius: 24px;
  box-shadow: var(--shadow-lg), inset 0 0 0 3px #2e323b;
  position: relative;
}

.builder-grid {
  --grid-gap: 34px;
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 168px));
  grid-template-rows: repeat(3, minmax(112px, 168px));
  gap: var(--grid-gap);
}

/* Färdiga asfaltsvägar med streckad gul mittlinje */
.road-stripe-h {
  position: absolute;
  left: -14px;
  right: -14px;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--road-yellow) 0 14px,
    transparent 14px 26px
  );
  pointer-events: none;
  z-index: 1;
}

.road-stripe-v {
  position: absolute;
  top: -14px;
  bottom: -14px;
  width: 4px;
  background: repeating-linear-gradient(
    180deg,
    var(--road-yellow) 0 14px,
    transparent 14px 26px
  );
  pointer-events: none;
  z-index: 1;
}

/* Övergångsställen vid korsningarna */
.crosswalk {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.crosswalk--h {
  width: 24px;
  height: 12px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.88) 0 4px, transparent 4px 8px);
}

.crosswalk--v {
  width: 12px;
  height: 24px;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0 4px, transparent 4px 8px);
}

.plot-cell {
  position: relative;
  z-index: 3;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 30%, #86d349 0%, #68b831 100%);
  border: 6px solid var(--curb);
  box-shadow: 0 0 0 2px var(--curb-border), inset 0 2px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  cursor: pointer;
  user-select: none;
}

.plot-cell--empty::after {
  content: '+ Välj hus';
  font-size: 0.78rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.94);
  background: rgba(34, 84, 18, 0.44);
  padding: 4px 10px;
  border-radius: 999px;
}

.plot-cell--drop-target {
  transform: scale(1.04);
  box-shadow: 0 0 0 4px #facc15, 0 0 24px rgba(250, 204, 21, 0.65);
}

.plot-cell--torg {
  cursor: default;
  background: radial-gradient(circle at center, #f4e8d1 0%, #e1cfa9 100%);
  border: 6px solid var(--curb);
}

.torg-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: center;
}

.torg-fountain {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle, #7dd3fc 0%, #0284c7 75%, #cbd5e1 76%, #cbd5e1 100%);
  border: 3px solid #94a3b8;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.7);
}

.torg-label {
  font-weight: 900;
  font-size: 0.92rem;
  color: #5c4529;
  background: rgba(255, 255, 255, 0.75);
  padding: 2px 10px;
  border-radius: 999px;
}

.plot-cell--occupied {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.plot-cell--occupied img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.28));
}

.plot-cell--occupied:hover {
  transform: scale(1.03);
}

.plot-quiz-pill {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 92%;
  background: rgba(20, 83, 45, 0.92);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid #facc15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.drag-ghost {
  position: fixed;
  z-index: 9999;
  width: 104px;
  height: 104px;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(1.08);
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.35));
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* ==================== 3. QUIZ-EDITOR MODAL ==================== */
.overlay-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.overlay-backdrop--top {
  z-index: 140;
}

.editor-modal {
  background: #fff;
  width: 100%;
  max-width: 1080px;
  max-height: 92vh;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 2px solid var(--border);
  background: var(--surface-soft);
}

.editor-header__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editor-thumb {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.editor-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.editor-header p {
  margin: 2px 0 0;
  font-size: 0.86rem;
}

.icon-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
}

.icon-close:hover {
  background: #f1f5f9;
}

.editor-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
}

.editor-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow: hidden;
}

.editor-name-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 220px;
}

.field span {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.field input {
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
}

.editor-columns {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.95fr);
  gap: 16px;
  min-height: 0;
  overflow: hidden;
}

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

.editor-columns.bank-hidden .editor-bank-col {
  display: none;
}

.editor-questions-col,
.editor-bank-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  overflow: hidden;
}

.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #eef4e5;
  border-bottom: 1px solid var(--border);
}

.col-header h3 {
  margin: 0;
  font-size: 0.96rem;
}

.qe-question-list,
.qe-bank-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.q-editor-card {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.q-editor-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.q-editor-num {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--primary);
}

.q-editor-input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.94rem;
  font-weight: 600;
  font-family: inherit;
}

.q-editor-input:focus {
  outline: none;
  border-color: var(--primary);
}

.q-options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.q-opt-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  padding: 5px 8px;
  border-radius: 8px;
  border: 2px solid #e2e8f0;
}

.q-opt-row.is-correct {
  background: #ecfdf5;
  border-color: #22c55e;
}

.q-opt-row input[type='radio'] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.q-opt-row input[type='text'] {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 0.88rem;
  font-family: inherit;
}

.q-opt-row input[type='text']:focus {
  outline: none;
}

.bank-item {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bank-item--added {
  border-color: #86efac;
  background: #f0fdf4;
}

.bank-item__text {
  font-size: 0.9rem;
  font-weight: 700;
}

.bank-item__ans {
  font-size: 0.8rem;
  color: var(--ink-muted);
}

.bank-item__foot {
  display: flex;
  justify-content: flex-end;
}

.editor-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-top: 2px solid var(--border);
  background: var(--surface-soft);
}

/* ==================== 4. VÄLJ SPELARE, AVATAR & STAD ==================== */
.panel-page {
  max-width: 1180px;
}

.play-setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.avatar-designer {
  display: grid;
  grid-template-columns: 206px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 2px solid var(--border);
}

.avatar-preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.avatar-stage {
  width: 100%;
  height: 192px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #e0f2fe 65%, #bbf7d0 100%);
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -10px 24px rgba(15, 23, 42, 0.06);
}

.avatar-stage-btns {
  display: flex;
  gap: 8px;
  width: 100%;
}

.avatar-stage-btns .btn {
  flex: 1;
}

.personal-quiz-box {
  width: 100%;
  background: #ffffff;
  border: 2px solid #86efac;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.personal-quiz-box__head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pq-icon {
  font-size: 1.4rem;
}

.avatar-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 410px;
  overflow-y: auto;
  padding-right: 4px;
}

.av-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.av-group-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.av-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.av-chip {
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}

.av-chip:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.av-chip.active {
  border-color: var(--primary);
  background: #dcfce7;
  color: #14532d;
}

.av-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.av-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(15, 23, 42, 0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.av-swatch:hover {
  transform: scale(1.1);
}

.av-swatch.active {
  border-color: #0f172a;
  box-shadow: 0 0 0 3px #4ade80;
  transform: scale(1.1);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-row-avatar {
  width: 40px;
  height: 44px;
  border-radius: 10px;
  background: #e0f2fe;
  flex-shrink: 0;
}

.player-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.player-row-quiz-tag {
  font-size: 0.78rem;
  color: var(--primary);
  font-weight: 700;
}

.editor-modal--narrow {
  max-width: 760px;
}

.pq-modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #dcfce7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.q-mode-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.q-mode-btn {
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 8px;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.q-mode-btn.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #ffffff;
}

.entrance-avatar {
  width: 128px;
  height: 136px;
  border-radius: 18px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #e0f2fe 70%, #dcfce7 100%);
  border: 2px solid #cbd5e1;
}

.setup-column {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.step-heading {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.new-player-box {
  display: flex;
  gap: 8px;
}

.new-player-box input {
  flex: 1;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
}

.new-player-box input:focus {
  outline: none;
  border-color: var(--primary);
}

.selected-banner {
  background: #dcfce7;
  border: 2px solid #4ade80;
  color: #14532d;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.95rem;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.player-row {
  text-align: left;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.player-row:hover {
  border-color: #86efac;
  background: #f7fee7;
}

.player-row.selected {
  border-color: var(--primary);
  background: #dcfce7;
  font-weight: 700;
}

.play-setup-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ==================== 5. SPELBAR STAD (CANVAS + HUD) ==================== */
#city-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--asphalt-dark);
}

.city-hud-top {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.city-hud-left,
.city-hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  flex-wrap: wrap;
}

.hud-btn {
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  font-family: inherit;
}

.hud-btn:hover {
  background: rgba(15, 23, 42, 0.92);
}

.city-pill {
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.city-pill .sep {
  opacity: 0.5;
}

.online-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 8px #4ade80;
}

.hud-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.hud-icon-btn:hover {
  background: rgba(15, 23, 42, 0.95);
}

/* Q Power-stapel till vänster i bild */
.qpower-wrap {
  position: fixed;
  left: 14px;
  top: 50%;
  transform: translateY(-58%);
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 9px 8px;
  background: rgba(15, 23, 42, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
  pointer-events: none;
  transition: transform 0.18s ease, border-color 0.2s ease;
}

.qpower-wrap.qpower-up {
  border-color: #4ade80;
  animation: qpowerPop 0.42s ease;
}

.qpower-wrap.qpower-down {
  border-color: #f87171;
  animation: qpowerShake 0.36s ease;
}

.qpower-label {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  color: #1e293b;
  font-size: 1.08rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
}

.qpower-bar {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  width: 24px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.65);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.qpower-seg {
  width: 100%;
  height: 6.5px;
  border-radius: 2.5px;
  background: rgba(255, 255, 255, 0.13);
  transition: background-color 0.22s ease, box-shadow 0.22s ease, transform 0.2s ease;
}

.qpower-seg.filled-low {
  background: #f97316;
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.6);
}

.qpower-seg.filled-mid {
  background: #facc15;
  box-shadow: 0 0 7px rgba(250, 204, 21, 0.65);
}

.qpower-seg.filled-high {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.75);
}

.qpower-seg.filled-max {
  background: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.9);
}

.qpower-val {
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.88);
  font-variant-numeric: tabular-nums;
}

@keyframes qpowerPop {
  0% { transform: translateY(-58%) scale(1); }
  45% { transform: translateY(-58%) scale(1.1); }
  100% { transform: translateY(-58%) scale(1); }
}

@keyframes qpowerShake {
  0%, 100% { transform: translateY(-58%) translateX(0); }
  25% { transform: translateY(-58%) translateX(-4px); }
  75% { transform: translateY(-58%) translateX(4px); }
}

/* Minikarta nere till vänster */
.minimap-wrap {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 20;
  padding: 6px;
  background: rgba(15, 23, 42, 0.84);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
}

#minimap-canvas {
  display: block;
  width: 152px;
  height: 152px;
  border-radius: 10px;
}

/* Joystick nere till höger */
.joystick-zone {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  width: 144px;
  height: 144px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}

.joystick-zone:active {
  cursor: grabbing;
}

.joystick-base {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.45);
  border: 3px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32), inset 0 0 18px rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(4px);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  margin-top: -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffff 0%, #dbeafe 55%, #93c5fd 100%);
  border: 3px solid #1e293b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* ==================== 6. ENTRANCE & QUIZ PLAY MODALS ==================== */
.dialog-card {
  background: #fff;
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  border: 3px solid #e2e8f0;
}

.entrance-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.entrance-thumb {
  width: 112px;
  height: 112px;
  object-fit: contain;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.entrance-meta h2 {
  margin: 6px 0 4px;
  font-size: 1.45rem;
}

.entrance-meta p {
  margin: 0;
}

.entrance-prompt {
  margin: 4px 0 6px;
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--ink);
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
}

.dialog-actions .btn {
  flex: 1;
}

.quiz-play-card {
  max-width: 650px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 22px;
}

.qp-header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qp-points-pill {
  background: #fef9c3;
  border: 2px solid #facc15;
  color: #854d0e;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.96rem;
  font-variant-numeric: tabular-nums;
}

/* Media i fråga (bild, pixlad canvas, ljud) */
.qp-media-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.qp-image,
.qp-pixel-canvas {
  max-width: 100%;
  max-height: 270px;
  border-radius: 14px;
  border: 3px solid #cbd5e1;
  background: #0f172a;
  object-fit: contain;
  box-shadow: var(--shadow-sm);
}

.qp-pixel-canvas {
  image-rendering: pixelated;
}

.qp-audio-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border: 2px solid #93c5fd;
  border-radius: 16px;
}

.qp-audio-el {
  width: 100%;
  max-width: 420px;
  height: 38px;
}

/* Snabbhetspoäng-panel & Svara-knapp */
.qp-speed-panel {
  background: #fffbeb;
  border: 2px solid #fcd34d;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qp-speed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 700;
  color: #92400e;
}

.qp-live-points {
  font-size: 1.25rem;
  font-weight: 900;
  color: #b45309;
  font-variant-numeric: tabular-nums;
}

.qp-speed-bar {
  height: 10px;
  border-radius: 999px;
  background: #fde68a;
  overflow: hidden;
}

.qp-speed-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 45%, #22c55e 100%);
  transition: width 0.1s linear;
}

.qp-svara-btn {
  width: 100%;
  margin-top: 2px;
  font-size: 1.15rem;
}

/* Rätt ordning – växande grön ruta + ord nedanför */
.qp-order-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-green-box {
  background: linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
  border: 3px solid #16a34a;
  border-radius: 18px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.2s ease;
}

.order-edge-label {
  text-align: center;
  font-size: 0.84rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #14532d;
  background: rgba(255, 255, 255, 0.72);
  padding: 4px 10px;
  border-radius: 999px;
  align-self: center;
}

.order-placed-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 28px;
}

.order-empty-hint {
  text-align: center;
  font-size: 0.84rem;
  color: #166534;
  opacity: 0.8;
  padding: 4px 0;
}

.order-placed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 2px solid #22c55e;
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 800;
  font-size: 0.96rem;
  color: #14532d;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.14);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.order-placed-item:active {
  cursor: grabbing;
}

.order-placed-item.is-dragging,
.order-word-chip.is-dragging {
  opacity: 0.3;
  transform: scale(0.96);
}

.order-green-box.is-drop-active {
  border-color: #facc15;
  box-shadow: 0 0 0 4px rgba(250, 204, 21, 0.45), inset 0 0 18px rgba(34, 197, 94, 0.22);
}

.order-drop-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 2.5px dashed #15803d;
  background: rgba(254, 240, 138, 0.92);
  color: #14532d;
  font-size: 0.9rem;
  font-weight: 900;
  box-shadow: 0 2px 10px rgba(21, 128, 61, 0.2);
  animation: dropPulse 0.7s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes dropPulse {
  from { transform: scale(0.99); background: rgba(254, 240, 138, 0.85); }
  to { transform: scale(1.015); background: rgba(254, 240, 138, 1); }
}

.order-pool-wrap.pool-drop-active {
  background: #fef3c7;
  border: 2px dashed #f59e0b;
  border-radius: 12px;
  padding: 8px;
}

.order-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-2deg) scale(1.06);
  padding: 10px 18px;
  border-radius: 12px;
  background: #14532d;
  color: #fef08a;
  border: 2.5px solid #facc15;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.35);
  white-space: nowrap;
}

.order-drag-grip {
  color: #86efac;
  font-size: 1rem;
  line-height: 1;
  user-select: none;
}

.order-placed-item.result-right {
  background: #dcfce7;
  border-color: #15803d;
  color: #14532d;
}

.order-placed-item.result-wrong {
  background: #fee2e2;
  border-color: #dc2626;
  color: #7f1d1d;
}

.order-slot-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.order-placed-item.result-wrong .order-slot-num {
  background: #dc2626;
}

.order-item-text {
  flex: 1;
  min-width: 0;
}

.order-item-status {
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

.order-item-ctrls {
  display: flex;
  gap: 4px;
}

.order-mini-btn {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.order-mini-btn:hover {
  background: #e2e8f0;
}

.order-pool-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.order-pool-hint {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.order-pool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-word-chip {
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid #94a3b8;
  background: #ffffff;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 800;
  cursor: grab;
  touch-action: none;
  user-select: none;
  font-family: inherit;
  box-shadow: 0 3px 0 #cbd5e1;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
}

.order-word-chip:active {
  cursor: grabbing;
}

.order-word-chip:hover {
  border-color: var(--primary);
  background: #f0fdf4;
  transform: translateY(-2px);
}

.order-actions-row {
  display: flex;
  gap: 10px;
}

.order-actions-row .btn {
  flex: 1;
}

/* Nya editor-kontroller (frågetyp, bilduppladdning, ljuduppladdning, rätt ordning) */
.q-type-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.q-media-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px;
}

.q-media-editor-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.q-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
  border: 1.5px solid #7dd3fc;
}

.q-upload-label:hover {
  background: #bae6fd;
}

.q-upload-label input[type='file'] {
  display: none;
}

.q-toggle-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
}

.q-toggle-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.q-media-preview-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.q-img-thumb {
  width: 84px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #cbd5e1;
}

.q-order-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #f0fdf4;
  border: 2px solid #86efac;
  border-radius: 12px;
  padding: 10px;
}

.q-order-labels-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.q-order-word-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.q-order-word-row span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #16a34a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.qp-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--primary);
}

.qp-progress {
  font-size: 0.88rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.qp-timer-wrap {
  background: #f1f5f9;
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.qp-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin-bottom: 18px;
}

.qp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
  width: 0%;
  transition: width 0.3s ease;
}

.qp-question-text {
  margin: 0 0 18px;
  font-size: 1.32rem;
  line-height: 1.38;
}

.qp-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.qp-opt-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
  padding: 14px 16px;
  border: 2.5px solid #cbd5e1;
  border-radius: 14px;
  background: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.qp-opt-btn:hover:not(:disabled) {
  border-color: #60a5fa;
  background: #eff6ff;
}

.qp-opt-letter {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #e2e8f0;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  flex-shrink: 0;
}

.qp-opt-btn.answer-correct {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
  animation: pulseGreen 0.55s ease;
}

.qp-opt-btn.answer-correct .qp-opt-letter {
  background: #16a34a;
  color: #fff;
}

.qp-opt-btn.answer-wrong {
  background: #fee2e2;
  border-color: #dc2626;
  color: #7f1d1d;
  animation: shakeRed 0.45s ease;
}

.qp-opt-btn.answer-wrong .qp-opt-letter {
  background: #dc2626;
  color: #fff;
}

.qp-feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1.05rem;
  text-align: center;
}

.qp-feedback--right {
  background: #dcfce7;
  color: #15803d;
  border: 2px solid #4ade80;
}

.qp-feedback--wrong {
  background: #fee2e2;
  color: #b91c1c;
  border: 2px solid #f87171;
}

@keyframes pulseGreen {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  45% { transform: scale(1.03); box-shadow: 0 0 0 14px rgba(34, 197, 94, 0); }
  100% { transform: scale(1); }
}

@keyframes shakeRed {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.qp-result-area {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qp-result-badge {
  font-size: 3rem;
}

.qp-result-area h2 {
  margin: 0;
  font-size: 1.55rem;
}

.qp-result-score {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.qp-result-rank {
  margin: 0;
  font-size: 0.98rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.qp-result-board {
  width: 100%;
  background: #14532d;
  border: 4px solid #facc15;
  border-radius: 16px;
  padding: 14px 16px;
  color: #f8fafc;
  text-align: left;
  margin: 6px 0;
}

.qp-result-board h4 {
  margin: 0 0 8px;
  text-align: center;
  color: #fde047;
  font-size: 0.96rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
  padding-bottom: 6px;
}

.qp-board-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 700;
}

.qp-board-row.is-me {
  background: rgba(250, 204, 21, 0.22);
  color: #fef08a;
}

/* ==================== KONTO, SPELGRUPPER, MAGIC LINK & INSTRUKSIONSVIDEO ==================== */
.auth-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 2.5px solid #b8db98;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #eef4e5;
  padding: 4px;
  border-radius: 12px;
}

.auth-tab {
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 9px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink-muted);
  cursor: pointer;
  font-family: inherit;
}

.auth-tab.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-guest-row {
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.home-logged-in {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #b8db98;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 0.94rem;
}

.home-actions--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-card--groups {
  border-color: #fcd34d;
}

.hero-card--groups:hover {
  border-color: #f59e0b;
}

.hero-card--groups .hero-card__icon {
  background: #fef3c7;
}

.group-meta-card {
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.group-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-select,
.field-textarea {
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

.field-textarea {
  resize: vertical;
  line-height: 1.45;
  font-weight: 500;
}

.field-select:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.group-link-base-row {
  padding-top: 4px;
}

.sms-tip-banner {
  background: #eff6ff;
  border: 2px solid #93c5fd;
  color: #1e3a8a;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.45;
}

.group-members-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.group-members-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.group-member-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.member-share-card {
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.member-share-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.member-share-canvas {
  width: 78px;
  height: 86px;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #e0f2fe 70%, #dcfce7 100%);
  border: 2px solid #cbd5e1;
}

.member-share-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.member-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.member-share-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.member-link-pill {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 7px 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  color: #0f172a;
  word-break: break-all;
}

.member-invite-input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 54px;
}

.member-invite-input:focus {
  outline: none;
  border-color: var(--primary);
}

.share-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn--whatsapp {
  background: #16a34a;
  color: #ffffff;
}

.btn--whatsapp:hover {
  background: #15803d;
}

.btn--messenger {
  background: #0084ff;
  color: #ffffff;
}

.btn--messenger:hover {
  background: #006be0;
}

.btn--sms {
  background: #7c3aed;
  color: #ffffff;
}

.btn--sms:hover {
  background: #6d28d9;
}

/* Magic Link Välkomstskärm */
#view-magic-welcome {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(circle at top, #e7f6d5 0%, #d2ecba 50%, #bddf9c 100%);
}

.magic-welcome-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
}

.magic-welcome-card {
  background: #ffffff;
  border: 3px solid #86efac;
  border-radius: 26px;
  padding: 28px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.magic-avatar-wrap {
  width: 144px;
  height: 158px;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #e0f2fe 65%, #dcfce7 100%);
  border: 2.5px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.magic-title {
  margin: 0;
  font-size: clamp(1.7rem, 4.5vw, 2.35rem);
  font-weight: 900;
  color: var(--ink);
}

.magic-title span {
  color: var(--primary);
}

.magic-info-box {
  width: 100%;
  background: #f7fee7;
  border: 2px solid #bef264;
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 1rem;
  line-height: 1.5;
  color: #1e293b;
  white-space: pre-wrap;
}

.magic-actions {
  display: flex;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

.magic-actions .btn {
  flex: 1;
  min-width: 190px;
}

.magic-sub-actions {
  margin-top: 2px;
}

.magic-participants-section {
  width: 100%;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 2px solid var(--border);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.magic-participants-heading {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 900;
  color: var(--ink);
  text-align: center;
}

.magic-participants-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.participant-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 2px solid var(--border);
}

.participant-row.is-self {
  background: #f0fdf4;
  border-color: #86efac;
}

.participant-avatar {
  width: 48px;
  height: 54px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #e0f2fe 70%, #dcfce7 100%);
  border: 1.5px solid #cbd5e1;
  flex-shrink: 0;
}

.participant-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.participant-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--ink);
}

.participant-self-tag {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}

.participant-stats {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.participant-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.participant-badge--finished {
  background: #fef9c3;
  color: #854d0e;
  border: 1.5px solid #facc15;
}

.participant-badge--playing {
  background: #dcfce7;
  color: #166534;
  border: 1.5px solid #4ade80;
}

.participant-badge--idle {
  background: #f1f5f9;
  color: #64748b;
  border: 1.5px solid #cbd5e1;
}

/* Klar med alla quiz i staden - ruta (större lättläst text & stor animerad CTA, allt utom spelarlistan syns på mobilskärm!) */
.town-complete-card {
  max-width: 560px;
  max-height: 94dvh;
  overflow-y: auto;
  text-align: center;
  border: 3px solid #4ade80;
  padding: 16px 18px 20px;
}

.tc-top-compact {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.tc-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tc-trophy {
  font-size: 2rem;
  line-height: 1;
}

.tc-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--primary);
  line-height: 1.1;
}

.tc-summary-sentence {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
}

.tc-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.tc-stat-box {
  background: #f7fee7;
  border: 2px solid #bef264;
  border-radius: 14px;
  padding: 9px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.tc-stat-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.tc-stat-val {
  font-size: 1.22rem;
  font-weight: 900;
  color: #14532d;
  line-height: 1.15;
}

.tc-rank-pill {
  font-size: 0.82rem;
  font-weight: 900;
  background: #fef9c3;
  color: #854d0e;
  border: 1.5px solid #facc15;
  border-radius: 999px;
  padding: 2px 9px;
}

.tc-group-note {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-muted);
  line-height: 1.38;
}

.tc-feedback-box {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 10px 12px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tc-feedback-label {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.32;
}

.tc-feedback-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.tc-feedback-input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  line-height: 1.32;
  background: #ffffff;
  color: var(--ink);
}

.tc-feedback-input:focus {
  outline: none;
  border-color: var(--primary);
}

.tc-feedback-send {
  padding: 10px 16px;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.tc-feedback-status {
  font-size: 0.88rem;
  font-weight: 800;
  color: #15803d;
}

.tc-create-cta {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 52%, #fef9c3 100%);
  border: 2.5px solid #22c55e;
  border-radius: 16px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.22);
  animation: tcCtaBoxGlow 2.8s ease-in-out infinite;
}

.tc-create-cta__heading {
  margin: 0;
  font-size: 1.52rem;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #15803d 0%, #059669 35%, #d97706 50%, #15803d 75%, #166534 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: tcHeadingShine 3s linear infinite, tcHeadingPulse 2.4s ease-in-out infinite;
}

@keyframes tcHeadingShine {
  0% { background-position: 0% center; }
  100% { background-position: 220% center; }
}

@keyframes tcHeadingPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@keyframes tcCtaBoxGlow {
  0%, 100% {
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
  }
  50% {
    box-shadow: 0 8px 26px rgba(34, 197, 94, 0.38);
    border-color: #16a34a;
  }
}

.tc-create-cta__text {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 700;
  color: #14532d;
  line-height: 1.32;
}

.tc-cta-actions {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 8px;
  margin-top: 2px;
}

.tc-cta-actions .btn {
  padding: 11px 12px;
  font-size: 0.98rem;
}

.tc-signup-btn {
  font-weight: 900;
  box-shadow: 0 4px 14px rgba(31, 138, 76, 0.35);
}

.tc-scroll-divider {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 2px dashed #cbd5e1;
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--primary);
  letter-spacing: 0.01em;
}

.tc-participants-section {
  margin-top: 6px;
  padding-top: 0;
  border-top: none;
}

.town-access-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.town-access-tag--owned {
  background: #dcfce7;
  color: #166534;
}

.town-access-tag--group {
  background: #e0f2fe;
  color: #0369a1;
}

@media (prefers-reduced-motion: reduce) {
  .tc-create-cta,
  .tc-create-cta__heading {
    animation: none;
  }
}

/* Adminpanel & knappar */
.account-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-pill-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #4f46e5;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.btn--admin {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
  color: #ffffff;
  border: 1.5px solid #312e81;
}

.btn--admin:hover {
  background: linear-gradient(135deg, #4338ca 0%, #312e81 100%);
}

.hero-card--admin {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
  width: 100%;
}

.hero-card--admin:hover {
  border-color: #4f46e5;
}

.admin-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-stat-card {
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: var(--shadow-sm);
}

.admin-stat-card span {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink-muted);
  text-transform: uppercase;
}

.admin-stat-card strong {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--ink);
}

.admin-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #e2e8f0;
  padding: 5px;
  border-radius: 14px;
}

.admin-tab {
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 800;
  font-size: 0.94rem;
  color: #475569;
  cursor: pointer;
}

.admin-tab.active {
  background: #ffffff;
  color: #3730a3;
  box-shadow: var(--shadow-sm);
}

.admin-users-list,
.admin-feedback-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-user-card,
.admin-fb-card {
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  border-bottom: 1.5px solid #f1f5f9;
}

.admin-user-name {
  font-size: 1.08rem;
  color: var(--ink);
}

.admin-user-email {
  font-size: 0.88rem;
  font-weight: 700;
  color: #4f46e5;
}

.admin-user-meta {
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.admin-user-towns {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-town-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  flex-wrap: wrap;
}

.admin-town-info {
  flex: 1;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-town-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-fb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-fb-who {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 1rem;
  color: var(--ink);
}

.admin-fb-town {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
}

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

.admin-fb-date {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.admin-fb-comment {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Snygg animerad videoknapp "Så spelar du" på välkomstskärmen */
.btn--video {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  border: 2px solid #475569;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28), 0 0 0 0 rgba(239, 68, 68, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 20px;
  animation: videoBtnFloat 2.8s ease-in-out infinite;
}

.btn--video::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -70%;
  width: 48%;
  height: 140%;
  background: linear-gradient(
    105deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-18deg);
  animation: videoBtnShimmer 3.2s ease-in-out infinite;
  pointer-events: none;
}

.btn--video:hover {
  background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
  border-color: #ef4444;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.35), 0 0 0 4px rgba(239, 68, 68, 0.22);
  animation-play-state: paused;
}

.btn-video-play {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.96rem;
  padding-left: 3px;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.65);
  flex-shrink: 0;
  animation: videoPlayPulse 1.8s ease-out infinite;
}

@keyframes videoBtnFloat {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28), 0 0 0 0 rgba(239, 68, 68, 0.16);
  }
  50% {
    transform: translateY(-2.5px);
    box-shadow: 0 11px 24px rgba(15, 23, 42, 0.36), 0 0 0 4px rgba(239, 68, 68, 0.14);
  }
}

@keyframes videoBtnShimmer {
  0%, 55% {
    left: -70%;
    opacity: 0;
  }
  65% {
    opacity: 1;
  }
  100% {
    left: 135%;
    opacity: 0;
  }
}

@keyframes videoPlayPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.72);
  }
  60% {
    transform: scale(1.08);
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn--video,
  .btn--video::after,
  .btn-video-play {
    animation: none;
  }
}

.btn-video-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  text-align: left;
}

.btn-video-text strong {
  font-size: 1.02rem;
  font-weight: 900;
  color: #ffffff;
}

.btn-video-text small {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fca5a5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* HTML5-videomodal ("Så spelar du") */
.howto-video-modal {
  max-width: 780px;
}

.howto-video-body {
  padding: 16px 20px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.howto-video-player {
  width: 100%;
  max-height: 68dvh;
  border-radius: 12px;
  background: #000000;
  outline: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Instruktionsvideo-modal */
.tutorial-modal {
  max-width: 720px;
}

.tutorial-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.tutorial-video-stage {
  width: 100%;
  background: #0f172a;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid #cbd5e1;
  aspect-ratio: 16 / 9;
}

#tutorial-video-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.tutorial-caption {
  background: #0f172a;
  color: #fef08a;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tut-scrubber {
  flex: 1;
  min-width: 140px;
  accent-color: var(--primary);
}

.tut-time {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.tut-chapters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.tut-chapter-btn {
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.tut-chapter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ==================== TOASTS ==================== */
.toast-container {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #1e293b;
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s ease;
}

.toast--success {
  background: #15803d;
}

.toast--error {
  background: #b91c1c;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== BYGGNADSVÄLJARE (TOM GRÖN RUTA) ==================== */
.building-picker-modal {
  max-width: 720px;
}

.building-picker-body {
  padding: 16px 20px;
  overflow-y: auto;
}

.building-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.bp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: var(--surface-soft);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.bp-card:hover {
  border-color: var(--primary);
  background: #f0fdf4;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.bp-card__img-wrap {
  position: relative;
  width: 74px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bp-card__img-wrap img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.18));
}

.bp-card__name {
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.2;
}

.bp-card__theme {
  font-size: 0.74rem;
  color: var(--ink-muted);
  line-height: 1.2;
}

/* ==================== KOMPAKT FRÅGELISTA & EGEN FRÅGERUTA ==================== */
.q-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: #ffffff;
  border: 2px solid var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.1s ease, box-shadow 0.14s ease;
}

.q-summary-row:hover {
  border-color: #86efac;
  background: #f7fee7;
  box-shadow: var(--shadow-sm);
}

.q-summary-row.is-dragging {
  opacity: 0.4;
}

.q-summary-row.is-drag-over {
  border-color: var(--primary);
  box-shadow: 0 -3px 0 0 var(--primary);
}

.q-summary-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #eef4e5;
  color: var(--primary);
  font-weight: 900;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.q-summary-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid #cbd5e1;
  background: #f1f5f9;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.q-summary-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.q-summary-thumb--icon {
  font-size: 1.25rem;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.q-thumb-px-tag {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(15, 23, 42, 0.85);
  color: #fde047;
  font-size: 0.6rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 4px;
  line-height: 1.1;
}

.q-summary-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.q-summary-title {
  font-weight: 800;
  font-size: 0.94rem;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.28;
}

.q-summary-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.q-type-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.q-type-pill--standard {
  background: #f1f5f9;
  color: #334155;
}

.q-type-pill--image {
  background: #e0f2fe;
  color: #0369a1;
}

.q-type-pill--pixel {
  background: #fef3c7;
  color: #92400e;
}

.q-type-pill--audio {
  background: #ede9fe;
  color: #5b21b6;
}

.q-type-pill--order {
  background: #dcfce7;
  color: #166534;
}

.q-summary-ans {
  font-size: 0.8rem;
  font-weight: 700;
  color: #15803d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.q-summary-ctrls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.q-ord-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-weight: 900;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.q-ord-btn:hover:not(:disabled) {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.q-ord-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.q-ord-btn--del {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fef2f2;
}

.q-ord-btn--del:hover:not(:disabled) {
  background: #fee2e2;
  border-color: #f87171;
}

/* Egen rymlig frågeruta (#modal-single-question) */
.single-q-modal {
  max-width: 640px;
  max-height: 94dvh;
}

.single-q-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}

.sq-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sq-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-muted);
}

.city-timer-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.city-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 52px;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 2.5px solid #facc15;
  color: #fef08a;
  font-weight: 900;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

.city-timer-pill.is-finished {
  border-color: #4ade80;
  color: #bbf7d0;
}

.city-timer-pill.is-paused {
  border-color: #f97316;
  color: #fed7aa;
}

.city-timer-icon {
  font-size: 1.24rem;
  line-height: 1;
}

.hud-pause-btn {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  border: 2.5px solid rgba(255, 255, 255, 0.45);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-size: 1.48rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  transition: transform 0.1s ease, background 0.15s ease, border-color 0.15s ease;
}

.hud-pause-btn:hover {
  background: rgba(30, 41, 59, 0.96);
  border-color: #facc15;
  transform: scale(1.04);
}

/* Paus-modal */
.pause-card {
  max-width: 410px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 3px solid #facc15;
}

.pause-icon {
  font-size: 2.8rem;
  line-height: 1;
}

.pause-title {
  margin: 2px 0 0;
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--ink);
}

.pause-text {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink-muted);
  line-height: 1.45;
}

.pause-time-pill {
  padding: 7px 18px;
  border-radius: 999px;
  background: #fef9c3;
  border: 2px solid #facc15;
  color: #854d0e;
  font-weight: 900;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

/* Sorteringsknappar & Guld / Silver / Brons för spelarlistan */
.participant-sort-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 4px;
}

.participant-sort-btn {
  padding: 8px 6px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: #ffffff;
  color: #334155;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.14s ease;
  white-space: nowrap;
}

.participant-sort-btn:hover {
  border-color: #86efac;
  background: #f0fdf4;
}

.participant-sort-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(31, 138, 76, 0.25);
}

.participant-sort-hint {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-muted);
  text-align: center;
  margin-bottom: 2px;
}

.participant-rank {
  width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.medal-badge {
  font-size: 1.35rem;
  line-height: 1;
}

.medal-badge--none {
  font-size: 1rem;
  color: #94a3b8;
  font-weight: 900;
}

.participant-row--gold {
  background: linear-gradient(135deg, #fefce8 0%, #fef08a 100%);
  border-color: #eab308;
  box-shadow: 0 2px 10px rgba(234, 179, 8, 0.2);
}

.participant-row--silver {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(100, 116, 139, 0.15);
}

.participant-row--bronze {
  background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
  border-color: #d97706;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.16);
}

.medal-word {
  font-size: 0.68rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.medal-word--gold {
  background: #ca8a04;
  color: #ffffff;
}

.medal-word--silver {
  background: #64748b;
  color: #ffffff;
}

.medal-word--bronze {
  background: #b45309;
  color: #ffffff;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
  .home-actions,
  .home-actions--three,
  .group-meta-grid,
  .play-setup-layout,
  .avatar-designer {
    grid-template-columns: 1fr;
  }

  .member-share-card {
    grid-template-columns: 1fr;
  }

  .avatar-controls {
    max-height: none;
  }

  #view-builder {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .builder-workspace {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .builder-sidebar {
    border-right: none;
    border-bottom: 2px solid var(--border);
    padding: 10px 10px 12px;
    gap: 8px;
  }

  .sidebar-header h2 {
    font-size: 1rem;
    margin-bottom: 2px;
  }

  .sidebar-header p {
    font-size: 0.76rem;
  }

  .building-palette {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .palette-card {
    padding: 6px 7px;
    gap: 7px;
    border-radius: 12px;
  }

  .palette-drag-handle {
    width: 46px;
    height: 46px;
    border-radius: 9px;
  }

  .palette-drag-handle img {
    width: 42px;
    height: 42px;
  }

  .palette-drag-handle .q-badge {
    min-width: 20px;
    height: 20px;
    font-size: 0.68rem;
    padding: 0 5px;
    top: -5px;
    right: -5px;
  }

  .palette-info {
    gap: 2px;
  }

  .palette-info h3 {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .palette-theme {
    font-size: 0.68rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .palette-theme:nth-of-type(2) {
    display: none;
  }

  .palette-quiz-status {
    font-size: 0.68rem;
  }

  .palette-actions {
    margin-top: 2px;
  }

  .palette-actions .btn--sm {
    padding: 4px 8px;
    font-size: 0.72rem;
    border-radius: 8px;
  }

  .builder-map-area {
    padding: 10px 8px 18px;
  }

  .builder-grid {
    --grid-gap: 18px;
    grid-template-columns: repeat(3, minmax(86px, 27vw));
    grid-template-rows: repeat(3, minmax(86px, 27vw));
    gap: var(--grid-gap);
  }

  .builder-board-frame {
    padding: 12px;
  }

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

  .building-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .bp-card {
    padding: 9px 6px;
  }

  .bp-card__img-wrap {
    width: 56px;
    height: 56px;
  }

  .bp-card__img-wrap img {
    width: 54px;
    height: 54px;
  }

  /* Egen rymlig frågeruta på mobil – slipp skrolla i onödan! */
  #modal-single-question {
    padding: 6px;
  }

  .single-q-modal {
    max-height: 97dvh;
    border-radius: 16px;
  }

  .single-q-modal .editor-header {
    padding: 10px 14px;
  }

  .single-q-modal .editor-header h2 {
    font-size: 1.06rem;
  }

  .single-q-modal .editor-header p {
    display: none;
  }

  .single-q-modal .pq-modal-icon {
    width: 36px;
    height: 36px;
    font-size: 1.15rem;
  }

  .single-q-body {
    padding: 10px 12px;
  }

  .sq-form-wrap {
    gap: 8px;
  }

  .single-q-modal .editor-footer {
    padding: 10px 12px;
  }

  .single-q-modal .q-editor-input {
    padding: 7px 9px;
    font-size: 0.94rem;
  }

  .single-q-modal .q-opt-row {
    padding: 5px 8px;
  }

  .editor-body {
    padding: 10px 10px;
  }

  .qe-question-list,
  .qe-bank-list {
    padding: 8px;
    gap: 8px;
  }

  .q-summary-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    padding: 8px 9px;
    gap: 6px 8px;
  }

  .q-summary-num {
    grid-column: 1;
    grid-row: 1;
  }

  .q-summary-thumb {
    grid-column: 2;
    grid-row: 1;
    width: 40px;
    height: 40px;
  }

  .q-summary-info {
    grid-column: 3;
    grid-row: 1;
  }

  .q-summary-title {
    font-size: 0.9rem;
  }

  .q-summary-ans {
    max-width: 100%;
    font-size: 0.78rem;
  }

  .q-summary-ctrls {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-end;
    padding-top: 4px;
    border-top: 1px dashed #e2e8f0;
    gap: 6px;
  }

  .q-ord-btn {
    width: 34px;
    height: 30px;
    font-size: 0.88rem;
  }

  .hud-zoom-btn {
    display: none !important;
  }

  .city-timer-pill {
    min-height: 48px;
    padding: 8px 15px;
    font-size: 1.18rem;
  }

  .city-timer-icon {
    font-size: 1.14rem;
  }

  .hud-pause-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.38rem;
  }

  .participant-sort-btn {
    font-size: 0.72rem;
    padding: 7px 3px;
    white-space: normal;
    line-height: 1.18;
  }

  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-user-meta {
    text-align: left;
  }

  #modal-town-complete {
    padding: 8px;
  }

  .town-complete-card {
    padding: 13px 13px 16px;
    max-height: 96dvh;
    border-radius: 20px;
  }

  .tc-top-compact {
    gap: 9px;
  }

  .tc-title {
    font-size: 1.55rem;
  }

  .tc-trophy {
    font-size: 1.8rem;
  }

  .tc-summary-sentence {
    font-size: 0.99rem;
    line-height: 1.32;
  }

  .tc-stat-box {
    padding: 7px 5px;
  }

  .tc-stat-label {
    font-size: 0.72rem;
  }

  .tc-stat-val {
    font-size: 1.12rem;
  }

  .tc-rank-pill {
    font-size: 0.78rem;
    padding: 2px 8px;
  }

  .tc-group-note {
    font-size: 0.85rem;
    line-height: 1.34;
  }

  .tc-feedback-box {
    padding: 9px 10px;
    gap: 6px;
  }

  .tc-feedback-label {
    font-size: 0.85rem;
  }

  .tc-feedback-input {
    font-size: 0.9rem;
  }

  .tc-create-cta {
    padding: 12px 11px 11px;
    gap: 7px;
  }

  .tc-create-cta__heading {
    font-size: 1.32rem;
  }

  .tc-create-cta__text {
    font-size: 0.89rem;
  }

  .tc-cta-actions .btn {
    padding: 10px 9px;
    font-size: 0.92rem;
  }

  #minimap-canvas {
    width: 118px;
    height: 118px;
  }

  .qpower-wrap {
    left: 10px;
    padding: 7px 6px;
    gap: 5px;
  }

  .qpower-seg {
    height: 5px;
  }

  .joystick-zone {
    right: 14px;
    bottom: 14px;
    width: 126px;
    height: 126px;
  }

  .joystick-base {
    width: 116px;
    height: 116px;
  }
}

@media (max-width: 560px) {
  /* Behåll alltid 2 kompakta kolumner i byggnadspaletten på mobil så listan förblir kort! */
  .building-palette {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .q-options-grid {
    grid-template-columns: 1fr;
  }
}
