/* Shuddho — design tokens and components, ported from Shuddho.dc.html. */

:root {
  --paper: #FBF9F5;
  --paper-2: #F2EFE8;
  --card: #FFFFFF;
  --ink: #171512;
  --ink-2: #544E45;
  --ink-3: #8D8579;
  --line: #E5E0D6;
  --mark: #0F7A6B;
  --mark-bg: rgba(15, 122, 107, .11);
  --mark-2: rgba(15, 122, 107, .24);
  --acc-bg: rgba(15, 122, 107, .07);
  --flag: #B4762A;
  --desk: #EAE6DE;
  --shadow: 0 1px 2px rgba(23, 21, 18, .06), 0 10px 30px rgba(23, 21, 18, .07);
  --fs: 'Anek Latin', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --fb: 'Anek Bangla', 'Noto Sans Bengali', serif;
}

[data-theme="dark"] {
  --paper: #141310;
  --paper-2: #1C1A16;
  --card: #1E1C17;
  --ink: #F1ECE2;
  --ink-2: #B5AD9E;
  --ink-3: #7E7667;
  --line: #2D2A24;
  --mark: #5FCFBC;
  --mark-bg: rgba(95, 207, 188, .15);
  --mark-2: rgba(95, 207, 188, .28);
  --acc-bg: rgba(95, 207, 188, .09);
  --flag: #E0A85C;
  --desk: #0C0B09;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 34px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--desk);
  color: var(--ink);
  font-family: var(--fs);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

a { color: var(--mark); text-decoration: none; }
a:hover { color: var(--ink); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
textarea { font: inherit; }
textarea::placeholder { color: var(--ink-3); opacity: 1; }
::selection { background: var(--mark-2); }

:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }

@keyframes pop  { from { opacity: 0; transform: translateY(-4px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); }            to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { transform: scale(1); } 45% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes blink { 0%, 100% { opacity: .25; } 50% { opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- frame ---------- */

#frame { height: 100%; width: 100%; }

.app {
  height: 100%;
  width: 100%;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Review mode only: the 360x760 device frame from the design file. */
body[data-frame="1"] #frame {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 26px 0 46px;
  overflow: auto;
}
body[data-frame="1"] .app {
  width: 360px;
  height: 760px;
  flex: none;
  border-radius: 30px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ---------- header ---------- */

.bar {
  flex: none;
  height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  z-index: 10;
}
[data-vp="desktop"] .bar { height: 62px; padding: 0 28px; }

.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-home {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 4px 6px;
  margin: 0 -6px;
  border-radius: 10px;
  transition: background .15s ease;
}
.brand-home:hover { background: var(--paper-2); }
.brand-home:active { background: var(--line); }
.brand-bn { font-family: var(--fb); font-size: 21px; font-weight: 600; line-height: 1; color: var(--mark); }
.brand-en { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.tagline {
  font-size: 13px;
  color: var(--ink-3);
  border-left: 1px solid var(--line);
  padding-left: 10px;
  margin-left: 2px;
}

.bar-actions { display: flex; align-items: center; gap: 6px; }
.nav { display: flex; align-items: center; gap: 2px; margin-right: 6px; }

.nav-btn {
  border: 0;
  background: transparent;
  color: var(--ink-3);
  border-radius: 9px;
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
}
.nav-btn.is-on { background: var(--paper-2); color: var(--ink); font-weight: 600; }

.pill {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 10px;
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
}
.icon-btn { font-size: 15px; }

/* ---------- screens ---------- */

.screen { flex: 1; min-height: 0; display: none; flex-direction: column; position: relative; }
.screen.is-on { display: flex; }

.doc { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 18px 40px; }
.doc-inner { max-width: 720px; margin: 0 auto; }
.doc-inner.narrow { max-width: 620px; }
.doc h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.doc .lede { margin: 0 0 18px; font-size: 14px; color: var(--ink-3); line-height: 1.5; }

/* ---------- banner ---------- */

.banner {
  flex: none;
  margin: 12px 14px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
[data-vp="desktop"] .banner { margin: 16px 28px 0; }
.banner-head { display: flex; gap: 10px; align-items: flex-start; }
.banner-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--flag); flex: none; margin-top: 7px; }
.banner-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
.banner-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; margin-top: 2px; }
.banner-actions { display: flex; gap: 8px; margin-top: 10px; padding-left: 18px; }

.btn-small {
  border: 0;
  background: var(--mark);
  color: var(--paper);
  border-radius: 9px;
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 600;
}
.btn-ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 9px;
  height: 36px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 500;
}

/* ---------- summary bar ---------- */

.summary {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
[data-vp="desktop"] .summary { padding: 10px 28px; }
.summary-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.summary-right { display: flex; align-items: center; gap: 4px; flex: none; }
.summary-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spin { width: 7px; height: 7px; border-radius: 50%; background: var(--mark); animation: blink 1s infinite; flex: none; }
.step-btn { width: 34px; padding: 0; font-size: 17px; background: var(--card); }
.accept-all {
  border: 0;
  background: var(--mark);
  color: var(--paper);
  border-radius: 10px;
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  margin-left: 2px;
}

/* ---------- composer ---------- */

.panes { flex: 1; min-height: 0; display: flex; flex-direction: column; }
[data-vp="desktop"] .panes { flex-direction: row; }

/* Holds the text and the বাংলা toggle that floats over its top-right corner. */
.editor-area { flex: 1; min-height: 0; min-width: 0; display: flex; position: relative; }

.scroll { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; position: relative; }

.bn-fab {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 16;
  height: 34px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink-2);
  box-shadow: 0 1px 2px rgba(23, 21, 18, .05);
}
.bn-fab span { font-family: var(--fb); font-size: 15px; line-height: 1; }
.bn-fab:hover { border-color: var(--ink-3); }
.bn-fab.is-on { background: var(--mark-bg); border-color: var(--mark); color: var(--mark); }
[data-vp="desktop"] .bn-fab { top: 16px; right: 20px; }

.composer { position: relative; min-height: 100%; width: 100%; margin: 0 auto; }
[data-vp="desktop"] .composer { max-width: 860px; }

.layer, .ta {
  font-family: var(--fs);
  font-size: 18.5px;
  line-height: 1.78;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  /* Extra right padding keeps text from running under the বাংলা toggle. */
  padding: 16px 84px 130px 16px;
}
[data-vp="desktop"] .layer,
[data-vp="desktop"] .ta { font-size: 20px; padding: 26px 30px 150px; }

/* On a wide desktop the composer is centred well clear of the toggle, so it
   only needs the gutter once the window is narrow enough for them to meet. */
@media (max-width: 1040px) {
  [data-vp="desktop"] .layer,
  [data-vp="desktop"] .ta { padding-right: 104px; }
}

.layer { position: absolute; inset: 0; color: var(--ink); pointer-events: none; }

.ta {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--mark);
  overflow: hidden;
}

/* marks */
.mk-pending { color: var(--ink-3); }
.mk-fix, .mk-low {
  position: relative;
  border-radius: 3px;
  color: var(--ink);
  background: var(--mark-bg);
  box-shadow: 0 0 0 2px var(--mark-bg);
  border-bottom: 2px solid var(--mark);
}
.mk-low { border-bottom-style: dashed; }
.mk-fix.is-active, .mk-low.is-active { background: var(--mark-2); box-shadow: 0 0 0 2px var(--mark-2); }
.mk-kept { position: relative; color: var(--ink); border-bottom: 1px dotted var(--ink-3); }
.mk-acc {
  position: relative;
  border-radius: 3px;
  background: var(--acc-bg);
  box-shadow: 0 0 0 2px var(--acc-bg);
  color: var(--ink);
}

[data-markstyle="underline"] .mk-fix,
[data-markstyle="underline"] .mk-low { background: none; box-shadow: none; }
[data-markstyle="fill"] .mk-fix,
[data-markstyle="fill"] .mk-low { border-bottom: 0; }

.dot {
  position: absolute;
  right: -3px;
  top: -7px;
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  border: 1.5px solid var(--flag);
  background: transparent;
  pointer-events: none;
}
.dot.is-flagged { background: var(--flag); }

/* popover */
.pop {
  position: absolute;
  z-index: 20;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: var(--shadow);
  animation: pop .16s ease-out;
}
.pop-label {
  font-size: 11px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.pop-row { display: flex; align-items: baseline; gap: 8px; }
.pop-raw { font-size: 15px; color: var(--ink-2); }
.pop-main { margin-top: 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pop-fix { font-size: 23px; font-weight: 600; letter-spacing: -.015em; color: var(--ink); }
.pop-bn { font-family: var(--fb); font-size: 21px; font-weight: 500; color: var(--mark); }
.pop-low { font-size: 12.5px; color: var(--flag); margin-top: 6px; line-height: 1.4; }
.pop-actions { display: flex; gap: 8px; margin-top: 14px; }
.keep-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 12px;
  height: 46px;
  font-size: 14.5px;
  font-weight: 500;
}
.accept-btn {
  flex: 1;
  border: 0;
  background: var(--mark);
  color: var(--paper);
  border-radius: 12px;
  height: 46px;
  font-size: 14.5px;
  font-weight: 600;
}

/* ---------- Bengali pane ---------- */

.bn-pane {
  flex: 0 0 42%;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--paper-2);
}
[data-vp="desktop"] .bn-pane { border-top: 0; border-left: 1px solid var(--line); }

.bn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.bn-head-title { display: flex; align-items: baseline; gap: 8px; }
.bn-head-bn { font-family: var(--fb); font-size: 16px; font-weight: 600; color: var(--ink); }
.eyebrow {
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.bn-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px 92px;
  font-family: var(--fb);
  font-size: 20px;
  line-height: 1.95;
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* ---------- intro, note, bottom bar ---------- */

.intro {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 92px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  animation: rise .3s ease-out;
  z-index: 12;
}
[data-vp="desktop"] .intro {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: 560px;
  bottom: 104px;
}
.intro-lede { font-size: 15px; font-weight: 500; line-height: 1.45; color: var(--ink); }
.intro-ex { display: flex; align-items: center; gap: 10px; margin-top: 10px; transition: opacity .22s ease; }
.ex-from { font-size: 15.5px; color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.ex-arrow { font-size: 13px; color: var(--ink-3); }
.ex-to { font-size: 15.5px; font-weight: 600; color: var(--ink); border-bottom: 2px solid var(--mark); }
.ex-bn { font-family: var(--fb); font-size: 16px; color: var(--mark); }

.note {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 92px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  animation: rise .2s ease-out;
  z-index: 14;
}
[data-vp="desktop"] .note { right: auto; left: 28px; max-width: 460px; bottom: 104px; }

.bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px 14px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  z-index: 15;
}
[data-vp="desktop"] .bottom { padding: 12px 28px 16px; }
.bottom-inner { display: flex; align-items: center; gap: 12px; margin: 0 auto; }
[data-vp="desktop"] .bottom-inner { max-width: 860px; }
.counts { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: none; }
.words-label { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.fixes-label { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.copy-btn {
  flex: 1;
  border: 0;
  border-radius: 13px;
  height: 50px;
  font-size: 15.5px;
  font-weight: 600;
  background: var(--mark);
  color: var(--paper);
  margin-left: auto;
}
[data-vp="desktop"] .copy-btn { max-width: 320px; }
.copy-btn.is-copied { background: var(--ink); animation: pulse .3s ease-out; }

/* ---------- history ---------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 28px 20px;
  text-align: center;
}
.empty-title { font-size: 15px; font-weight: 500; }
.empty-body { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }

.hist-item {
  width: 100%;
  text-align: left;
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  margin-bottom: 10px;
}
.hist-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.hist-when { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.hist-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mark);
  background: var(--mark-bg);
  border-radius: 20px;
  padding: 3px 9px;
  white-space: nowrap;
}
.hist-snip {
  font-size: 15px;
  line-height: 1.5;
  margin-top: 6px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hist-bn {
  font-family: var(--fb);
  font-size: 15px;
  line-height: 1.7;
  margin-top: 4px;
  color: var(--ink-3);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- about ---------- */

.about-lede { margin: 0 0 20px; font-size: 15.5px; line-height: 1.65; color: var(--ink-2); }
.about-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 20px;
}
.about-typed { font-size: 19px; color: var(--ink-2); margin-bottom: 12px; }
.about-bn { font-family: var(--fb); font-size: 22px; font-weight: 500; color: var(--mark); margin-bottom: 12px; }
.about-out { font-size: 19px; font-weight: 600; }
.about-list { display: flex; flex-direction: column; gap: 16px; }
.about-h { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.about-p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }

/* ---------- menu sheet ---------- */

.sheet-wrap {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .28);
  z-index: 40;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.sheet {
  background: var(--card);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding: 8px 8px 14px;
  animation: rise .18s ease-out;
}
.sheet-grip { height: 4px; width: 38px; border-radius: 2px; background: var(--line); margin: 6px auto 10px; }
.sheet-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 15px 14px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 12px;
  min-height: 50px;
}

/* ---------- review harness (?review=1 only) ---------- */

.review {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 60;
  background: rgba(20, 19, 16, .92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 14px;
  padding: 9px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.review-head { display: flex; align-items: center; gap: 8px; }
.review-label { font-size: 10px; letter-spacing: .14em; font-weight: 700; color: rgba(255, 255, 255, .45); }
.rbtn {
  border: 0;
  border-radius: 7px;
  height: 26px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .72);
}
.rbtn.is-on { background: rgba(255, 255, 255, .92); color: #14130F; }
.rbtn.tight { min-width: 26px; padding: 0 8px; }
.review-scens { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; max-width: 330px; }

.hidden { display: none !important; }
