/* LemonAppStand-ish palette: soft lemon, cream, fresh accents */
:root{
  --bg: #fffdf4;
  --panel: #ffffff;
  --border: #f1e6b6;
  --lemon: #ffe680;
  --lemon-strong: #ffd24d;
  --text: #1f2937;
  --muted: #6b7280;
  --success-bg: #eafbea;
  --shadow: 0 8px 24px rgba(31,41,55,.08);
  --heart: #d7263d;
  --card-class: #fff6cc; /* lemon-tinted cards in CLASS mode */
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Topbar */
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 14px;
  background: var(--lemon);
  border-bottom: 1px solid var(--border);
}
.brand{
  display:flex;
  align-items:center;
  gap:10px;
  cursor:pointer;
  user-select:none;
}
.brand-emoji{ font-size:22px; }
.brand-title{ font-weight:800; line-height:1.1; }
.brand-subtitle{ font-size:12px; color: rgba(31,41,55,.7); margin-top:2px; }
.topbar-actions{ display:flex; gap:8px; align-items:center; }

/* Buttons */
.btn{
  background: var(--lemon);
  border: 1px solid rgba(31,41,55,.10);
  border-radius: 12px;
  padding:8px 10px;
  font-weight:700;
  cursor:pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset;
}
.btn:hover{ background: var(--lemon-strong); }
.btn:disabled{ opacity:.5; cursor:not-allowed; }
.btn-ghost{
  background: rgba(255,255,255,.55);
}
.btn-ghost:hover{ background: rgba(255,255,255,.8); }

/* Layout */
.layout{
  display:grid;
  grid-template-columns: 260px 260px 1fr;
  gap:12px;
  padding:12px;
  height: calc(100vh - 56px);
}
.panel{
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.panel-wide{ min-width: 0; }
.panel-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:12px 12px 10px;
  border-bottom:1px solid var(--border);
}
.panel-head h2{ margin:0; font-size:16px; }
.panel-body{ padding:10px 12px 12px; overflow:auto; min-height:0; }

.hint{ color: var(--muted); font-size:13px; padding:8px 2px; }

