/* ==========================================================================
   Make a Set / My Sets (/gym/create/) — page styles.
   Moved out of the page's inline <style> on 2026-09-01 (it was 1,650 lines of
   a 5,800-line file). Tokens, fonts, buttons (.btn/.rf-btn-*), inputs
   (.rf-input) and the theme toggle come from /css/readflexes.css; everything
   here is page-specific layout re-pointed at the shared tokens.
   ========================================================================== */
/* ===== Readflexes Gym — My Sets / Create page (Arcade Neon) =====
   Tokens, fonts, buttons (.btn/.rf-btn-*), inputs (.rf-input) and the
   theme toggle come from /css/readflexes.css. Everything below is
   page-specific layout re-pointed at the shared tokens. */

/* Supplemental status tokens (mapped onto the neon palette) */
:root{
  --success:#00e676; --warning:#ffb020; --error:#ff4d6d;
}

a{ color:inherit; text-decoration:none }

html, body{ overscroll-behavior-y:none; }

/* App Layout (matching other gym pages) */
.app{ display:grid; grid-template-columns: 260px 1fr; min-height:100vh; width:100%; }

/* Sidebar */
.sidebar{ position:sticky; top:0; height:100vh; padding:18px 14px;
  border-right:1px solid var(--line);
  background:var(--panel); overflow:auto;}
.brand img{ border-radius:14px; display:block; }
.brand{
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:4px;
  text-align:center;
}
.brand-logo{
  height:120px;
  display:block;
  margin:0 auto;
  filter: drop-shadow(0 0 8px rgba(77, 240, 255, 0.25));
}
.brand-sub{
  text-align:center;
  font-size:14px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.08em;
  margin-top:6px;
  margin-bottom:18px;
}
.brand-sub a:hover{ color:var(--neon-cyan); }
.nav-section{ margin-top:14px; }
.nav-title{ padding:8px 10px; }
.nav{ display:flex; flex-direction:column; gap:4px; padding:0 6px 8px; }
.nav a{ padding:10px 14px; border-radius:999px; border:1px solid transparent;
  display:flex; align-items:center; gap:10px; font-weight:700;
  transition:background .15s, border-color .15s, color .15s, box-shadow .15s;
  color:var(--text); }
.nav a:hover{ background:rgba(77, 240, 255, 0.08); border-color:var(--line); }
.nav a.active{
  color:var(--neon-cyan);
  border-color:rgba(77, 240, 255, 0.45);
  background:rgba(77, 240, 255, 0.10);
  box-shadow:var(--glow-cyan);
  text-shadow:0 0 8px rgba(77, 240, 255, 0.5);
}
.nav a .icon{ width:18px; text-align:center; opacity:.9; }

/* Mobile: the shared gym app shell (readflexes.css + gym-mobile-nav.js)
   turns the sidebar into a drawer below 860px. Page tweaks live in the
   768px/640px blocks further down. */
@media (max-width:640px){
  .create-modal{
    max-width:100%;
    width:100%;
    height:100dvh;
    max-height:100dvh;
    border-radius:0;
    border-left:none;
    border-right:none;
  }
}

/* Hero Header Section */
.hero-header{
  background: linear-gradient(135deg, rgba(77, 240, 255, 0.08) 0%, rgba(166, 77, 255, 0.10) 100%);
  border-bottom:1px solid var(--line);
  padding: 40px 20px;
  text-align: center;
  position: relative;
}

.hero-content{
  max-width: 600px;
  margin: 0 auto;
}

.hero-title{
  font-size: clamp(32px, 5vw, 48px);
  margin: 0 0 12px 0;
  background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle{
  font-size: 18px;
  color: var(--muted);
  margin: 0 0 32px 0;
  font-weight: 400;
}

.make-set-btn{
  font-size: 1.05rem;
  padding: 0.85rem 2.2rem;
}

/* "Paste a word list" is an action, not a heading: the shared button style
   uppercases it into what reads as a section title, so undo that here. */
#bulk-add-toggle{
  text-transform: none;
  letter-spacing: normal;
}

