/* 2026-09-11 15:12 */
/* Buttons, pills, cards, tag tree, modal, editor, toast, context menu, overlay. */

/* buttons and pills */
.btn {
  font-family: var(--mono); font-size: 13px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  padding: 7px 14px; border-radius: var(--radius_pill); cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease; white-space: nowrap;
}
.btn:hover { background: var(--panel_alt); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #c53a61; }
.btn.subtle { border-color: transparent; background: transparent; color: var(--text_muted); }
.btn.subtle:hover { color: var(--text); background: var(--panel_alt); }
.btn.danger { color: var(--danger); border-color: var(--accent_soft); }
.btn.icon { padding: 7px 10px; }
.btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.pill {
  font-family: var(--mono);
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 4px 10px; border-radius: var(--radius_pill);
  background: var(--panel_alt); border: 1px solid var(--border); color: var(--text_muted);
}
.pill.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pill.tag { background: var(--accent_soft); color: var(--text); border-color: transparent; }

/* search */
.search_input {
  width: 100%; font-family: var(--mono); font-size: 13px;
  padding: 8px 12px; border-radius: var(--radius_pill);
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.search_meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.field_pill { cursor: pointer; user-select: none; }

/* tag tree */
.tag_tools { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.tag_node {
  display: flex; align-items: center; gap: 6px; padding: 4px 6px;
  border-radius: 8px; cursor: pointer; user-select: none;
}
.tag_node:hover { background: var(--panel); }
.tag_node.selected { background: var(--accent); color: #fff; }
.tag_node.selected .count { color: #fff; }
.tag_node .twisty { width: 12px; text-align: center; color: var(--text_muted); }
.tag_node .name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag_node .count { color: var(--text_muted); font-size: 11px; }
.tag_pseudo { font-style: normal; color: var(--text); }

/* card list */
.list_head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.sort_select { font-family: var(--mono); font-size: 12px; border: 1px solid var(--border); border-radius: var(--radius_pill); padding: 5px 10px; background: var(--panel); }
.card_row {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); margin-bottom: 8px; cursor: pointer;
  display: flex; gap: 10px; align-items: flex-start;
}
.card_row:hover { border-color: var(--accent_soft); }
.card_row.cursor { border-color: var(--accent); box-shadow: var(--shadow); }
.card_row .q { flex: 1 1 auto; min-width: 0; }
.card_row .q .snippet { color: var(--text_muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card_row .flag { color: var(--accent); flex: 0 0 auto; }
.card_row .tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.empty { color: var(--text_muted); padding: 30px; text-align: center; }

/* detail */
.detail_bar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.md { line-height: 1.6; }
.md h1, .md h2, .md h3 { line-height: 1.25; }
.md pre { background: var(--panel_alt); padding: 10px; border-radius: 10px; overflow-x: auto; border: 1px solid var(--border); }
.md code { background: var(--panel_alt); padding: 1px 4px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md img { max-width: 100%; border-radius: 10px; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--border); padding: 4px 8px; }
.md blockquote { border-left: 3px solid var(--accent_soft); margin: 0; padding-left: 12px; color: var(--text_muted); }
.md .video_embed { position: relative; padding-bottom: 56.25%; height: 0; border-radius: 10px; overflow: hidden; }
.md .video_embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.answer_block { margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--border); }
.explanation_block { margin-top: 12px; color: var(--text); }
.section_label { font-size: 11px; color: var(--text_muted); margin-bottom: 4px; }

/* modal */
.scrim {
  position: fixed; inset: 0; background: rgba(42, 34, 38, 0.35);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; z-index: 50; overflow-y: auto;
}
.modal {
  background: var(--panel); border-radius: var(--radius); width: 100%; max-width: 680px;
  box-shadow: var(--shadow); border: 1px solid var(--border); padding: 18px;
}
.modal h2 { margin: 0 0 12px; font-size: 15px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text_muted); margin-bottom: 4px; }
.field textarea, .field input[type="text"] {
  width: 100%; font-family: var(--mono); font-size: 13px;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: var(--panel); color: var(--text); resize: vertical;
}
.field textarea { min-height: 70px; }
.modal_actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* editor toolbar and tag input */
.editor_toolbar { display: flex; gap: 4px; margin-bottom: 4px; flex-wrap: wrap; }
.editor_toolbar .btn { padding: 4px 8px; font-size: 12px; }
.editor_preview { border: 1px dashed var(--border); border-radius: 10px; padding: 10px; margin-top: 6px; }
.drop_hint { outline: 2px dashed var(--accent); outline-offset: -4px; }

.tag_editor { display: flex; flex-wrap: wrap; gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: var(--panel); }
.tag_chip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent_soft); border-radius: var(--radius_pill); padding: 2px 8px; font-size: 12px; }
.tag_chip button { border: 0; background: none; cursor: pointer; color: var(--text_muted); font-family: var(--mono); }
.tag_type { border: 0; outline: none; font-family: var(--mono); font-size: 13px; flex: 1 1 80px; min-width: 80px; background: none; color: var(--text); }
.autocomplete { position: relative; }
.autocomplete_menu { position: absolute; top: 100%; left: 0; right: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); z-index: 60; max-height: 220px; overflow-y: auto; }
.autocomplete_menu div { padding: 6px 10px; cursor: pointer; }
.autocomplete_menu div.active { background: var(--accent); color: #fff; }

/* context menu */
.context_menu {
  position: fixed; z-index: 70; background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow); padding: 4px; min-width: 160px;
}
.context_menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 7px 10px; font-family: var(--mono); font-size: 13px; cursor: pointer; border-radius: 7px; color: var(--text);
}
.context_menu button:hover { background: var(--panel_alt); }
.context_menu button.danger { color: var(--danger); }
.context_menu .sep { height: 1px; background: var(--border); margin: 4px 0; }

