/* Flashcards editor/viewer polish. Loaded last on purpose to isolate the feature
   from broad button/svg rules used by the rest of the mini-app. */
.fc-modal.fc-editor-modal,
.fc-modal.fc-study-modal{box-sizing:border-box}

/* Never allow global mini-app button/icon rules to turn flashcard actions into tiles. */
.fc-modal.fc-editor-modal button,
.fc-modal.fc-study-modal button{width:auto!important;min-width:0!important;max-width:none!important;height:auto!important;min-height:36px!important;max-height:44px!important;aspect-ratio:auto!important;padding:8px 12px!important;border-radius:11px!important;font-size:14px!important;line-height:1.15!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;flex:0 0 auto!important;transform:none}
.fc-modal.fc-editor-modal button svg,
.fc-modal.fc-study-modal button svg{width:16px!important;height:16px!important;min-width:16px!important;max-width:16px!important;min-height:16px!important;max-height:16px!important;flex:0 0 16px!important;display:block!important}
.fc-modal.fc-editor-modal .fc-icon-btn,
.fc-modal.fc-study-modal .fc-icon-btn{width:36px!important;min-width:36px!important;max-width:36px!important;height:36px!important;min-height:36px!important;max-height:36px!important;padding:0!important;border-radius:11px!important;flex:0 0 36px!important}
.fc-modal.fc-editor-modal .fc-icon-btn svg,
.fc-modal.fc-study-modal .fc-icon-btn svg{width:17px!important;height:17px!important;min-width:17px!important;max-width:17px!important}