.theme-controls{
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* On narrow screens the absolute corner position collides with the centered
   hero title (Sign Out sat on top of "Make a Set"), so the controls flow in
   their own right-aligned row above the title instead. */
@media (max-width: 640px) {
  .hero-header{ padding-top: 16px; padding-bottom: 28px; }
  .theme-controls{
    position: static;
    justify-content: flex-end;
    margin: 0 0 14px;
  }
  /* The mobile top bar already says "Make a Set"; repeating it as the hero
     title made the page name appear three times on one screen. */
  .hero-title{ display: none; }
}

/* Dashboard Grid Layout */
.dashboard{
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.dashboard-grid{
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-bottom: 40px;
  /* Was 800px, which on a laptop left a third of the screen empty on each
     side and forced two cramped columns. The site rule is full-bleed with a
     generous cap (CLAUDE.md); cards flow to fill it. */
  max-width: 1400px;
  margin: 0 auto 40px auto;
}
.hero-actions{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.sets-filter{ max-width: 360px; margin: 0 auto 14px; display:block; }

.dashboard-section{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  min-height: 300px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.dashboard-header{
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.dashboard-title{
  font-size: 20px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.dashboard-sub{
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 16px;
  line-height: 1.4;
}

.dashboard-count{
  font-size: 13px;
  font-weight: 800;
  color: var(--neon-cyan);
  background: rgba(77, 240, 255, 0.1);
  border: 1px solid rgba(77, 240, 255, 0.3);
  padding: 3px 10px;
  border-radius: 999px;
  position: absolute;
  right: 0;
}

.dashboard-content{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  /* No height cap: it scrolled five cards while the badge said twenty, and
     sets six onward could not be reached from this page at all. */
}

.dashboard-content .dashboard-empty{
  grid-column: 1 / -1;
}

.dashboard-item{
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.dashboard-item:hover{
  transform: translateY(-1px);
  border-color: rgba(77, 240, 255, 0.5);
  box-shadow: var(--glow-cyan);
}

.dashboard-item-info{
  flex: 1;
  min-width: 140px;
}

.dashboard-item-name{
  font-weight: 700;
  margin: 0 0 4px 0;
  font-size: 16px;
}

.dashboard-item-meta{
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}
.dashboard-item{ align-items:flex-start; flex-direction:column; }
.dashboard-item-actions{ flex-wrap:wrap; }
.dashboard-chips{ display:flex; flex-wrap:wrap; gap:6px; margin:8px 0 2px; }
.chip{
  font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,0.03);
  white-space: nowrap;
}
.chip-builder{ color:#08122b; background: var(--neon-gold); border-color: transparent; }
:root.light-mode .chip-builder{ color:#16163a; }
.chip-ok{ color: var(--success); border-color: rgba(0,230,118,0.35); }
.lang-chips{ display:flex; gap:4px; }
.lang-chip{
  font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--line); background: transparent; color: var(--muted); font-family: var(--font-body);
}
.lang-chip[aria-pressed="true"]{ color: var(--neon-cyan); border-color: var(--neon-cyan); background: rgba(77,240,255,0.1); }
.dashboard-error{
  grid-column: 1 / -1; text-align:center; padding: 24px 16px; color: var(--error);
  display:flex; flex-direction:column; gap:12px; align-items:center;
  border: 1px dashed rgba(255,77,109,0.45); border-radius: var(--radius-sm);
}
/* Loading: the shape of what is coming, not a sentence in italics. */
.skeleton-card{
  height: 96px; border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(100deg, var(--panel-2) 30%, rgba(255,255,255,0.06) 50%, var(--panel-2) 70%);
  background-size: 200% 100%; animation: rf-skel 1.4s linear infinite;
}
@keyframes rf-skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton-card { animation: none; } }

/* Always visible — tablets and touch screens have no hover */
.dashboard-item-actions{
  display: flex;
  gap: 8px;
}

.dashboard-empty{
  text-align: center;
  color: var(--muted);
  font-style: italic;
  padding: 40px 20px;
}

.dashboard-actions{
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

/* Responsive dashboard */
@media (max-width: 768px) {
  .dashboard-grid{
    max-width: 100%;
    gap: 24px;
  }

  /* An empty card shouldn't be a 300px dead box on a phone */
  .dashboard-section{
    min-height: 0;
  }

  .dashboard-empty{
    padding: 20px 16px;
  }

  .dashboard{
    padding: 20px 16px;
  }

  .dashboard-content{
    grid-template-columns: 1fr;
  }

  .dashboard-content .dashboard-empty{
    grid-column: 1;
  }
}

/* Main content. Was capped at 800px — a third of a laptop screen empty on
   each side, and two cramped card columns. Full-bleed with fluid side padding
   and a generous cap (CLAUDE.md), so the library flows to fill the width. */
.main{
  flex:1;
  padding:32px clamp(14px, 2.5vw, 32px);
  max-width:1400px;
  margin:0 auto;
  width:100%;
}
/* The shared gold button has no light-mode rule: yellow on a pale hero was
   unreadable. Same hue family, enough contrast to read. */
:root.light-mode .rf-btn-gold{
  color:#6b4f00;
  border-color:#c9a300;
  background:rgba(255, 225, 0, 0.22);
}
:root.light-mode .rf-btn-gold:hover{ background:rgba(255, 225, 0, 0.34); }

/* Form styles (field chrome comes from .rf-input in the shared sheet) */
.form-group{
  margin-bottom:24px;
}

.form-label{
  display:block;
  font-family:var(--font-heading);
  font-size:0.9rem;
  font-weight:700;
  letter-spacing:0.02em;
  margin-bottom:8px;
  color:var(--text);
}

.form-hint{
  font-size:13px;
  color:var(--muted);
  margin:8px 0 0;
  line-height:1.4;
}

/* Category selection */
.category-selection{
  display:flex;
  gap:12px;
  align-items:center;
}

.suggest-btn{
  white-space:nowrap;
  flex-shrink:0;
}

@media (max-width: 768px) {
  .category-selection{
    flex-direction:column;
    align-items:stretch;
    gap:8px;
  }
}

/* Grade multi-select dropdown */
.grade-dropdown-wrap{ position:relative; }
.grade-dropdown-btn{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  width:160px;
  padding:0.55rem 1rem;
  font-size:0.9rem;
  cursor:pointer;
  text-align:left;
}
.grade-dropdown-btn .grade-arrow{ color:var(--neon-cyan); font-size:0.8rem; }
.grade-menu{
  display:none;
  position:absolute;
  top:100%;
  left:0;
  margin-top:6px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:12px;
  padding:8px;
  z-index:1000;
  width:180px;
  max-height:300px;
  overflow-y:auto;
  box-shadow:0 12px 30px rgba(0, 0, 0, 0.4);
}
.grade-menu label{
  display:flex;
  align-items:center;
  gap:8px;
  padding:4px 8px;
  cursor:pointer;
  color:var(--text);
  border-radius:8px;
}
.grade-menu label:hover{ background:rgba(77, 240, 255, 0.08); }
.grade-menu-footer{
  border-top:1px solid var(--line);
  margin-top:8px;
  padding-top:8px;
}
.grade-menu-footer .btn{
  width:100%;
  padding:6px 10px;
  font-size:0.72rem;
}

/* "More options" collapsed section */
.more-options{
  margin-bottom:24px;
  border:1px dashed var(--line);
  border-radius:var(--radius);
  padding:2px 16px;
}
.more-options[open]{
  padding-bottom:16px;
  background:rgba(77, 240, 255, 0.03);
}
.more-options summary{
  cursor:pointer;
  list-style:none;
  padding:10px 0;
  font-family:var(--font-heading);
  font-weight:700;
  font-size:0.95rem;
  color:var(--muted);
  display:flex;
  align-items:center;
  gap:8px;
  user-select:none;
}
.more-options summary::-webkit-details-marker{ display:none; }
.more-options summary::after{
  content:'▾';
  color:var(--neon-cyan);
  margin-left:auto;
  transition:transform 0.15s ease;
}
.more-options[open] summary::after{ transform:rotate(180deg); }
.more-options summary:hover{ color:var(--text); }
.more-options .form-group{ margin-top:12px; }
.more-options .form-group:last-child{ margin-bottom:8px; }

/* Vocab words section */
.vocab-section{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:24px;
  margin-bottom:24px;
  box-shadow:0 10px 30px rgba(0, 0, 0, 0.25);
}

.vocab-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:20px;
}

.vocab-title{
  font-size:18px;
  margin:0;
}

.vocab-count{
  font-size:14px;
  color:var(--muted);
  background:var(--panel-2);
  border:1px solid var(--line);
  padding:4px 12px;
  border-radius:999px;
}

/* Word entries.
   BLOCK, not grid. This used to be a three-column grid
   (1fr 1.4fr auto) from an older flat row markup; addWordEntry renders a
   single nested wrapper now, which landed in the grid's FIRST column and
   crushed the Term input to ~41px — one character wide. Typing still worked
   (the preview proved it), but nothing typed was visible in the box. */
.word-entry{
  display:block;
  position:relative; /* anchors the corner ✕ remove button */
  padding:16px;
  background:var(--panel-2);
  border:1px solid var(--line);
  border-radius:12px;
  margin-bottom:12px;
  transition:border-color 0.15s ease, box-shadow 0.15s ease;
}

.word-entry:hover{
  border-color:rgba(77, 240, 255, 0.4);
}

.word-entry:last-child{
  margin-bottom:0;
}

/* Compact bubble inputs inside word rows */
.word-input.rf-input{
  padding:0.55rem 1rem;
  font-size:0.95rem;
}

/* Definition + picture slot line inside a standard word row */
.def-image-grid{
  display:grid;
  grid-template-columns:1fr 160px;
  gap:12px;
  margin-bottom:10px;
  align-items:start;
}
.image-slot{ position:relative; width:100%; }
.image-slot .image-slot-add{
  width:100%;
  min-height:74px;
  border:1.5px dashed var(--line);
  border-radius:12px;
  background:rgba(77, 240, 255, 0.04);
  color:var(--muted);
  cursor:pointer;
  font-family:var(--font-body);
  font-size:0.8rem;
  font-weight:700;
  padding:8px;
}
.image-slot .image-slot-add:hover{ border-color:var(--neon-cyan); color:var(--text); }
.image-slot img{
  width:100%;
  height:96px;
  object-fit:cover;
  border-radius:12px;
  border:1px solid var(--line);
  cursor:pointer;
  display:block;
}
.image-slot .image-slot-x{
  position:absolute;
  top:4px;
  right:4px;
  width:24px;
  height:24px;
  border-radius:50%;
  border:none;
  background:rgba(0, 0, 10, 0.7);
  color:#fff;
  cursor:pointer;
  font-size:15px;
  line-height:1;
}
.image-slot .image-slot-x:hover{ background:rgba(255, 77, 109, 0.85); }
.image-slot .image-slot-credit{
  font-size:10px;
  color:var(--muted);
  margin-top:2px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* A small ✕ in the row's corner, same idiom as removing a picture
   (.image-slot-x). This used to be a full-width red "Remove" bar on phones:
   it dominated every row and invited accidental taps (owner 2026-08-26). */
.remove-word{
  position:absolute;
  top:10px;
  right:10px;
  width:28px;
  height:28px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  background:rgba(255, 77, 109, 0.08);
  color:#ff8098;
  border:1.5px solid rgba(255, 77, 109, 0.4);
  border-radius:50%;
  cursor:pointer;
  font-size:16px;
  line-height:1;
  font-weight:800;
  font-family:var(--font-body);
  transition:background 0.15s, box-shadow 0.15s;
}

.remove-word:hover{
  background:rgba(255, 77, 109, 0.2);
  box-shadow:0 0 12px rgba(255, 77, 109, 0.3);
}

/* The only row can't be removed, so don't show a dead control */
.remove-word:disabled{
  display:none;
}

:root.light-mode .remove-word{ color:#c81e3e; }

/* Add word button */
.add-word{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin-top:16px;
  padding:0.6rem 1.4rem;
  border-radius:999px;
  background:rgba(77, 240, 255, 0.08);
  border:1.5px solid rgba(77, 240, 255, 0.45);
  color:var(--text);
  font-family:var(--font-body);
  font-weight:800;
  font-size:0.9rem;
  cursor:pointer;
  transition:background 0.2s, box-shadow 0.2s, transform 0.1s, border-color 0.2s;
}

.add-word:hover{
  transform:translateY(-1px);
  background:rgba(77, 240, 255, 0.16);
  border-color:var(--neon-cyan);
  box-shadow:var(--glow-cyan);
}

.add-word:active{
  transform:translateY(1px);
  box-shadow:none;
}

/* Vocab actions container */
.vocab-actions{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:16px;
  gap:12px;
  flex-wrap:wrap;
}

.save-actions{
  display:flex;
  gap:12px;
}

/* Action buttons row */
.actions{
  display:flex;
  gap:16px;
  justify-content:flex-end;
  margin-top:32px;
}

.btn:disabled{
  opacity:0.5;
  cursor:not-allowed;
  box-shadow:none;
  transform:none !important;
}

/* Status messages */
.status-message{
  padding:12px 16px;
  border-radius:10px;
  margin-bottom:24px;
  font-size:14px;
  display:none;
}

.status-success{
  background:rgba(0, 230, 118, 0.08);
  color:var(--success);
  border:1px solid rgba(0, 230, 118, 0.25);
}

.status-error{
  background:rgba(255, 77, 109, 0.08);
  color:var(--error);
  border:1px solid rgba(255, 77, 109, 0.25);
}

/* "Publishing draft…", "Opening a copy…": eight callers, no rule until now. */
.status-info{
  background:rgba(77, 240, 255, 0.08);
  color:var(--text);
  border:1px solid rgba(77, 240, 255, 0.25);
}

:root.light-mode .status-success{ color:#067d46; }
:root.light-mode .status-error{ color:#c81e3e; }

/* Loading state */
.loading{
  opacity:0.6;
  pointer-events:none;
}

/* Image search button */
.search-image-btn{
  background:rgba(0, 230, 118, 0.1);
  color:var(--subject-science);
  border:1.5px solid rgba(0, 230, 118, 0.4);
  border-radius:999px;
  padding:8px 12px;
  cursor:pointer;
  font-size:12px;
  font-weight:800;
  font-family:var(--font-body);
  transition:background 0.15s, box-shadow 0.15s;
  white-space:nowrap;
}

.search-image-btn:hover{
  background:rgba(0, 230, 118, 0.18);
  box-shadow:0 0 12px rgba(0, 230, 118, 0.3);
}

.search-image-btn:disabled{
  opacity:0.5;
  cursor:not-allowed;
  box-shadow:none;
}

:root.light-mode .search-image-btn{ color:#067d46; }

/* Privacy toggle styles */
.privacy-section{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:16px;
}

.toggle-input{
  display:none;
}

.toggle-label{
  display:flex;
  align-items:center;
  gap:12px;
  cursor:pointer;
  user-select:none;
}

.toggle-slider{
  position:relative;
  width:50px;
  height:24px;
  background:rgba(255, 255, 255, 0.14);
  border:1px solid var(--line);
  border-radius:999px;
  transition:background 0.3s, box-shadow 0.3s;
  flex-shrink:0;
}

:root.light-mode .toggle-slider{ background:rgba(13, 13, 43, 0.15); }

.toggle-slider::before{
  content:'';
  position:absolute;
  top:1px;
  left:2px;
  width:20px;
  height:20px;
  background:#ffffff;
  border-radius:50%;
  transition:transform 0.3s;
  box-shadow:0 2px 4px rgba(0, 0, 0, 0.25);
}

.toggle-input:checked + .toggle-label .toggle-slider{
  background:var(--neon-gold);
  box-shadow:var(--glow-gold);
}

.toggle-input:checked + .toggle-label .toggle-slider::before{
  transform:translateX(26px);
}

.toggle-text{
  font-size:14px;
  font-weight:700;
}

/* Set Type Toggle Styles */
.set-type-section{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:20px;
  margin-bottom:24px;
}

.type-toggle{
  display:flex;
  gap:12px;
  margin:12px 0;
  flex-wrap:wrap;
}

.type-toggle input[type="radio"]{
  display:none;
}

.type-toggle label{
  flex:1;
  min-width:140px;
  padding:12px 16px;
  border:1.5px solid var(--line);
  border-radius:999px;
  cursor:pointer;
  text-align:center;
  transition:border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.1s;
  font-weight:700;
  background:var(--panel-2);
}

.type-toggle label:hover{
  border-color:rgba(77, 240, 255, 0.5);
  transform:translateY(-1px);
}

/* A visible check on the selected pill: the gradient alone was too subtle a
   signal that these are exclusive choices, especially stacked on phones. */
.type-toggle input:checked + label::before{
  content:'✓ ';
}

.type-toggle input:checked + label{
  background:linear-gradient(135deg, rgba(77, 240, 255, 0.22), rgba(166, 77, 255, 0.22));
  color:var(--text);
  border-color:var(--neon-cyan);
  box-shadow:var(--glow-cyan);
}

.type-description{
  font-size:14px;
  color:var(--muted);
  margin:8px 0 0 0;
}

.type-description span{
  display:none;
}

.type-description span.active{
  display:block;
}

/* Multiple Choice Entry Styles */
.mc-entry{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.mc-choices{
  display:grid;
  grid-template-columns:auto 1fr;
  gap:8px;
  align-items:center;
}

.mc-choices .word-input{
  width:100%;
  max-width:100%;
}

.mc-entry > div:first-child .word-input{
  width:100%;
  max-width:100%;
}

.mc-choices .form-label{
  font-size:16px;
  font-weight:700;
  color:var(--text);
  margin:0;
  text-align:right;
  padding-right:8px;
}

.mc-answer-select{
  display:flex;
  gap:20px;
  padding:12px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:10px;
  align-items:center;
  flex-wrap:wrap;
}

.mc-answer-select label{
  display:flex;
  align-items:center;
  gap:6px;
  cursor:pointer;
  font-weight:700;
  padding:6px 12px;
  border-radius:999px;
  transition:background 0.15s;
}

.mc-answer-select label:hover{
  background:rgba(77, 240, 255, 0.08);
}

.mc-question-image-preview{
  margin-top:8px;
  display:none;
  padding:12px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:10px;
}

.mc-question-image-preview.visible{
  display:block;
}

.mc-question-image-preview img{
  max-width:200px;
  max-height:150px;
  border-radius:6px;
}

/* Delete section styles */
.delete-section{
  background: rgba(255, 77, 109, 0.05);
  border: 1px solid rgba(255, 77, 109, 0.25);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.delete-description{
  font-size: 13px;
  color: var(--muted);
  margin: 12px 0 0 0;
}

/* Delete confirmation dialog */
.delete-confirm-modal{
  background: var(--panel);
  border: 1.5px solid rgba(255, 77, 109, 0.35);
  border-radius: var(--radius);
  width: min(400px, 90vw);
  box-shadow: 0 0 24px rgba(255, 77, 109, 0.15), 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.3s ease-out;
}

.delete-confirm-header{
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.delete-confirm-header h3{
  margin: 0;
  font-size: 18px;
  color: var(--error);
}

.delete-confirm-body{
  padding: 20px 24px 24px;
}

.delete-confirm-body p{
  margin: 0 0 20px 0;
  color: var(--text);
  font-size: 14px;
}

.delete-confirm-actions{
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* The small-set heads-up reuses the delete dialog's bones but must not look
   like a danger warning — it's friendly advice, so cyan instead of red. */
.small-set-modal{
  border-color: rgba(77, 240, 255, 0.35);
  box-shadow: 0 0 24px rgba(77, 240, 255, 0.12), 0 20px 60px rgba(0, 0, 0, 0.5);
}

.small-set-modal .delete-confirm-header h3{
  color: var(--text);
}

/* Enhanced inline image preview styling */
.image-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 8px;
  position: relative;
}

.image-preview img {
  width: 100%;
  max-width: 600px;
  max-height: 300px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.image-preview-attribution {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 4px;
  max-width: 100%;
}

.image-preview-attribution a {
  color: inherit;
  text-decoration: underline;
}

/* Responsive word entry layout */
@media (max-width: 768px) {
  .word-entry .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .word-entry .def-image-grid {
    grid-template-columns: 1fr !important;
  }

  .word-entry .button-row {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .word-entry .button-row button {
    width: 100% !important;
  }

  .image-preview img {
    max-height: 225px;
    max-width: 100%;
  }

  .image-preview-attribution {
    font-size: 10px;
  }
}

/* Create Set Overlay Modal */
.create-overlay{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 20, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.create-overlay.active{
  display: flex;
}

.create-modal{
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(77, 240, 255, 0.15), 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: slideIn 0.3s ease-out;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.create-modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(77, 240, 255, 0.04);
}

.create-modal-title{
  font-size: 24px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.create-modal-header-actions{
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#save-set-top{
  font-size: 13px;
  padding: 8px 16px;
  white-space: nowrap;
}

.create-modal-close{
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.create-modal-close:hover{
  background: rgba(77, 240, 255, 0.1);
  color: var(--text);
}

.create-modal-body{
  padding: 24px;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

/* Small pill action buttons on dashboard cards */
.action-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-body);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.action-btn-primary{
  background: rgba(77, 240, 255, 0.12);
  border: 1.5px solid rgba(77, 240, 255, 0.45);
  color: var(--text);
}

.action-btn-primary:hover{
  border-color: var(--neon-cyan);
  background: rgba(77, 240, 255, 0.2);
  box-shadow: var(--glow-cyan);
}

.action-btn-secondary{
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: var(--muted);
}

.action-btn-secondary:hover{
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

:root.light-mode .action-btn-secondary{
  border-color: rgba(13, 13, 43, 0.25);
}

:root.light-mode .action-btn-secondary:hover{
  border-color: rgba(13, 13, 43, 0.45);
  background: rgba(13, 13, 43, 0.05);
}

.action-btn-danger{
  background: rgba(255, 77, 109, 0.08);
  border: 1.5px solid rgba(255, 77, 109, 0.55);
  color: #ff8098;
}

.action-btn-danger:hover{
  background: rgba(255, 77, 109, 0.18);
  box-shadow: 0 0 12px rgba(255, 77, 109, 0.3);
}

:root.light-mode .action-btn-danger{ color: #c81e3e; }

/* View Set Overlay Modal */
.view-overlay{
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 5, 20, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2100;
  padding: 20px;
}

.view-overlay.active{
  display: flex;
}

.view-modal{
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(77, 240, 255, 0.15), 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: slideIn 0.3s ease-out;
}

.view-modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(77, 240, 255, 0.04);
  position: sticky;
  top: 0;
  z-index: 10;
}

.view-modal-actions{
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-modal-title{
  font-size: 24px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-modal-meta{
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 0 0;
}

.view-modal-close{
  background: none;
  border: none;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.view-modal-close:hover{
  background: rgba(77, 240, 255, 0.1);
  color: var(--text);
}

.view-modal-body{
  padding: 0;
  max-height: calc(90vh - 140px);
  overflow-y: auto;
}

.view-terms-list{
  display: flex;
  flex-direction: column;
}

.view-term-item{
  padding: 32px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-term-item:last-child{
  border-bottom: none;
}

.view-term-header{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.view-term-number{
  background: rgba(77, 240, 255, 0.15);
  border: 1px solid rgba(77, 240, 255, 0.4);
  color: var(--neon-cyan);
  font-weight: 800;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  min-width: 32px;
  text-align: center;
}

.view-term-name{
  font-size: 24px;
  margin: 0;
  color: var(--text);
  flex: 1;
}

.view-term-content{
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-term-definition{
  font-size: 18px;
  line-height: 1.5;
  color: var(--muted);
  background: var(--panel-2);
  padding: 16px;
  border-radius: 12px;
  border-left: 4px solid var(--neon-cyan);
}

.view-term-image{
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  position: relative;
}

.view-term-image img{
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

.view-term-attribution{
  padding: 8px 12px;
  font-size: 12px;
  background: rgba(5, 5, 20, 0.75);
  color: #ffffff;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.view-term-attribution a{
  color: #ffffff;
  text-decoration: underline;
}

/* Empty state for view modal */
.view-empty-state{
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}

.view-empty-state h3{
  font-size: 20px;
  margin: 0 0 8px 0;
  color: var(--text);
}

.view-empty-state p{
  margin: 0;
  font-size: 16px;
}

/* Practice Overlay Modal */
/* Image search modal */
.image-modal{
  position:fixed;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background:rgba(5, 5, 20, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:2500;
}

.image-modal.active{
  display:flex;
}

.image-modal-content{
  background:var(--panel);
  border-radius:var(--radius);
  padding:24px;
  max-width:800px;
  max-height:80vh;
  width:90vw;
  height:600px;
  display:flex;
  flex-direction:column;
  border:1.5px solid var(--line);
  box-shadow: 0 0 30px rgba(77, 240, 255, 0.15), 0 24px 60px rgba(0, 0, 0, 0.55);
  min-height:0;
  overflow:hidden;
}

.image-modal-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:20px;
}

.image-modal-title{
  font-size:18px;
  margin:0;
}

.close-modal{
  background:none;
  border:none;
  color:var(--text);
  font-size:24px;
  cursor:pointer;
  padding:4px;
  border-radius:4px;
  transition:background 0.15s;
}

.close-modal:hover{
  background:rgba(77, 240, 255, 0.1);
}

.search-controls{
  display:flex;
  gap:12px;
  margin-bottom:20px;
}

.search-input{
  flex:1;
}

.search-btn{
  white-space:nowrap;
}

.image-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows:150px;
  gap:16px;
  overflow-y:auto;
  flex:1;
  min-height:0;
  padding:8px;
  max-height:350px;
}

.image-item{
  width:100%;
  height:100%;
  border-radius:10px;
  overflow:hidden;
  cursor:pointer;
  border:2px solid var(--line);
  transition:border-color 0.15s, box-shadow 0.15s;
  position:relative;
  background:var(--panel-2);
  display:flex;
  align-items:center;
  justify-content:center;
}

.image-item:hover{
  border-color:var(--neon-cyan);
}

.image-item.selected{
  border-color:var(--neon-gold);
  box-shadow:var(--glow-gold);
}

.image-item img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.search-status{
  text-align:center;
  color:var(--muted);
  font-size:14px;
  padding:40px 20px;
  line-height: 1.4;
  max-width: 100%;
}

.search-actions{
  display:flex;
  gap:12px;
  justify-content:flex-end;
  margin-top:20px;
  padding-top:20px;
  border-top:1px solid var(--line);
}

/* Responsive */
@media (max-width: 640px) {
  .main{
    padding:24px 16px;
  }

  /* Keep the modal header to one line beside the hoisted save button */
  .create-modal-header{
    padding: 14px 16px;
  }

  .create-modal-title{
    font-size: 17px;
  }

  .word-entry{
    grid-template-columns:1fr;
    gap:8px;
  }

  .vocab-actions{
    flex-direction:column;
    align-items:stretch;
    gap:16px;
  }

  .save-actions{
    flex-direction:column;
    gap:8px;
  }

  .actions{
    flex-direction:column;
  }

  .btn{
    width:100%;
  }

  .image-modal-content{
    width:95vw;
    height:90vh;
    padding:16px;
  }

  .search-controls{
    flex-direction:column;
  }

  .image-grid{
    grid-template-columns:repeat(auto-fill, minmax(120px, 1fr));
    grid-auto-rows:120px;
    max-height:300px;
  }

  .search-image-btn{
    font-size:11px;
    padding:6px 8px;
  }
}


  
/* ── the ⬇️ Download menu on a My Sets card (2026-09-01) ─────────────────
   One popover, drawn beside the button; the worksheet row is added only for
   an account the builder admits (library.js downloadMenu). */
.dl-wrap{ position: relative; display: inline-flex; }
.dl-menu{
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 230px; padding: 6px; border-radius: 12px; display: none;
  background: #161a22; border: 1px solid rgba(255,255,255,.16);
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
.dl-menu.rf-on{ display: block; }
.dl-item{
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  color: #e9edf5; font: inherit; font-size: .88rem; font-weight: 600;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.dl-item:hover{ background: rgba(255,255,255,.1); }
.dl-item small{ display: block; opacity: .62; font-size: .76rem; font-weight: 400; }
:root.light-mode .dl-menu{ background: #fff; border-color: rgba(0,0,0,.14); box-shadow: 0 14px 34px rgba(0,0,0,.18); }
:root.light-mode .dl-item{ color: #16181d; }
:root.light-mode .dl-item:hover{ background: rgba(0,0,0,.06); }


/* The creation choices use the existing theme and fit a phone. */
#create-start { color:var(--text); background:var(--panel); border:1px solid var(--line); border-radius:16px; width:min(520px, calc(100vw - 48px)); padding:24px; }
#create-start::backdrop { background:rgba(5,5,20,.78); }
.create-start-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.create-start-heading h2 { font-size:1.5rem; }
.create-start-options { display:grid; gap:12px; }
.create-start-options .btn { white-space:normal; font-size:1rem; padding:14px; text-align:left; }
#save-location { color:var(--muted); font-size:.9rem; }
.word-selection { display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:12px 0; font-size:.9rem; }
#word-list .word-entry { padding:16px; }
#word-list .row-select { display:block; margin-bottom:10px; font-size:.875rem; }
#word-list .def-image-grid { grid-template-columns:1fr; }
.row-extras { margin-top:8px; }
.row-extras summary { cursor:pointer; font-size:.9rem; padding:8px 0; }
.row-extras textarea { width:100%; box-sizing:border-box; font:inherit; }
.row-extras .image-slot { max-width:180px; margin:8px 0; }
