@font-face {
  font-family: Inter;
  src: url('./inter-latin.woff2') format('woff2');
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

[hidden] { display: none !important; }
html:not(.js) .reveal { opacity: 1; transform: none; }
body.dialog-open { overflow: hidden; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.modal-card { max-height: calc(100dvh - 40px); overflow-y: auto; }


.device-stage { min-width: 0; }
.device-screen {
  font-family: Roboto, "Noto Sans", "Microsoft YaHei", sans-serif;
  text-align: left;
}
.device-screen[data-ambience="still"] { background: #F7F9FE; }
.device-screen[data-ambience="grid"] {
  background-color: #F7F9FE;
  background-image: linear-gradient(#1a73e80c 1px, transparent 1px), linear-gradient(90deg, #1a73e80c 1px, transparent 1px);
  background-size: 18px 18px;
}
.status-bar { position: relative; }
.camera-pill { width: 9px; height: 9px; position: absolute; left: 50%; transform: translateX(-50%); }
.app-logo { border-radius: 9px; flex: none; }
.app-header-row { gap: 6px; }
.app-title-inline { font-size: 19px; }
.app-slogan-inline { white-space: normal; padding-left: 6px; border-left: 1px solid var(--border-ink); }
.app-content { min-height: 0; overscroll-behavior: contain; }
.phone-panel { gap: 10px; }
.phone-textarea { font-size: 12px; }
.phone-ctx-input { max-width: 100%; }
.app-field { display: grid; gap: 3px; color: var(--ink-2); font-size: 10px; }
.app-field textarea { resize: vertical; }
.app-muted { color: var(--ink-2); font-size: 10.5px; }
.app-actions, .device-screen .mode-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.device-screen .page-h2 { font-size: 22px; }
.device-screen .recent-item { text-align: left; overflow-wrap: anywhere; }
.device-screen .seg-word,
.device-screen .seg-phrase { padding: 0; border: 0; background: transparent; font: inherit; color: inherit; border-bottom: 1.5px dashed var(--ink-2); }
.device-screen .seg-phrase { border-color: var(--phone-accent); }
.device-screen .lookup-btn-pill:disabled { background: #E7E9EF; color: #657082; }
.result-tag { border-radius: 20px; padding: 3px 8px; color: #1A4B89; background: var(--phone-accent-soft); font-size: 10px; font-weight: 650; }
.result-heading { display: flex; align-items: flex-start; gap: 7px; justify-content: space-between; margin: 7px 0; }
.result-heading h3 { font-size: 18px; font-weight: 750; overflow-wrap: anywhere; }
.result-heading button.lookup-btn-pill { flex-shrink: 0; max-width: 43%; }
#lookupResultCard h4 { font-size: 11.5px; margin-top: 9px; }
#lookupResultCard p { font-size: var(--read-size, 12px); color: var(--ink-2); margin-top: 3px; overflow-wrap: anywhere; }
.device-screen[data-read-size="medium"] { --read-size: 14px; }
.device-screen[data-read-size="large"] { --read-size: 16px; }
.result-details { margin-top: 8px; font-size: 11px; }
.result-details summary { color: var(--phone-accent); cursor: pointer; }
.result-details button { width: 100%; margin-top: 4px; }
.card-face #cardFrontText, .card-face #cardBackText { text-align: left !important; }
.flashcard-wrap { margin-bottom: 9px; }
.flashcard-wrap::before, .flashcard-wrap::after {
  content: ""; position: absolute; z-index: 0; border-radius: 22px; background: var(--phone-accent-soft);
  inset: 7px 8px -6px; pointer-events: none;
}
.flashcard-wrap::after { inset: 13px 17px -11px; z-index: -1; }
.lib-card { overflow-wrap: anywhere; }
.lib-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lib-title { background: none; border: 0; font-size: 13px; color: var(--ink); text-align: left; overflow-wrap: anywhere; font-weight: 700; }
.setting-body .pill-light { text-decoration: none; }
#updateStatus { margin: 0; }
#limitSlider { accent-color: var(--phone-accent); }
.floating-nav { isolation: isolate; }
.floating-nav::before {
  content: ""; position: absolute; z-index: -1; top: 5px; bottom: 5px; left: 5px;
  width: calc((100% - 10px) / 4); border-radius: 999px;
  background: var(--phone-accent-soft); transform: translateX(calc(100% * var(--nav-active, 0)));
  transition: transform .25s cubic-bezier(.2,0,0,1), width .25s cubic-bezier(.2,0,0,1);
}
.floating-nav .phone-tab { flex: 1; }
.floating-nav .phone-tab.active { background: transparent; }
.phone-overlay {
  position: absolute; z-index: 4; inset: 0; display: grid; align-items: end;
  background: rgba(15,23,42,.28); backdrop-filter: blur(3px);
}
.phone-sheet {
  display: grid; gap: 10px; background: #fff; padding: 14px; border-radius: 22px 22px 0 0;
  animation: sheetUp .28s var(--ease-out);
}
.sheet-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.phone-sheet .ocr-frame { padding: 12px; font-size: 13px; }
#cropText { margin-top: 5px; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-delay: 0ms !important;
    animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important;
  }
}
.print-library { display: none; }
@media print {
  body:has(.print-library) > :not(.print-library) { display: none !important; }
  body:has(.print-library) { padding: 0; background: #fff; }
  .print-library { display: block; }
  .print-library h2 { margin: 12pt 0 2pt; }
  @page { size: A4; margin: 16mm; }
}


#detailOverlay { overflow: hidden; }
.detail-sheet {
  width: 100%; max-height: 92%; grid-template-rows: auto minmax(0, 1fr); gap: 8px;
}
.detail-sheet.expandable {
  height: var(--sheet-height, 56%); grid-template-rows: auto auto minmax(0, 1fr);
  transition: height 240ms var(--ease-out);
}
.detail-sheet.expandable.expanded { height: var(--sheet-height, 92%); }
.detail-sheet.expandable.dragging { transition: none; }
.detail-sheet .sheet-heading { min-width: 0; }
#detailTitle { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.detail-icon {
  flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--bg); color: var(--ink-2); font: inherit;
}
#closeDetail { font-size: 18px; }
.detail-handle { height: 16px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.detail-handle::before { content: ''; width: 28px; height: 3px; border-radius: 99px; background: #CBD6E3; }
#detailContent {
  min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere;
  display: grid; align-content: start; gap: 8px; font-size: var(--read-size, 12px);
}
#detailContent .result-tag, #detailContent .ctx-link { justify-self: start; }
.detail-section h4 { margin-bottom: 3px; font-size: 11px; }
.detail-phonetics { font-size: 11px; color: var(--ink-2); }
.lib-title-row .pill-light { flex: none; }
.lib-card p { font-size: var(--read-size, 11px); }


/* Simulated Android screens */
.step-link { display: inline-block; margin-top: 7px; color: var(--accent); font-size: 12.5px; font-weight: 700; text-underline-offset: 3px; }
.mobile-bottom-bar .btn-primary { padding: 9px 16px; font-size: 12.5px; }
.device-screen {
  background:
    radial-gradient(ellipse at 24% 23%, #8aacfa42, transparent 52%),
    radial-gradient(ellipse at 89% 37%, #aaa4f139, transparent 48%),
    radial-gradient(ellipse at 42% 74%, #8cdaf23d, transparent 53%),
    #F5F7FC;
  touch-action: pan-y;
}
.app-content { position: relative; overflow: hidden; padding: 0; }
.app-content .phone-panel {
  position: absolute; inset: 0;
  padding: 8px 14px 76px;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-width: none; animation: none;
}
.app-content .phone-panel.leaving { display: flex; pointer-events: none; }
.app-content .phone-panel.active { z-index: 1; }
.device-screen .lexi-card { background: rgba(255,255,255,.82); }
.lookup-home {
  display: flex; flex-direction: column; gap: 9px;
  transform: translateY(98px); transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.lookup-home.at-top { transform: translateY(0); }
.lookup-wordmark {
  align-self: center; font: bold 53px/.99 Georgia, "Times New Roman", serif; letter-spacing: -.055em;
  height: 60px; margin-bottom: 17px; color: transparent;
  background: linear-gradient(90deg,#1B4F90,#217C83,#2C64CF);
  background-clip: text; transition: height .28s, opacity .2s, margin .28s;
}
.lookup-home.at-top .lookup-wordmark { height: 0; opacity: 0; margin: 0; overflow: hidden; }
.lookup-composer { position: relative; }
.lookup-pill {
  display: flex; align-items: center; gap: 3px; min-height: 46px; padding: 2px 5px;
  border-radius: 999px; background: rgba(255,255,255,.85); border: 1px solid #fff;
  box-shadow: 0 7px 20px #2847600e;
}
.lookup-pill input {
  min-width: 0; flex: 1; border: none; background: transparent; color: var(--ink);
  font: inherit; font-size: 12px; padding: 7px 0; text-overflow: ellipsis;
}
.lookup-pill input:focus { outline: none; }
.lookup-pill:focus-within { outline: 1px solid var(--phone-accent-soft); }
.lookup-pill input::-webkit-search-cancel-button { display: none; }
.lookup-icon {
  flex: none; display: grid; place-items: center; width: 31px; height: 34px;
  border: 0; border-radius: 50%; background: transparent; color: #455468;
}
.lookup-icon:hover, .lookup-icon[aria-expanded=true] { background: #E7ECF2; }
.lookup-icon svg { width: 19px; height: 19px; }
.lookup-pill:has(input:not(:placeholder-shown)) #mockLookupBtn { color: var(--phone-accent); }
.lookup-menu {
  position: absolute; z-index: 2; right: 2px; top: 42px; min-width: 168px;
  border-radius: 7px; padding: 4px; background: #EDF2F9; box-shadow: 0 4px 10px #18253527;
}
.lookup-menu .recent-item { width: 100%; min-height: 33px; padding-inline: 10px; }
#lookupRecent { padding: 0; border-radius: 23px; overflow: hidden; }
#lookupRecent .recent-header { min-height: 40px; padding: 3px 13px; font-size: 12px; font-weight: 600; }
#lookupRecent .recent-header[aria-expanded=true] { background: #e8eaf0b0; }
#recentList { padding: 6px 10px 10px; margin: 0; }
#recentList .recent-item { background: #EDF2F7; border-radius: 10px; margin-top: 4px; width: 100%; }
#recentList .history-more { width: 100%; background: #E8EFF7; border-radius: 20px; padding: 6px; margin-top: 7px; }
.suggestions { margin-top: 6px; max-height: 226px; overflow: auto; padding: 3px 9px; }
.suggestion-row { display: flex; min-height: 39px; align-items: stretch; border-bottom: 1px solid #EDF2F8; }
.suggestion-row:last-child { border-bottom: 0; }
.suggestion-word, .suggestion-fill { border: 0; background: none; color: var(--ink); font: inherit; }
.suggestion-word { flex: 1; min-width: 0; text-align: left; padding: 7px 2px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-word strong { color: var(--phone-accent); }
.suggestion-word small { margin-left: 8px; color: var(--ink-2); font-size: 10px; }
.suggestion-fill { width: 28px; font-size: 16px; }
.phone-back { align-self: flex-start; padding: 2px 6px; min-height: 26px; }
#panel-result .lookup-btn-pill.saved { background: var(--phone-accent-soft); color: var(--phone-accent); }
#spellingNotice { background: var(--phone-accent-soft); padding: 9px; font-size: 11px; }
#spellingNotice button { display: block; margin-top: 3px; }
.page-h2 { display: flex; align-items: center; gap: 7px; min-height: 32px; }
.page-h2 .page-icon { width: 18px; height: 18px; color: var(--phone-accent); }
.app-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.app-search { min-height: 38px; border-radius: 999px; }
.phone-date-group { margin-bottom: 8px; }
.date-accordion-toggle {
  list-style: none; position: relative; padding: 8px 24px 8px 10px; border-radius: 10px;
  background: #EDF2F8; color: #455468; font-size: 11px; cursor: pointer;
}
.date-accordion-toggle::after { content: '⌄'; position: absolute; right: 9px; top: 7px; transition: transform .22s var(--ease-out); }
.date-accordion-toggle[aria-expanded=true]::after { transform: rotate(180deg); }
.history-entry, .lib-card { margin-top: 6px; width: 100%; }
.history-entry { min-height: 36px; background: #fff; }
.lib-card { display: flex; align-items: center; gap: 8px; min-height: 47px; text-align: left; color: var(--ink); }
.lib-entry-text { min-width: 0; flex: 1; line-height: 1.32; }
.lib-entry-text strong, .lib-entry-text small { display: block; }
.lib-entry-text strong { font-size: 13px; }
.lib-entry-text small { margin-top: 2px; }
.lib-kind-dot { width: 6px; height: 6px; border-radius: 50%; background: #1A73E8; flex: none; }
.lib-kind-dot.kind-phrase { background: #8B5CF6; }
.lib-kind-dot.kind-sentence { background: #10B981; }
.lib-card[aria-pressed]::before, .history-entry[aria-pressed]::before {
  content: ''; width: 13px; height: 13px; flex: none; border: 1.5px solid #63748a; border-radius: 50%;
}
.lib-card[aria-pressed=true]::before, .history-entry[aria-pressed=true]::before {
  border: 4px solid var(--phone-accent); background: #fff;
}
#libFilterPills {
  position: relative; isolation: isolate; gap: 3px; padding: 4px; flex-wrap: nowrap;
  background: #ffffffce; border: 1px solid #fff; border-radius: 999px;
}
#libFilterPills .mode-pill { flex: 1; min-width: 0; background: transparent; padding: 7px 2px; }
#libFilterPills::before {
  content: ''; position: absolute; z-index: -1; inset: 4px auto 4px 4px;
  width: calc((100% - 8px)/3); border-radius: 999px; background: var(--phone-accent-soft);
  transform: translateX(calc(100% * var(--filter-active,0))); transition: transform .28s var(--ease-out);
}
#libraryOverview { padding: 7px 11px; font-size: 12px; }
.manage-actions {
  position: sticky; z-index: 1; bottom: -2px; margin-top: auto; padding: 6px 5px;
  border: 1px solid #fff; border-radius: 999px; background: #fffef9ed; backdrop-filter: blur(12px);
}
.manage-actions > button { flex: 1; white-space: nowrap; min-height: 29px; }
.device-screen .pill-light:disabled { color: #8792A0; background: #E2E6EB; }
.device-screen .danger:not(:disabled) { color: #9D291C; }
.managing-library .floating-nav { visibility: hidden; }
.managing-library #panel-library { padding-bottom: 12px; }
.floating-nav::before { width: calc((100% - 10px) / var(--nav-count, 4)); }
#panel-settings .setting-card { flex: none; padding: 0; overflow: hidden; }
#panel-settings .setting-card:not(.open) { border-radius: 999px; }
#panel-settings .setting-header { min-height: 42px; padding: 8px 13px; transition: background-color .22s var(--ease-out); }
#panel-settings .setting-card.open .setting-header { background: #E8EBF1; }
#panel-settings .setting-body { margin-top: 0; padding: 10px 13px 13px; border-top: 0; }
.setting-trailing { display: inline-flex; align-items: center; gap: 7px; }
#dailyLimitOptions { gap: 6px; }
.photo-page { z-index: 6; align-items: stretch; background: #F4F7FC; backdrop-filter: none; }
.photo-page .phone-sheet { display: flex; flex-direction: column; border-radius: 0; background: transparent; animation: phoneForward .28s cubic-bezier(.4,0,.2,1); }
.photo-page .sheet-heading { justify-content: flex-start; min-height: 36px; }
.photo-page .sheet-heading strong { order: 2; font-size: 14px; }
.photo-page #photoSources { display: grid; gap: 8px; margin: auto 0; }
.photo-page #photoSources button { min-height: 40px; background: #fff; color: var(--phone-accent); }
.photo-page #cropPreview { margin: auto 0; }
#cropPreview > p { margin-top: 9px; }
.crop-canvas {
  position: relative; display: grid; place-items: center; aspect-ratio: 1.03; overflow: hidden;
  background: #fff; border-radius: 8px; padding: 12px;
}
#cropText { color: #172231; font-size: 16px; line-height: 1.35; text-align: center; }
.crop-frame {
  position: absolute; border: 1.5px solid var(--phone-accent);
  box-shadow: 0 0 0 530px #0f172b42; cursor: grab; touch-action: none;
}
.crop-frame i { position: absolute; width: 12px; height: 12px; background: #fff; border: 2px solid var(--phone-accent); border-radius: 50%; }
.crop-frame i[data-corner=nw] { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-frame i[data-corner=ne] { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-frame i[data-corner=sw] { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-frame i[data-corner=se] { bottom: -6px; right: -6px; cursor: nwse-resize; }
#recognizeBtn { min-height: 36px; }
@keyframes phoneForward { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 880px) {
  .mobile-bottom-bar { bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal-card { width: 100%; max-width: 460px; border-radius: 26px 26px 0 0; animation: sheetUp .28s var(--ease-out); padding-bottom: max(26px, env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.dialog-open .toast { bottom: auto; top: 20px; }
}
@media (max-width: 460px) {
  .container { padding-inline: 16px; }
  .cta-row { gap: 7px; }
  .cta-row .btn-primary, .cta-row .btn-secondary { font-size: 12px; padding-inline: 11px; }
  .stage-container { padding: 12px; }
  .stage-visual { padding: 11px; }
  .stage-visual .ctx-pill { padding-inline: 7px; }
  #scene-3 .scene-card > div:last-child { flex-wrap: wrap; }
  .device-bezel { width: min(300px, calc(100vw - 34px)); }
}

#recentList .recent-item { display: grid; gap: 1px; } 
#recentList .recent-item small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } 

#panel-library { overflow: hidden; }
#libItemsContainer { flex: 1; min-height: 0; overflow-y: auto; }

.floating-nav { z-index: 3; }

.mobile-bottom-bar { gap: 10px; }
.mobile-bottom-bar strong, .mobile-bottom-bar small { display: block; }
.mobile-bottom-bar strong { font-size: 12px; }
.mobile-bottom-bar small { font-size: 10.5px; color: var(--ink-3); }
.mobile-bottom-bar .btn-primary { flex: none; white-space: nowrap; }

/* A single column whose height can reverse mid-transition. */
.accordion-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 225ms cubic-bezier(.2,0,0,1);
}
.accordion-panel.open { grid-template-rows: 1fr; }
.accordion-clip {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 160ms ease-out;
}
.accordion-panel.open > .accordion-clip { opacity: 1; }
.accordion-chevron {
  display: inline-block;
  transition: transform .22s var(--ease-out);
}
[aria-expanded=true] .accordion-chevron { transform: rotate(180deg); }
.app-content .phone-panel { overflow-anchor: none; }
.setting-header { gap: 6px; }
.date-accordion-toggle, .result-accordion-toggle { width: 100%; text-align: left; border: 0; }
#libraryOverview .date-accordion-toggle { padding: 4px 18px 4px 0; background: transparent; }
#libraryOverview .date-accordion-toggle::after { top: 3px; right: 1px; }
#libraryOverviewText { padding-block: 3px; }
.result-accordion-toggle { background: transparent; color: var(--phone-accent); padding: 3px 0; }
.result-accordion-toggle::before { content: '▸'; display: inline-block; margin-right: 5px; transition: transform .22s var(--ease-out); }
.result-accordion-toggle[aria-expanded=true]::before { transform: rotate(90deg); }

.floating-nav {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);
  gap: 0;
  transition: grid-template-columns .25s cubic-bezier(.2,0,0,1);
}
.floating-nav .phone-tab { min-width: 0; }
.floating-nav [data-tab=review] { padding-inline: 0; overflow: hidden; transition: opacity .16s ease-out; }
.device-screen[data-review=off] .floating-nav {
  grid-template-columns: minmax(0,1fr) minmax(0,0fr) minmax(0,1fr) minmax(0,1fr);
}
.device-screen[data-review=off] .phone-tab[data-tab=review] { opacity: 0; pointer-events: none; }

.nav-download { border: 0; }
.dl-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.download-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  max-width: 270px;
  padding: 36px 24px 24px;
}
.download-close {
  position: absolute; top: 7px; right: 7px; display: grid; place-items: center;
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.download-close:hover { background: var(--bg); color: var(--ink); }
.download-qr-hint { font-size: 14px; color: var(--ink-2); }
.download-qr { display: block; width: min(196px, 52dvh, 100%); height: auto; }
.download-card .btn-primary { width: 100%; }
@media (max-width: 880px) {
  .download-card { max-width: 300px; }
}