/* Modal density */
.fc-modal.fc-editor-modal{width:min(820px,100%)!important;padding:16px!important;border-radius:22px!important}
.fc-editor-modal .fc-modal-head{margin-bottom:14px!important;position:sticky;top:-16px;z-index:8;padding:12px 0 8px;background:linear-gradient(180deg,rgba(12,28,38,.99) 72%,rgba(12,28,38,0))}
.fc-editor-modal .fc-modal-head h2{font-size:22px!important;line-height:1.2!important}
.fc-editor-modal .fc-form-grid{gap:10px!important}
.fc-editor-modal .fc-field{gap:5px!important}
.fc-editor-modal .fc-field label{font-size:12px!important;line-height:1.25!important;color:#9bb3c0!important}
.fc-editor-modal .fc-field input,
.fc-editor-modal .fc-field select{min-height:40px!important;height:40px!important;padding:8px 11px!important;border-radius:11px!important;font-size:14px!important}
.fc-editor-modal .fc-field textarea{min-height:72px!important;padding:9px 11px!important;border-radius:11px!important;font-size:14px!important;line-height:1.45!important;resize:vertical}

/* Cover becomes a small media row instead of a giant upload tile. */
.fc-editor-modal .fc-cover-picker{display:grid!important;grid-template-columns:84px minmax(0,1fr)!important;grid-template-areas:"preview action" "preview hint"!important;align-items:center!important;column-gap:12px!important;row-gap:5px!important;padding:9px!important;border:1px solid rgba(111,211,255,.10)!important;border-radius:14px!important;background:rgba(255,255,255,.018)!important}
.fc-editor-modal .fc-cover-preview{grid-area:preview!important;width:84px!important;min-width:84px!important;max-width:84px!important;height:62px!important;min-height:62px!important;max-height:62px!important;aspect-ratio:auto!important;border-radius:11px!important;object-fit:cover!important}
.fc-editor-modal [data-upload-cover]{grid-area:action!important;justify-self:start!important;min-height:35px!important;max-height:35px!important;padding:7px 10px!important;font-size:13px!important}
.fc-editor-modal .fc-cover-picker .fc-upload-limit-hint{grid-area:hint!important;align-self:start!important}
.fc-upload-limit-hint{display:block!important;margin:0!important;padding:0!important;color:#7894a3!important;font-size:10.5px!important;font-weight:500!important;line-height:1.25!important;white-space:normal!important}

/* AI generation: compact tool panel, no giant spark button. */
.fc-editor-modal .fc-generator{margin:12px 0!important;padding:12px!important;border-radius:15px!important;background:linear-gradient(135deg,rgba(39,200,255,.065),rgba(55,224,178,.035))!important}
.fc-editor-modal .fc-generator-title{margin-bottom:9px!important;gap:7px!important;font-size:15px!important;line-height:1.25!important}
.fc-editor-modal .fc-generator-title svg{width:16px!important;height:16px!important;min-width:16px!important;max-width:16px!important}
.fc-editor-modal .fc-generator .fc-form-grid{grid-template-columns:minmax(0,1fr) 104px!important;gap:8px!important}
.fc-editor-modal .fc-generator .fc-field.full{grid-column:1/-1!important}
.fc-editor-modal .fc-generator textarea{min-height:78px!important;max-height:150px!important}
.fc-editor-modal .fc-generator .fc-actions{margin-top:9px!important;display:flex!important;justify-content:flex-end!important}
.fc-editor-modal [data-generate]{min-height:36px!important;max-height:36px!important;padding:7px 11px!important;font-size:13px!important}
.fc-inline-field-label{display:block;margin:0 0 4px;color:#7894a3;font-size:10.5px;font-weight:700;line-height:1}

/* Card editor: less whitespace and compact image actions. */
.fc-editor-modal .fc-section-title{margin:15px 0 8px!important}
.fc-editor-modal .fc-section-title h2{font-size:18px!important}
.fc-editor-modal .fc-section-title p{font-size:12px!important;line-height:1.4!important}
.fc-editor-count{display:inline-flex;align-items:center;margin-left:7px;padding:2px 7px;border-radius:999px;border:1px solid rgba(111,211,255,.14);background:rgba(39,200,255,.055);color:#9fc4d4;font-size:11px;font-weight:700;vertical-align:2px}
.fc-editor-modal .fc-editor-list{gap:9px!important;margin-top:9px!important}
.fc-editor-modal .fc-editor-card{padding:11px!important;border-radius:15px!important;background:rgba(255,255,255,.018)!important}
.fc-editor-modal .fc-editor-head{margin-bottom:8px!important}
.fc-editor-modal .fc-editor-number{font-size:11px!important}
.fc-editor-modal .fc-editor-head .fc-icon-btn{width:32px!important;min-width:32px!important;max-width:32px!important;height:32px!important;min-height:32px!important;max-height:32px!important;border-radius:9px!important}
.fc-editor-modal .fc-card-fields{gap:9px!important}
.fc-editor-modal .fc-card-fields textarea{min-height:88px!important}
.fc-editor-modal .fc-img-line{display:flex!important;align-items:center!important;gap:7px!important;flex-wrap:wrap!important;margin-top:6px!important;min-height:34px!important}
.fc-editor-modal .fc-mini-preview{width:38px!important;min-width:38px!important;max-width:38px!important;height:38px!important;min-height:38px!important;max-height:38px!important;border-radius:9px!important;object-fit:cover!important}
.fc-editor-modal [data-upload-card]{min-height:32px!important;max-height:32px!important;padding:6px 9px!important;border-radius:9px!important;font-size:12px!important}
.fc-editor-modal [data-upload-card] svg{width:14px!important;height:14px!important;min-width:14px!important;max-width:14px!important}
.fc-editor-modal .fc-img-line .fc-upload-limit-hint{flex:1 1 120px!important;min-width:100px!important}

/* Save/add actions stay reachable while scrolling but remain normal-sized. */
.fc-editor-modal > .fc-actions{position:sticky!important;bottom:-16px!important;z-index:9!important;display:grid!important;grid-template-columns:auto minmax(120px,1fr)!important;gap:8px!important;margin:14px -16px -16px!important;padding:10px 16px calc(10px + env(safe-area-inset-bottom))!important;border-top:1px solid rgba(111,211,255,.12)!important;background:linear-gradient(180deg,rgba(8,20,29,.88),rgba(7,18,26,.99) 28%)!important;backdrop-filter:blur(12px)!important}
.fc-editor-modal > .fc-actions [data-add-card],
.fc-editor-modal > .fc-actions [data-save]{min-height:40px!important;max-height:40px!important;height:40px!important;padding:8px 13px!important;border-radius:11px!important;font-size:14px!important}
.fc-editor-modal > .fc-actions [data-save]{width:100%!important}

/* Viewer/study mode also gets rid of oversized navigation/actions. */
.fc-modal.fc-study-modal{width:min(760px,100%)!important;padding:16px!important;border-radius:22px!important}
.fc-study-modal .fc-modal-head{margin-bottom:12px!important}
.fc-study-modal .fc-modal-head h2{font-size:21px!important}
.fc-study-modal .fc-flip{min-height:285px!important}
.fc-study-modal .fc-face{padding:20px!important;border-radius:20px!important}
.fc-study-modal .fc-face img{max-height:145px!important;margin-bottom:11px!important;border-radius:12px!important}
.fc-study-modal .fc-face p{font-size:clamp(17px,2.6vw,23px)!important;line-height:1.4!important}
.fc-study-modal .fc-study-nav{margin-top:10px!important}
.fc-study-modal .fc-study-nav .fc-btn{min-width:76px!important;min-height:35px!important;max-height:35px!important;padding:7px 10px!important;font-size:13px!important}
.fc-study-modal > .fc-actions{gap:7px!important;margin-top:12px!important}
.fc-study-modal > .fc-actions .fc-btn{min-height:36px!important;max-height:36px!important;padding:7px 10px!important;font-size:12.5px!important}

@media(max-width:760px){
  .fc-modal-backdrop{padding:8px!important;align-items:end!important}
  .fc-modal.fc-editor-modal,.fc-modal.fc-study-modal{width:100%!important;max-width:100%!important;max-height:90dvh!important;border-radius:20px 20px 14px 14px!important;padding:13px!important}
  .fc-editor-modal .fc-modal-head{top:-13px;margin-bottom:10px!important;padding-top:10px!important}
  .fc-editor-modal .fc-modal-head h2{font-size:20px!important}
  .fc-editor-modal .fc-form-grid{grid-template-columns:1fr!important}
  .fc-editor-modal .fc-field.full{grid-column:auto!important}
  .fc-editor-modal .fc-generator .fc-form-grid{grid-template-columns:minmax(0,1fr) 92px!important}
  .fc-editor-modal .fc-generator .fc-field.full{grid-column:1/-1!important}
  .fc-editor-modal .fc-card-fields{grid-template-columns:1fr!important}
  .fc-editor-modal .fc-card-fields textarea{min-height:78px!important}
  .fc-editor-modal > .fc-actions{bottom:-13px!important;margin:12px -13px -13px!important;padding:9px 13px calc(9px + env(safe-area-inset-bottom))!important}
  .fc-editor-modal > .fc-actions [data-add-card],.fc-editor-modal > .fc-actions [data-save]{min-height:38px!important;max-height:38px!important;height:38px!important;font-size:13px!important}
  .fc-study-modal .fc-flip{min-height:250px!important}
  .fc-study-modal .fc-face{padding:16px!important}
  .fc-study-modal .fc-face img{max-height:120px!important}
}

@media(max-width:430px){
  .fc-editor-modal .fc-cover-picker{grid-template-columns:72px minmax(0,1fr)!important}
  .fc-editor-modal .fc-cover-preview{width:72px!important;min-width:72px!important;max-width:72px!important;height:54px!important;min-height:54px!important;max-height:54px!important}
  .fc-editor-modal [data-upload-cover]{font-size:12px!important;padding:6px 9px!important}
  .fc-upload-limit-hint{font-size:10px!important}
  .fc-editor-modal > .fc-actions{grid-template-columns:auto 1fr!important}
  .fc-study-modal > .fc-actions{display:flex!important;overflow-x:auto!important;flex-wrap:nowrap!important;padding-bottom:2px!important;scrollbar-width:none!important}
  .fc-study-modal > .fc-actions::-webkit-scrollbar{display:none!important}
}
