/* ================================
   Theme (restored gradient)
   ================================ */
:root{
  --bg: linear-gradient(135deg, #ffe8f2 0%, #fff6db 40%, #e7f8ff 100%);
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6b7280;

  --primary:#118ab2;  /* blue */
  --accent:#ef476f;   /* pink */
  --good:#06d6a0;     /* green */
  --warn:#ffd166;     /* yellow */
  --orange:#ff7f50;   /* orange/coral */
  --violet:#5e60ce;   /* violet */
  --gray:#e5e7eb;

  --radius:16px;
  --shadow:0 14px 50px rgba(0,0,0,.08);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--ink);
  background:var(--bg);
  background-attachment: fixed;
}

.hidden{ display:none !important; }
.center{ text-align:center; }
.muted{ color: var(--muted); }

/* Make room for fixed bottom bar */
#app{ padding-bottom: 76px; }

/* ================================
   Cards / Buttons
   ================================ */
.card{
  background: var(--card);
  border:1px solid var(--gray);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px; padding:10px 16px; border:0; border-radius:12px;
  font-weight:700; color:#fff; cursor:pointer;
  transition: background 0.2s ease;
}
.btn-primary{ background: var(--primary); }
.btn-good{ background: var(--good); }
.btn-ghost{ background: #eef2f7; color:#111; }

/* ================================
   Top Bar (semi-transparent)
   layout: 3 columns — left, center (logo), right
   ================================ */
.top-bar{
  position: fixed; top:0; left:0; right:0;
  height: 80px;
  padding: 8px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* left | center | right */
  align-items: center;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  z-index: 1000;
}

.tb-left{
  display:flex; align-items:center; gap:10px;
}
.tb-avatar{
  width:44px; height:44px; border-radius:50%; object-fit:cover;
  border: 2px solid #fff; box-shadow: var(--shadow);
}
.tb-meta{ display:flex; flex-direction:column; }
.tb-hey{ font-weight:800; }
.tb-score{ font-size:13px; color:#444; }

.tb-center{
  display:flex; align-items:center; justify-content:center;
}
.tb-logo-img{
  height: 56px; width:auto; display:block; cursor:pointer;
}

.tb-right{
  display:flex; justify-content:flex-end; align-items:center;
}

/* ================================
   Bottom Bar (solid)
   ================================ */
.bottom-bar{
  position: fixed; bottom:0; left:0; right:0;
  height: 76px;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #1dd1a1);
  color: #fff;
  display: flex; justify-content: space-around; align-items: center;
  box-shadow: 0 -8px 30px rgba(0,0,0,.15);
  z-index: 900;
}
.nav-pill{
  display:flex; flex-direction:column; align-items:center; gap:4px;
  min-width: 68px; cursor:pointer; user-select: none;
}
.nav-pill .ico{ font-size:22px; }
.nav-pill .txt{ font-size:12px; opacity:.9; }

/* ================================
   Views: login, main (player select), content wrapper
   ================================ */
.view{ padding: 100px 20px 20px; max-width: 980px; margin: 0 auto; }
.logo{ max-width: 260px; display:block; margin: 8px auto 14px; }
.subtitle{ margin: 0 0 8px; }

/* --- Login (old design vibe) --- */
.login-wrap{
  min-height: 100vh; display:grid; place-items:center; padding: 24px;
}
.login-box{ width:min(420px, 92vw); text-align:center; }
.login-logo{ width: 200px; display:block; margin: 0 auto 10px; }
.login-title{ font-size:22px; font-weight:900; margin: 8px 0; }
.login-text{ margin: 6px 0 12px; color:var(--muted); }
.login-input{
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border:1px solid #d6d6d6; outline:none; font-size: 14px;
}
.login-actions{ display:flex; gap:10px; justify-content:center; margin-top:12px; }

/* --- Player selection (old design) --- */
.avatars{
  display:flex; gap:18px; justify-content:center; flex-wrap: wrap;
}
.avatar-btn{
  width: 120px; height: 120px; border-radius: 50%;
  border: 5px solid transparent; overflow:hidden;
  box-shadow: var(--shadow); cursor:pointer; background:#fff;
  transition: transform .12s ease, border-color .2s ease;
  padding: 3px;          /* ✅ fixes uneven default button padding */
  flex-shrink: 0;        /* prevent squish */
}
.avatar-btn:hover{ transform: translateY(-2px); border-color: #ef476f; }
.avatar-btn img{
  width:100%; height:100%; object-fit: cover; aspect-ratio: 1 / 1; display:block;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 560px){
  .tb-logo-img{ height: 50px; }
  .logo{ max-width: 220px; }
  #app{ padding-bottom: 86px; }
}

/* ================================
   Questions & Categories Styling
   ================================ */

/* Headline */
.view-title {
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  margin: 0 0 16px;
  color: var(--ink);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--gray);
}


/* Question Headline */
.view-title {
  text-align: left;
  font-size: 22px;
  font-weight: 900;
  margin: 0 0 16px;
  color: var(--ink);
  padding-bottom: 6px;
  border-bottom: 2px solid var(--gray);
}

/* Toolbar (filter + buttons) */
.mq-header.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}

.filter-select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d6d6d6;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

/* Question cards */
.q-list {
  display: grid;
  gap: 12px;
}
.q-item {
  border: 1px solid var(--gray);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.q-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  background: linear-gradient(135deg, #fff, #fff9f1);
}
.q-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.q-arrow {
  padding-left: 20px;
  font-weight: bold;
  color: #9ca3af;
  transition: transform 0.2s ease;
}
.q-item.open .q-arrow { transform: rotate(180deg); color: var(--accent); }
.q-body {
  display: none;
  padding: 14px;
  background: #fffef9;
  border-top: 1px dashed #f1e4c9;
}
.q-item.open .q-body { display: block; }

/* Category rows */
#catList .q-item {
  padding: 10px 14px;
}
.cat-name {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
}
#catList .q-head {
  background: #fff;
  padding: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ================================
   Button Colors (toolbar overrides)
   ================================ */
#addQ.btn {
  background: var(--good);
  color: #fff;
}
#addQ.btn:hover { background: #04b589; }