/* toast */
.toast_stack { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: #fff; padding: 8px 14px; border-radius: var(--radius_pill); font-size: 13px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; }
.toast.error { background: var(--danger); }
.toast button { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font-family: var(--mono); }

/* sync pill and dropdown */
.sync_pill { position: relative; }
.sync_dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text_muted); display: inline-block; }
.sync_dot.dirty { background: var(--accent); }
.sync_dot.error { background: var(--danger); }
.sync_dot.ok { background: #2e9e6b; }
.sync_menu { position: absolute; top: 110%; right: 0; width: 320px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 65; padding: 10px; }
.sync_log { max-height: 220px; overflow-y: auto; font-size: 11px; background: var(--panel_alt); border-radius: 8px; padding: 6px; margin-top: 8px; }
.sync_log div { padding: 2px 0; border-bottom: 1px solid var(--border); }
.sync_log div.err { color: var(--danger); }

/* hold overlay labels */
.overlay_label {
  position: absolute; z-index: 80; background: var(--text); color: #fff;
  font-size: 11px; padding: 1px 6px; border-radius: 6px; pointer-events: none;
  transform: translate(-50%, -120%);
}

/* login and pin */
.login_wrap { display: flex; align-items: center; justify-content: center; height: 100dvh; }
.login_card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; width: 300px; text-align: center; box-shadow: var(--shadow); }
.pin_dots { display: flex; gap: 10px; justify-content: center; margin: 18px 0; }
.pin_dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent_soft); }
.pin_dot.filled { background: var(--accent); border-color: var(--accent); }
.pin_input { position: absolute; opacity: 0; pointer-events: none; }

/* settings tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs .btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.settings_body { max-height: 60vh; overflow-y: auto; }
.setting_row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }


/* ---- fapp bank approved design additions ---- */
button { font-family: var(--mono); }
.btn.hamburger { font-size: 16px; line-height: 1; padding: 6px 11px; }
.tag_tools .tools_right { display: flex; gap: 6px; }
.pinned { position: sticky; top: 0; background: var(--panel_alt); z-index: 3; padding-bottom: 6px; margin: 0 0 6px; border-bottom: 1px solid var(--border); }
.tag_node.pseudo .name { text-transform: uppercase; letter-spacing: 0.6px; font-size: 12px; }
#tag_tree { font-size: var(--tag_font); }
#card_list, #detail_body, #test_body { font-size: var(--card_font); }
.browser_head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; gap: 8px; }
.browser_title { font-weight: 700; color: var(--text_muted); font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; }
#test_counter { font-size: 13px; color: var(--text_muted); }
.bar_spacer { flex: 1 1 auto; min-width: 8px; }
.card_row .question { white-space: normal; word-break: break-word; }
.card_row .ans_line { color: var(--text_muted); font-size: 12px; white-space: nowrap; overflow: hidden; margin-top: 3px; }
.card_row .ans_line:first-of-type { margin-top: 5px; }
.test_layout { display: flex; gap: 16px; align-items: flex-start; }
.test_content { flex: 1 1 auto; min-width: 0; }
.props { flex: 0 0 170px; border-left: 1px solid var(--border); padding-left: 12px; }
.props .prop_tag { margin-bottom: 5px; }
.modal.card_modal { max-width: none; width: min(1020px, 95vw); height: 95vh; display: flex; flex-direction: column; }
.modal.card_modal .field.grow { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; margin-bottom: 12px; }
.modal.card_modal .field.grow .ed { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.modal.card_modal .field.grow .ed textarea { flex: 1 1 auto; min-height: 120px; resize: none; }
@media (max-width: 720px) {
  .test_layout { flex-direction: column; }
  .props { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 10px; flex-basis: auto; width: 100%; }
}
