/* Feature layer — Projects (adaptive workspace + coding), Library, Settings. */

/* =====================================================================
   Projects
   ===================================================================== */
.create-box { border-radius: var(--r-xl); background: var(--surface-2); box-shadow: var(--composer-shadow); padding: var(--sp-2); }
.create-box textarea { width: 100%; min-height: 84px; max-height: 240px; resize: none; border: 0; background: transparent; padding: var(--sp-3) var(--sp-3) var(--sp-2); font-size: var(--fs-md); line-height: var(--lh-snug); color: var(--text); }
.create-box textarea:focus-visible { outline: none; }
.create-box:focus-within { box-shadow: var(--composer-shadow), 0 0 0 1px var(--accent-border); }
.create-bar { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-1) var(--sp-1); flex-wrap: wrap; }
.create-examples { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.create-examples button { font-size: var(--fs-sm); color: var(--text-2); padding: 6px var(--sp-3); border-radius: var(--r-pill); border: 1px solid var(--border-subtle); }
.create-examples button:hover { color: var(--text); border-color: var(--border-strong); }
.create-options { display: grid; gap: var(--sp-4); padding: var(--sp-4); margin-top: var(--sp-3); border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--surface-hover); }
.create-options .grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 600px) { .create-options .grid-2 { grid-template-columns: 1fr; } }
.style-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.style-card { display: grid; gap: 2px; padding: var(--sp-3); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface-2); text-align: start; font-size: var(--fs-sm); }
.style-card strong { font-weight: var(--fw-semibold); }
.style-card small { color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-snug); }
.style-card[aria-checked="true"] { border-color: var(--accent); background: var(--accent-softer); }
@media (max-width: 600px) { .style-cards { grid-template-columns: 1fr; } }
.detected { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-2); flex-wrap: wrap; }

.section-title { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-10) 0 var(--sp-3); font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: var(--text-2); }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: var(--sp-3); }
.project-card {
  display: grid; gap: var(--sp-2); align-content: start; min-height: 132px; padding: var(--sp-4);
  border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--surface-2);
  text-align: start; color: var(--text); text-decoration: none;
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast);
}
.project-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.project-card .kind { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-3); font-size: var(--fs-xs); }
.project-card .kind .icon { width: 16px; height: 16px; color: var(--accent-text); }
.project-card h3 { font-size: var(--fs-md); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.project-card p { font-size: var(--fs-sm); color: var(--text-2); line-height: var(--lh-snug); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card .foot { margin-top: auto; display: flex; gap: var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); }

.ws { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-5); }
.ws-head { display: flex; align-items: flex-start; gap: var(--sp-3); flex-wrap: wrap; }
.ws-head .ws-ic { width: 44px; height: 44px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.ws-head .ws-title { flex: 1; min-width: 12rem; }
.ws-head h1 { font-size: var(--fs-xl); font-weight: var(--fw-bold); overflow-wrap: anywhere; }
.ws-head p { color: var(--text-2); margin-top: var(--sp-1); font-size: var(--fs-sm); }
.ws-panels { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); }
.ws-card { padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--surface-2); display: grid; gap: var(--sp-3); align-content: start; }
.ws-card h2 { font-size: var(--fs-md); display: flex; align-items: center; gap: var(--sp-2); }
.ws-card h2 .icon { color: var(--text-3); width: 18px; height: 18px; }
.ws-list { display: grid; gap: 2px; }
.ws-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 42px; padding: 0 var(--sp-2); border-radius: var(--r-sm); color: var(--text); text-decoration: none; text-align: start; width: 100%; }
.ws-row:hover { background: var(--surface-hover); }
.ws-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-row small { color: var(--text-3); font-size: var(--fs-xs); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-sm); }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; }
.progress { height: 6px; border-radius: 6px; background: var(--surface-active); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }

/* Coding workspace (integrated Vibe Coding) */
.code-ws { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); min-height: 520px; }
.code-ws.is-solo { grid-template-columns: minmax(0, 1fr); }
.code-pane { display: flex; flex-direction: column; min-height: 0; border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--surface-2); overflow: hidden; }
.code-pane-head { display: flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-2) 0 var(--sp-3); border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.code-pane-head .title { flex: 1; font-size: var(--fs-sm); font-weight: var(--fw-medium); display: flex; align-items: center; gap: var(--sp-2); }
.code-pane-head .select { width: auto; min-height: 30px; font-size: var(--fs-sm); padding-block: 0; }
.code-editor { flex: 1; min-height: 360px; width: 100%; resize: none; border: 0; padding: var(--sp-4); background: var(--code-bg); color: var(--code-text); font-family: var(--font-mono); font-size: var(--fs-sm); line-height: 1.6; tab-size: 2; direction: ltr; text-align: left; }
.code-editor:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent-border); }
.code-preview { flex: 1; min-height: 360px; width: 100%; border: 0; background: #fff; }
.code-prompt { display: flex; gap: var(--sp-2); padding: var(--sp-2); border-top: 1px solid var(--border-subtle); align-items: flex-end; }
.code-prompt textarea { flex: 1; min-height: 40px; max-height: 140px; resize: none; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--bg); padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); color: var(--text); }
.code-status { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-xs); color: var(--text-3); border-top: 1px solid var(--border-subtle); }
@media (max-width: 900px) { .code-ws { grid-template-columns: minmax(0, 1fr); } .code-preview { min-height: 320px; } }

/* =====================================================================
   Library
   ===================================================================== */