#impExp.btn {
  background: var(--violet);
  color: #fff;
}
#impExp.btn:hover { background: #494ab6; }

#manageCats.btn {
  background: var(--orange);
  color: #fff;
}
#manageCats.btn:hover { background: #ff5f2e; }

.btn-back {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
}
.btn-back:hover { background: #e5e7eb; }

.btn-danger {
  background: #dc2626;
  color: #fff;
}
.btn-danger:hover { background: #b91c1c; }

/* ================================
   My Questions — UI polish
   (drop this at the end of style.css)
   ================================ */

/* Pill badges in the collapsed header row */
.badge{
  display:inline-flex; align-items:center; justify-content:center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

/* Default pill tint for badges shown in q-title */
.badge{ background:#f3f4f6; color:#374151; }
.q-cat   { background:#e6fff5; color:#065f46; } /* mint */
.q-type  { background:#ffe7f1; color:#9d174d; } /* pink */
.q-used  { background:#eef2ff; color:#3730a3; } /* indigo */
.q-active{ background:#fff7d6; color:#7c4a00; } /* soft yellow */

/* Make the collapsed header look clickable and tidy */
.q-head{
  background: linear-gradient(135deg, #fff, #fff9f1);
  border-bottom: 1px dashed #f1e4c9;
}
.q-item.open .q-head{
  background:#fffef9;
}
.q-title{
  display:flex; flex-wrap:wrap; align-items:center; gap:8px;
}
.q-title > div{
  font-weight:700;
  margin-right: 4px;
}

/* Rolled-down editor area — form controls */
.q-body{
  background:#fffef9;
  padding: 14px;
}
.q-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
  gap: 10px;
}

/* Inputs and selects styled to match site vibe */
.q-body input[type="text"],
.q-body select{
  width:100%;
  padding: 11px 12px;
  border:1px solid #d6d6d6;
  border-radius: 10px;
  background:#fff;
  font-size:14px;
  outline:none;
  box-shadow: 0 0 0 0 rgba(0,0,0,0);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.q-body input[type="text"]:focus,
.q-body select:focus{
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(17,138,178,.12);
}

/* Checkbox using theme color */
.q-body input[type="checkbox"]{
  width: 18px; height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Option rows look aligned and airy */
.q-options{ display:grid; gap:8px; margin-top: 8px; }
.q-opt-row{
  display:flex; align-items:center; gap:8px;
}
.q-opt-row .badge{
  min-width:28px; text-align:center;
}

/* Buttons inside the editor already use site button styles;
   just tighten spacing a bit */
.q-actions{ display:flex; gap:8px; margin-top:10px; }

/* Arrow state (you already toggle text, just animate rotation) */
.q-arrow{
  font-weight:900; color:#9ca3af; transition: transform .2s ease, color .2s ease;
}
.q-item.open .q-arrow{ transform: rotate(180deg); color: var(--accent); }

/* Toolbar button colors (ensure they show even if not applied elsewhere) */
#addQ.btn{ background: var(--good); color:#fff; }
#impExp.btn{ background: var(--primary); color:#fff; }
#manageCats.btn{ background: #ff7f50; color:#fff; } /* orange */
#impExp.btn:hover{ filter: brightness(0.95); }
#manageCats.btn:hover{ filter: brightness(0.95); }

/* The category filter select in toolbar sized like buttons */
.filter-select{
  height: 42px;
  padding: 0 12px;
  border:1px solid #d6d6d6;
  border-radius: 10px;
  background:#fff;
  font-size:14px;
  cursor:pointer;
}
/* ================================
   Question editor labels alignment
   ================================ */
.q-body .badge {
  display: inline-block;
  text-align: left;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  background: transparent; /* keep clean, no pill background */
  padding: 0;              /* remove pill padding */
}
.q-title {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* ================================
   Modal styling (smaller, centered)
   ================================ */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; align-items: center;
  z-index: 2000;
}

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
}

.modal-card {
  position: relative;
  max-width: 520px;   /* about as wide as your q-body area */
  width: 92%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  z-index: 2001;
}
/* optional */
.q-options input[type="number"][data-action="timer"] { width: 100px; }

/* Quiz setup category badges */
.cat-badge {
  display:inline-block;
  padding:6px 14px;
  border-radius: 14px;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  user-select:none;
  transition: all 0.2s ease;
}

.cat-badge.selected {
  background: var(--accent);
  color:#fff;
}

.cat-badge.unselected {
  background: var(--gray);
  color:#444;
}

/* Drag and drop */
.drag-handle { cursor: grab; user-select: none; font-weight: 600; padding: 0 6px; }
.q-opt-row.dragging { opacity: 0.6; }