.list{ list-style:none; margin:0; padding:0; }
.list-item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:10px 10px;
  border:1px solid transparent;
  border-radius: 14px;
  cursor:pointer;
  user-select:none;
}
.list-item:hover{ background: rgba(255,230,128,.25); border-color: rgba(241,230,182,.9); }
.list-item.active{ background: rgba(255,230,128,.35); border-color: rgba(241,230,182,1); }
.item-main{ display:flex; align-items:center; gap:10px; min-width:0; }
.item-title{ font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.item-sub{ font-size:12px; color: var(--muted); }
.item-actions{ display:flex; gap:6px; }
.iconbtn{
  width:34px; height:34px;
  border-radius: 12px;
  border:1px solid rgba(31,41,55,.10);
  background: rgba(255,255,255,.65);
  cursor:pointer;
}
.iconbtn:hover{ background: rgba(255,255,255,.9); }
.iconbtn.starred{ background: #fff2b3; }

/* Workspace */
.workspace-head{ align-items:flex-start; }
.workspace-actions{ display:flex; gap:8px; align-items:center; }
.workspace-subtitle{ color: var(--muted); font-size:12px; margin-top:2px; }
.workspace-body{ padding-top:6px; }

.mode-tabs{
  display:flex;
  gap:8px;
  padding: 6px 2px 10px;
}
.tab{
  border:1px solid rgba(31,41,55,.10);
  background: rgba(255,255,255,.75);
  border-radius: 999px;
  padding:8px 10px;
  font-weight:800;
  cursor:pointer;
}
.tab.active{ background: rgba(255,230,128,.65); }

.workspace-split{
  display:grid;
  grid-template-columns: 1fr 320px;
  gap:12px;
  min-height:0;
}
.workspace-main{ min-width:0; }
.cards{ display:flex; flex-direction:column; gap:10px; padding:4px 2px 16px; }

.card{
  border:1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(31,41,55,.06);
  overflow:hidden;
}
.card.class-mode{ background: var(--card-class); }
.card.mastered{ background: var(--success-bg); }
.card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 12px 10px;
}
.word{
  font-size:26px;
  font-weight:900;
  letter-spacing: .5px;
  line-height:1.1;
  user-select:none;
}
.word .heart{
  color: var(--heart);
  border-bottom: 3px dotted var(--heart);
  padding-bottom:2px;
}
.card-actions{
  display:flex;
  gap:8px;
  align-items:center;
}
.pill{
  font-size:12px;
  font-weight:900;
  padding:6px 10px;
  border-radius: 999px;
  border:1px solid rgba(31,41,55,.12);
  background: rgba(255,255,255,.65);
  cursor:pointer;
}
.pill:hover{ background: rgba(255,255,255,.9); }
.pill-danger{ background: rgba(215,38,61,.08); border-color: rgba(215,38,61,.18); }
.pill-danger:hover{ background: rgba(215,38,61,.12); }

.card-bottom{
  padding:10px 12px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  color: var(--muted);
  font-size:12px;
}

/* Library */
.library{
  border:1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(31,41,55,.06);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-height:0;
}
.library-head{ padding:12px; border-bottom:1px solid var(--border); }
.library-head h3{ margin:0; font-size:14px; }
.library-sub{ font-size:12px; color: var(--muted); margin-top:3px; }

.library-tabs{
  display:flex; gap:6px; padding:10px 12px 0;
}
.libtab{
  flex:1;
  border-radius:999px;
  border:1px solid rgba(31,41,55,.10);
  background: rgba(255,255,255,.7);
  padding:8px 8px;
  font-weight:900;
  cursor:pointer;
}
.libtab.active{ background: rgba(255,230,128,.65); }

.library-search{
  display:flex; gap:8px; padding:10px 12px 12px;
  border-bottom:1px solid var(--border);
}
.library-search input{
  flex:1;
  padding:10px 10px;
  border-radius: 14px;
  border:1px solid rgba(31,41,55,.12);
  outline:none;
}
.library-list{
  padding:10px 12px 14px;
  overflow:auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.libitem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding:10px 10px;
  border:1px solid rgba(31,41,55,.08);
  border-radius: 14px;
  cursor:pointer;
  user-select:none;
}
.libitem:hover{ background: rgba(255,230,128,.22); }
.libword{
  font-weight:900;
  letter-spacing:.2px;
}
.libmeta{ font-size:12px; color: var(--muted); }

/* Modal */
.modal-backdrop{
  position:fixed; inset:0;
  background: rgba(31,41,55,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
  z-index:50;
}
.modal{
  width:min(560px, 96vw);
  background:#fff;
  border:1px solid rgba(31,41,55,.10);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow:hidden;
}
.modal-head{
  padding:12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-bottom:1px solid var(--border);
}
.modal-title{ font-weight:900; }
.modal-body{ padding:12px; }
.modal-instructions{ font-size:13px; color: var(--muted); margin-bottom:10px; }
.letter-row{
  display:flex; gap:6px; flex-wrap:wrap;
  padding:10px;
  border:1px dashed rgba(31,41,55,.18);
  border-radius: 14px;
  background: rgba(255,230,128,.14);
}
.letter{
  width:44px; height:50px;
  display:flex; align-items:center; justify-content:center;
  border-radius: 14px;
  font-weight:900;
  font-size:22px;
  border:1px solid rgba(31,41,55,.10);
  background:#fff;
  cursor:pointer;
}
.letter.selected{ background: rgba(215,38,61,.10); border-color: rgba(215,38,61,.25); }
.letter.inrange{ background: rgba(215,38,61,.06); border-color: rgba(215,38,61,.18); }
.modal-preview{ margin-top:12px; font-size:13px; color: var(--muted); }
.preview-word{ margin-top:8px; font-size:26px; font-weight:900; color: var(--text); }
.modal-foot{
  padding:12px;
  display:flex;
  justify-content:space-between;
  border-top:1px solid var(--border);
}

/* Present */
.present-backdrop{
  position:fixed; inset:0;
  background: rgba(255,253,244,.98);
  z-index:60;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.present{
  width:min(980px, 96vw);
  display:flex;
  flex-direction:column;
  gap:14px;
}
.present-top{
  display:flex; align-items:center; justify-content:space-between;
  background: var(--lemon);
  border:1px solid var(--border);
  border-radius: 18px;
  padding:12px 14px;
  box-shadow: var(--shadow);
}
.present-title{ font-weight:900; }
.present-actions{ display:flex; gap:8px; }
.present-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding:40px 34px;
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 360px;
}
.present-card .word{ font-size:72px; letter-spacing:1px; }
.present-nav{
  display:flex; align-items:center; justify-content:center;
  gap:14px;
}
.present-count{ font-weight:900; color: var(--muted); }

@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; height:auto; }
  .workspace-split{ grid-template-columns: 1fr; }
  .panel{ height:auto; }
}

/* ---------- PRINT STYLES ---------- */
@media print{
  :root{ --shadow:none; }
  body{ background:#fff !important; }
  .topbar, .layout, .present-backdrop, .modal-backdrop{ display:none !important; }
  /* print windows use their own HTML; this block is for safety */
}

/* Link modal extras */
.link-options{ display:flex; flex-direction:column; gap:10px; margin:10px 0 14px; }
.opt{ display:flex; gap:10px; align-items:center; font-size:13px; color: var(--text); }
.link-box{ display:flex; gap:10px; align-items:center; }
.link-box input{
  flex:1;
  padding:10px 10px;
  border-radius: 14px;
  border:1px solid rgba(31,41,55,.12);
  outline:none;
  font-size:13px;
}