.toolbar { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.toolbar .search { position: relative; flex: 1; min-width: 200px; }
.toolbar .search .icon { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 17px; height: 17px; }
.toolbar .search .input { padding-inline-start: 38px; min-height: 40px; }
.toolbar .select { width: auto; min-height: 40px; }
.filter-chips { display: flex; gap: var(--sp-1); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.filter-chips button { min-height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-pill); border: 1px solid var(--border); color: var(--text-2); font-size: var(--fs-sm); }
.filter-chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter-chips button .count { opacity: 0.7; margin-inline-start: 4px; font-size: var(--fs-xs); }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: var(--sp-3); }
.lib-item { display: flex; flex-direction: column; border-radius: var(--r-md); border: 1px solid var(--border-subtle); background: var(--surface-2); overflow: hidden; text-align: start; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.lib-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.lib-item .thumb { aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--surface-hover); overflow: hidden; }
.lib-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-item .info { display: grid; gap: 2px; padding: var(--sp-2) var(--sp-3) var(--sp-3); min-width: 0; }
.lib-item .info strong { font-size: var(--fs-sm); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-item .info small { color: var(--text-3); font-size: var(--fs-xs); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lib-list { display: grid; border-radius: var(--r-md); border: 1px solid var(--border-subtle); overflow: hidden; background: var(--surface-2); }
.lib-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--border-subtle); text-align: start; }
.lib-row:last-child { border-bottom: 0; }
.lib-row:hover { background: var(--surface-hover); }
.lib-row .thumb { width: 40px; height: 40px; border-radius: var(--r-sm); overflow: hidden; display: grid; place-items: center; background: var(--surface-hover); }
.lib-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.lib-row small { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
@media (max-width: 600px) { .lib-row { grid-template-columns: 40px minmax(0, 1fr) auto; } .lib-row .hide-sm { display: none; } }

/* =====================================================================
   Settings
   ===================================================================== */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-8); align-items: start; }
.settings-nav { position: sticky; top: 0; display: grid; gap: 2px; }
.settings-search { position: relative; margin-bottom: var(--sp-3); }
.settings-search .icon { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.settings-search .input { padding-inline-start: 34px; min-height: 38px; font-size: var(--fs-base); }
.settings-nav a { display: flex; align-items: center; gap: var(--sp-3); min-height: 38px; padding: 0 var(--sp-3); border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-size: var(--fs-base); }
.settings-nav a:hover { background: var(--surface-hover); color: var(--text); }
.settings-nav a[aria-current="true"] { background: var(--surface-active); color: var(--text); font-weight: var(--fw-medium); }
.settings-nav a .icon { width: 18px; height: 18px; }
.settings-section { scroll-margin-top: var(--sp-4); }
.settings-section + .settings-section { margin-top: var(--sp-10); }
.settings-section > h2 { font-size: var(--fs-lg); font-weight: var(--fw-bold); margin-bottom: var(--sp-1); }
.settings-section > .desc { color: var(--text-2); font-size: var(--fs-sm); margin-bottom: var(--sp-4); }
.setting-group { border-radius: var(--r-lg); border: 1px solid var(--border-subtle); background: var(--surface-2); }
.setting-group + .setting-group { margin-top: var(--sp-4); }
.setting { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-subtle); flex-wrap: wrap; }
.setting:last-child { border-bottom: 0; }
.setting .text { flex: 1; min-width: 14rem; display: grid; gap: 2px; }
.setting .text strong { font-size: var(--fs-md); font-weight: var(--fw-medium); }
.setting .text small { color: var(--text-3); font-size: var(--fs-sm); line-height: var(--lh-snug); }
.setting.is-block { display: grid; }
.setting.is-hidden-by-search { display: none; }
.setting-form { display: grid; gap: var(--sp-3); width: 100%; max-width: 30rem; }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); width: 100%; }
.theme-card { display: grid; gap: var(--sp-2); padding: var(--sp-2); border-radius: var(--r-md); border: 1px solid var(--border); text-align: center; font-size: var(--fs-sm); }
.theme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-swatch { height: 64px; border-radius: var(--r-sm); position: relative; overflow: hidden; border: 1px solid var(--border-subtle); }
.theme-swatch.is-dark { background: #151a18; }
.theme-swatch.is-light { background: #f5f4ed; }
.theme-swatch.is-system { background: linear-gradient(135deg, #f5f4ed 50%, #151a18 50%); }
.theme-swatch::before { content: ""; position: absolute; inset-inline: 12px; bottom: 10px; height: 14px; border-radius: 7px; background: var(--brand-emerald); opacity: 0.85; }
.theme-swatch::after { content: ""; position: absolute; inset-inline-start: 12px; top: 12px; width: 40%; height: 6px; border-radius: 3px; background: currentColor; opacity: 0.35; }
.theme-swatch.is-dark::after { color: #f1f4ef; } .theme-swatch.is-light::after { color: #1f2723; }
.shortcut-list { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-sm); width: 100%; }
.shortcut-list span:nth-child(even) { display: flex; gap: 4px; justify-content: flex-start; direction: ltr; }
@media (max-width: 860px) {
  .settings { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: var(--sp-1); padding-bottom: var(--sp-1); scrollbar-width: none; }
  .settings-nav .settings-search { display: none; }
  .settings-nav a { white-space: nowrap; flex: none; border: 1px solid var(--border-subtle); border-radius: var(--r-pill); }
  .setting { padding: var(--sp-4); }
  .theme-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
}
