@font-face {
  font-family: "Daf to Deck Frank";
  src: url("/fonts/FrankRuehlCLM-Medium.otf?v=1.3.0") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Daf to Deck Rashi";
  src: url("/fonts/Rashi-Regular.ttf?v=1.3.0") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Daf to Deck Paleo";
  src: url("/fonts/Hebrew-Paleo-Siloam.ttf?v=1.3.0") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

:root {
  --paper: #f4efe5;
  --paper-deep: #e9dfcf;
  --card: #fffdf8;
  --ink: #182d2b;
  --ink-soft: #5f6f6c;
  --teal: #174d47;
  --teal-bright: #246b61;
  --teal-pale: #e6f0ec;
  --gold: #b57a31;
  --gold-pale: #f4e5ca;
  --wine: #7a3e3b;
  --blue: #425e78;
  --line: #d8cfbf;
  --shadow: 0 24px 60px rgba(37, 43, 37, 0.13);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 17% 8%, rgba(255,255,255,.9), transparent 27rem),
    linear-gradient(125deg, #f6f1e8 0%, #eee5d8 100%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button,
select,
label {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.library-wall {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  opacity: .5;
  pointer-events: none;
}

.library-wall::before,
.library-wall::after {
  position: absolute;
  content: "";
  width: 260px;
  height: 78px;
  border-radius: 5px 5px 0 0;
  background:
    linear-gradient(90deg,
      #7e4b3d 0 18px, #d5a658 18px 23px,
      #315c59 23px 56px, #254845 56px 61px,
      #926345 61px 78px, #dfb660 78px 83px,
      #535170 83px 113px, #393a55 113px 119px,
      #a35045 119px 142px, #d2a158 142px 148px,
      #426c63 148px 179px, #2f514b 179px 184px,
      #8b5a41 184px 202px, #d9ad61 202px 207px,
      #3d5a75 207px 238px, #263e55 238px 244px,
      #875044 244px 260px);
  box-shadow: 0 9px 0 #8a6848, 0 14px 8px rgba(80, 57, 35, .22);
  filter: saturate(.65);
}

.library-wall::before {
  left: -70px;
  top: 105px;
  transform: rotate(-4deg);
}

.library-wall::after {
  right: -78px;
  top: 430px;
  transform: rotate(5deg);
}

.shelf {
  position: absolute;
  right: 2%;
  width: 180px;
  height: 46px;
  border-bottom: 7px solid rgba(117, 81, 47, .22);
  background: repeating-linear-gradient(
    90deg,
    transparent 0 7px,
    rgba(49, 82, 75, .17) 7px 20px,
    transparent 20px 25px,
    rgba(139, 80, 61, .15) 25px 38px,
    transparent 38px 44px
  );
}

.shelf-one { top: 75px; right: 8%; }
.shelf-two { top: 760px; left: 1%; }
.shelf-three { top: 1180px; right: 3%; }

.app-shell {
  width: min(1440px, calc(100% - 36px));
  margin: 18px auto 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 18px;
  border: 1px solid rgba(216, 207, 191, .8);
  border-radius: 18px;
  background: rgba(255, 253, 248, .82);
  box-shadow: 0 10px 30px rgba(65, 57, 46, .06);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}

.brand strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.05;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 37px;
  height: 39px;
  padding: 5px 5px 4px;
  border-radius: 9px;
  background: var(--teal);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.1);
}

.brand-mark span {
  width: 8px;
  border-radius: 2px 2px 1px 1px;
  background: #f2d7a7;
}

.brand-mark span:nth-child(1) { height: 23px; }
.brand-mark span:nth-child(2) { height: 28px; background: #fff5df; }
.brand-mark span:nth-child(3) { height: 20px; background: #cda261; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  color: var(--teal);
  border: 1px solid #cfdfd9;
  border-radius: 999px;
  background: #f4faf7;
  font-size: 12px;
  font-weight: 700;
}

.local-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3aa57e;
  box-shadow: 0 0 0 4px rgba(58,165,126,.12);
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  font-weight: 800;
  cursor: pointer;
}

.icon-button:hover {
  color: white;
  border-color: var(--teal);
  background: var(--teal);
}

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 286px;
  margin: 18px 0;
  padding: 48px clamp(28px, 5vw, 72px);
  overflow: hidden;
  color: #f8f1e6;
  border-radius: 28px;
  background:
    radial-gradient(circle at 88% 12%, rgba(214, 172, 96, .22), transparent 20rem),
    linear-gradient(125deg, #113b38 0%, #1c514a 58%, #315c50 100%);
  box-shadow: var(--shadow);
}

.hero::before {
  position: absolute;
  inset: 0;
  content: "";
  opacity: .35;
  background-image:
    linear-gradient(115deg, transparent 0 54%, rgba(255,255,255,.035) 54% 55%, transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.08) 0 1px, transparent 1.5px);
  background-size: auto, 18px 18px;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .17em;
}

.hero .eyebrow {
  color: #e5bc75;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 72px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: .98;
}

.hero-copy > p:not(.eyebrow) {
  max-width: 610px;
  margin: 18px 0 23px;
  color: rgba(248, 241, 230, .8);
  font-size: 16px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-pills span {
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: rgba(255,255,255,.8);
  background: rgba(255,255,255,.06);
  font-size: 11px;
  font-weight: 700;
}

.hero-books {
  position: relative;
  align-self: flex-end;
  display: flex;
  align-items: flex-end;
  min-width: 310px;
  height: 190px;
  margin-left: 40px;
  padding: 0 28px;
  border-bottom: 14px solid #b58b55;
  filter: drop-shadow(0 18px 12px rgba(0,0,0,.22));
}

.book {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  margin-right: 7px;
  border-radius: 5px 7px 2px 2px;
  border: 2px solid rgba(255,255,255,.12);
  box-shadow: inset 7px 0 10px rgba(255,255,255,.08), inset -7px 0 10px rgba(0,0,0,.12);
}

.book::before,
.book::after {
  position: absolute;
  left: 5px;
  right: 5px;
  height: 2px;
  content: "";
  background: rgba(242, 215, 167, .58);
}

.book::before { top: 15px; }
.book::after { bottom: 15px; }

.book span {
  writing-mode: vertical-rl;
  color: #f2d7a7;
  font-family: "Arial Hebrew", "Noto Sans Hebrew", serif;
  font-size: 18px;
  letter-spacing: .09em;
}

.b1 { height: 139px; background: #713c39; transform: rotate(-2deg); }
.b2 { width: 59px; height: 168px; background: #394f6a; }
.b3 { height: 153px; background: #7e5a35; transform: rotate(1deg); }
.b4 { width: 49px; height: 128px; background: #4b6f61; }

.bookend {
  width: 12px;
  height: 115px;
  margin-left: 7px;
  border-radius: 2px;
  background: #d2ad71;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
  align-items: start;
}

.main-column {
  min-width: 0;
}

.panel,
.deck-panel {
  border: 1px solid rgba(216, 207, 191, .95);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .96);
  box-shadow: 0 16px 45px rgba(64, 57, 47, .08);
}

.panel {
  padding: clamp(24px, 4vw, 42px);
}

.panel + .panel {
  margin-top: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 28px;
}

.panel-heading h2,
.deck-panel h2,
.preview-heading h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -.025em;
}

.panel-heading h2 {
  font-size: clamp(27px, 4vw, 38px);
}

.step-number {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  color: var(--teal);
  border: 1px solid #c8dbd4;
  border-radius: 50%;
  background: var(--teal-pale);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
}

.selection-grid {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 16px;
}

.field {
  display: block;
}

.field > span,
.source-choices legend {
  display: block;
  margin: 0 0 8px;
  color: #40504d;
  font-size: 12px;
  font-weight: 800;
}

.field small {
  display: block;
  margin-top: 7px;
  color: #7a8582;
  font-size: 10px;
}

.field code {
  color: var(--teal);
  font-size: 10px;
}

select,
input[type="text"] {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  color: var(--ink);
  border: 1px solid #d9d1c5;
  border-radius: 12px;
  outline: none;
  background: #fff;
}

select {
  cursor: pointer;
}

select:hover,
input[type="text"]:hover {
  border-color: #b9afa0;
}

select:focus,
input[type="text"]:focus {
  border-color: var(--teal-bright);
  box-shadow: 0 0 0 4px rgba(36, 107, 97, .12);
}

.source-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0 0;
  padding: 0;
  border: 0;
}

.source-choices legend {
  grid-column: 1 / -1;
}

.source-choice {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 76px;
  gap: 12px;
  padding: 13px;
  border: 1px solid #dbd4c9;
  border-radius: 14px;
  background: #fbf9f4;
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.source-choice:hover {
  transform: translateY(-1px);
  border-color: #bcb2a4;
}

.source-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-choice:has(input:checked) {
  border-color: var(--teal);
  background: #f0f7f4;
  box-shadow: 0 0 0 1px var(--teal);
}

.choice-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: transparent;
  border: 1.5px solid #b4afa5;
  border-radius: 7px;
  background: white;
  font-size: 14px;
  font-weight: 900;
}

.source-choice input:checked + .choice-check {
  color: white;
  border-color: var(--teal);
  background: var(--teal);
}

.source-choice strong,
.source-choice small {
  display: block;
}

.source-choice strong {
  font-size: 13px;
}

.source-choice small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-family: "Arial Hebrew", "Noto Sans Hebrew", serif;
  font-size: 14px;
  direction: rtl;
}

.gemara-choice:has(input:checked) { border-top-color: var(--gold); }
.rashi-choice:has(input:checked) { border-top-color: var(--wine); }
.tosafot-choice:has(input:checked) { border-top-color: var(--blue); }

.commentary-font-field {
  max-width: 430px;
  margin-top: 18px;
}

.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 23px 0;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid #e4ddd2;
  border-radius: 12px;
  background: #faf8f3;
  cursor: pointer;
}

.switch-line > input {
  position: absolute;
  opacity: 0;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: #c8c8c3;
  transition: background .18s ease;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  content: "";
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  transition: transform .18s ease;
}

.switch-line input:checked + .switch {
  background: var(--teal-bright);
}

.switch-line input:checked + .switch::after {
  transform: translateX(16px);
}

.switch-line input:disabled + .switch {
  opacity: .45;
}

.switch-line:has(input:disabled) {
  cursor: not-allowed;
  opacity: .72;
}

.switch-line strong,
.switch-line small {
  display: block;
}

.switch-line strong {
  font-size: 11px;
}

.switch-line small {
  margin-top: 2px;
  color: #7e8885;
  font-size: 9px;
}

.primary-button,
.secondary-button,
.combine-button,
.generate-button,
.text-button {
  border: 0;
  cursor: pointer;
}

.primary-button,
.secondary-button,
.combine-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 17px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 800;
}

.primary-button {
  color: white;
  background: var(--teal);
  box-shadow: 0 8px 18px rgba(23, 77, 71, .18);
}

.primary-button:hover {
  background: #0f3e3a;
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--teal);
  border: 1px solid #cbd7d3;
  background: white;
}

.secondary-button:hover {
  border-color: var(--teal);
  background: #f2f8f5;
}

.combine-button {
  color: #6f491b;
  border: 1px solid #d8ba82;
  background: var(--gold-pale);
}

.combine-button:hover {
  border-color: var(--gold);
  background: #f7dfb7;
  transform: translateY(-1px);
}

.primary-button.large {
  width: 100%;
  min-height: 56px;
  justify-content: space-between;
  padding: 0 21px;
  border-radius: 13px;
  font-size: 13px;
}

.primary-button.full {
  width: 100%;
}

.primary-button:disabled,
.secondary-button:disabled,
.combine-button:disabled {
  cursor: wait;
  opacity: .65;
  transform: none;
}

.combine-button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.button-arrow {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  font-size: 17px;
}

.primary-button.is-loading .button-label::after {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 9px;
  content: "";
  vertical-align: -2px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.source-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 22px;
  padding: 14px;
  border: 1px solid #d9dfd8;
  border-radius: 12px;
  background: #f4f7f3;
}

.source-status.warning {
  border-color: #e5cfab;
  background: #fbf4e8;
}

.source-status-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: white;
  border-radius: 50%;
  background: var(--teal-bright);
  font-family: Georgia, serif;
  font-weight: 800;
}

.source-status.warning .source-status-icon {
  background: var(--gold);
}

.source-status strong {
  display: block;
  font-size: 12px;
}

.source-status p {
  margin: 3px 0 5px;
  color: var(--ink-soft);
  font-size: 10px;
}

.source-status a {
  color: var(--teal);
  font-size: 10px;
  font-weight: 800;
}

.text-preview {
  margin-top: 28px;
  padding-top: 27px;
  border-top: 1px solid #e5ded3;
}

.preview-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.preview-heading h3 {
  font-size: 24px;
}

.preview-heading > span {
  padding: 5px 9px;
  color: var(--ink-soft);
  border-radius: 999px;
  background: #f0ece5;
  font-size: 9px;
  font-weight: 800;
}

.preview-list {
  overflow: hidden;
  border: 1px solid #e0d8cc;
  border-radius: 14px;
}

.preview-list details + details {
  border-top: 1px solid #e7e0d6;
}

.preview-list summary {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 55px;
  padding: 0 15px;
  list-style: none;
  background: #fbf9f5;
  cursor: pointer;
}

.preview-list summary::-webkit-details-marker {
  display: none;
}

.preview-list summary strong {
  font-size: 11px;
}

.preview-list summary small {
  color: var(--ink-soft);
  font-size: 9px;
}

.preview-list details[open] summary {
  color: var(--teal);
  background: #f2f7f4;
}

.source-text {
  max-height: 280px;
  overflow: auto;
  padding: 22px;
  color: #3b4643;
  border-top: 1px solid #e4ddd2;
  background: white;
  font-family: "Arial Hebrew", "Noto Sans Hebrew", serif;
  font-size: 17px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.rashi-text {
  font-family: "Times New Roman", "Arial Hebrew", serif;
}

.attribution {
  margin: 11px 3px 0;
  color: #7b8582;
  font-size: 9px;
  line-height: 1.55;
}

.review-heading {
  align-items: center;
}

.review-counter {
  margin-left: auto;
  text-align: right;
}

.review-counter strong,
.review-counter span {
  display: block;
}

.review-counter strong {
  color: var(--teal);
  font-size: 15px;
}

.review-counter span {
  color: var(--ink-soft);
  font-size: 9px;
  text-transform: uppercase;
}

.progress-track {
  height: 5px;
  margin: -13px 0 23px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e3da;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #d3a358);
  transition: width .25s ease;
}

.review-card {
  position: relative;
  min-height: 340px;
  padding: clamp(23px, 5vw, 48px);
  overflow: hidden;
  border: 1px solid #d7c9b4;
  border-radius: 20px;
  background:
    linear-gradient(rgba(255,255,255,.76), rgba(255,255,255,.76)),
    repeating-linear-gradient(0deg, #f4ead8 0 1px, transparent 1px 5px),
    #fffaf0;
  box-shadow: inset 0 0 55px rgba(182, 128, 57, .08);
}

.review-card::before,
.review-card::after {
  position: absolute;
  width: 50px;
  height: 50px;
  content: "";
  border-color: rgba(181,122,49,.28);
}

.review-card::before {
  top: 12px;
  left: 12px;
  border-top: 1px solid;
  border-left: 1px solid;
}

.review-card::after {
  right: 12px;
  bottom: 12px;
  border-right: 1px solid;
  border-bottom: 1px solid;
}

.review-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 9px;
}

.source-tag {
  padding: 5px 9px;
  color: var(--teal);
  border: 1px solid #c7d8d2;
  border-radius: 999px;
  background: #f0f7f4;
  font-weight: 850;
}

.candidate-word {
  min-height: 118px;
  margin: 29px 0 0;
  text-align: center;
  color: #2b241b;
  font-family: "Daf to Deck Frank", serif;
  font-size: clamp(46px, 8vw, 74px);
  font-synthesis: none;
  line-height: 1.2;
}

.candidate-word.font-regular {
  font-family: "Daf to Deck Frank", serif;
}

.candidate-word.font-rashi {
  font-family: "Daf to Deck Rashi", serif;
}

.candidate-word.font-paleo {
  font-family: "Daf to Deck Paleo", serif;
}

.candidate-key {
  min-height: 16px;
  margin: 0 0 22px;
  color: #989086;
  text-align: center;
  font-size: 9px;
}

.decision-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 760px;
  margin: 0 auto;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  color: inherit;
  border: 1px solid currentColor;
  border-radius: 5px;
  font-family: inherit;
  font-size: 8px;
  opacity: .55;
}

.translation-form {
  max-width: 560px;
  margin: 0 auto;
}

.translation-field > span {
  text-align: center;
}

.translation-field input {
  min-height: 58px;
  text-align: center;
  font-size: 18px;
}

.translation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 11px;
}

.text-button {
  padding: 5px;
  color: var(--teal);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
}

.text-button:hover {
  text-decoration: underline;
}

.text-button.danger {
  color: #9c4c47;
}

.review-complete {
  padding: 50px 20px 30px;
  text-align: center;
}

.review-complete h3 {
  margin: 14px 0 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 500;
}

.review-complete p {
  max-width: 520px;
  margin: 0 auto 22px;
  color: var(--ink-soft);
  font-size: 12px;
}

.review-complete > div:last-child {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.complete-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto;
  color: white;
  border-radius: 50%;
  background: var(--teal-bright);
  box-shadow: 0 0 0 8px var(--teal-pale);
  font-size: 26px;
  font-weight: 900;
}

.deck-panel {
  position: sticky;
  top: 18px;
  padding: 24px;
}

.deck-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.deck-panel h2 {
  font-size: 28px;
}

.card-count {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  color: var(--teal);
  border: 1px solid #c9d9d3;
  border-radius: 50%;
  background: var(--teal-pale);
}

.card-count strong,
.card-count span {
  display: block;
  line-height: 1;
}

.card-count strong {
  font-size: 20px;
}

.card-count span {
  margin-top: 3px;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.sheet-visual {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 26px);
  gap: 5px;
  margin: 24px 0 13px;
  padding: 11px;
  border: 1px solid #d8cbb8;
  border-radius: 12px;
  background: #f8f0e3;
  box-shadow: inset 0 0 15px rgba(134,93,42,.08);
}

.sheet-visual span {
  border: 1px dashed #cbbda8;
  border-radius: 3px;
  background: rgba(255,255,255,.5);
  transition: background .2s ease, border-color .2s ease;
}

.sheet-visual span.filled {
  border-style: solid;
  border-color: #6d998d;
  background: linear-gradient(135deg, #e8f3ef, #bcd8cf);
}

.sheet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.sheet-stats div {
  padding: 8px 5px;
  text-align: center;
  border-radius: 8px;
  background: #f7f4ee;
}

.sheet-stats strong,
.sheet-stats span {
  display: block;
}

.sheet-stats strong {
  font-size: 14px;
}

.sheet-stats span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 7px;
  line-height: 1.2;
  text-transform: uppercase;
}

.queue-list-wrap {
  margin: 22px 0;
  padding-top: 17px;
  border-top: 1px solid #e3dcd1;
}

.queue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.queue-heading strong {
  font-size: 10px;
  text-transform: uppercase;
}

.queue-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px;
  color: #89928f;
  border: 1px dashed #d7d0c4;
  border-radius: 10px;
}

.queue-empty span {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 8px;
  background: #f1ede6;
  font-size: 18px;
}

.queue-empty p {
  margin: 0;
  font-size: 9px;
}

.queue-list {
  max-height: 280px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.queue-list li {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 7px 5px;
  border-bottom: 1px solid #eee8df;
}

.queue-number {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--ink-soft);
  border-radius: 6px;
  background: #f2eee7;
  font-size: 8px;
  font-weight: 850;
}

.queue-copy strong,
.queue-copy span {
  display: block;
}

.queue-copy strong {
  overflow: hidden;
  font-family: "Arial Hebrew", "Noto Sans Hebrew", serif;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: rtl;
  text-align: left;
}

.queue-copy span {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.queue-remove {
  width: 24px;
  height: 24px;
  padding: 0;
  color: #9b6a64;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.queue-remove:hover {
  color: white;
  background: #a75e56;
}

.generate-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 66px;
  padding: 11px 13px 11px 17px;
  color: #fff8e9;
  border-radius: 14px;
  background: linear-gradient(135deg, #9b622b, #bd843f);
  box-shadow: 0 12px 25px rgba(160,105,47,.22);
  text-align: left;
}

.generate-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 15px 28px rgba(160,105,47,.29);
}

.generate-button:disabled {
  cursor: not-allowed;
  opacity: .43;
  box-shadow: none;
}

.generate-button strong,
.generate-button small {
  display: block;
}

.generate-button strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  font-weight: 500;
}

.generate-button small {
  margin-top: 3px;
  opacity: .72;
  font-size: 8px;
}

.generate-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 43px;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 5px;
  background: rgba(255,255,255,.1);
  font-size: 8px;
  font-weight: 900;
}

.output-path {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 8px;
  text-align: center;
}

.output-path span {
  font-weight: 800;
}

.history-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 21px;
  padding: 12px;
  border: 1px solid #e3dcd2;
  border-radius: 11px;
  background: #f8f5ef;
}

.history-box strong,
.history-box span {
  display: block;
}

.history-box strong {
  font-size: 9px;
}

.history-box span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 8px;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  display: grid;
  width: min(380px, calc(100% - 44px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 14px 16px;
  color: white;
  border-radius: 12px;
  background: #244944;
  box-shadow: 0 14px 35px rgba(0,0,0,.18);
  font-size: 11px;
  animation: toast-in .22s ease both;
}

.toast.error {
  background: #83453f;
}

.toast.warning {
  color: #46331d;
  background: #f1d8a9;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(9px); }
}

dialog {
  width: min(540px, calc(100% - 32px));
  padding: 0;
  color: var(--ink);
  border: 0;
  border-radius: 20px;
  background: transparent;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(12, 31, 29, .63);
  backdrop-filter: blur(4px);
}

.dialog-card {
  position: relative;
  margin: 0;
  padding: 38px;
  border: 1px solid #e2dace;
  border-radius: 20px;
  background: var(--card);
  text-align: center;
}

.dialog-card h2 {
  margin: 5px 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
}

.dialog-card > p:not(.eyebrow):not(.print-note) {
  max-width: 410px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 11px;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  color: var(--ink-soft);
  border: 0;
  border-radius: 50%;
  background: #f0ece5;
  font-size: 19px;
  cursor: pointer;
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 73px;
  margin: 0 auto 17px;
  color: white;
  border-radius: 8px;
  background: linear-gradient(135deg, #9b622b, #bd843f);
  box-shadow: 0 11px 23px rgba(160,105,47,.22);
  font-size: 11px;
  font-weight: 900;
}

.dialog-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 23px 0;
}

.dialog-facts span {
  padding: 12px 6px;
  color: var(--ink-soft);
  border-radius: 10px;
  background: #f5f1ea;
  font-size: 9px;
}

.dialog-facts strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
}

.dialog-card menu {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin: 25px 0 0;
  padding: 0;
}

.success-dialog code {
  display: block;
  max-width: 100%;
  margin: 18px 0 0;
  padding: 10px;
  overflow: auto;
  color: var(--teal);
  border: 1px solid #d9e3df;
  border-radius: 9px;
  background: #f1f7f4;
  font-size: 9px;
  white-space: nowrap;
}

.print-note {
  margin: 11px 0 0;
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
}

.help-dialog ol {
  margin: 25px 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.help-dialog li {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: start;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid #ebe5db;
}

.help-dialog li > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--teal);
  border-radius: 50%;
  background: var(--teal-pale);
  font-weight: 850;
}

.help-dialog li strong {
  font-size: 11px;
}

.help-dialog li p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 9px;
}

@media (max-width: 1050px) {
  .hero-books {
    opacity: .6;
    transform: scale(.85);
    transform-origin: right bottom;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 315px;
  }

  .panel {
    padding: 28px;
  }
}

@media (max-width: 850px) {
  .hero {
    min-height: 275px;
  }

  .hero-books {
    position: absolute;
    right: -50px;
    bottom: 0;
    opacity: .22;
  }

  .hero-copy {
    max-width: 620px;
  }

  .workspace {
    display: flex;
    flex-direction: column;
  }

  .main-column,
  .deck-panel {
    width: 100%;
  }

  .deck-panel {
    position: static;
    order: -1;
  }

  .sheet-visual {
    grid-template-rows: repeat(4, 18px);
  }
}

@media (max-width: 590px) {
  .app-shell {
    width: min(100% - 20px, 1440px);
    margin-top: 10px;
  }

  .topbar {
    min-height: 62px;
    padding: 8px 11px;
  }

  .brand small,
  .local-badge {
    display: none;
  }

  .hero {
    min-height: 300px;
    padding: 38px 24px;
    border-radius: 22px;
  }

  .hero h1 {
    font-size: 45px;
  }

  .hero-copy > p:not(.eyebrow) {
    font-size: 14px;
  }

  .panel,
  .deck-panel {
    padding: 21px;
    border-radius: 18px;
  }

  .panel-heading {
    align-items: flex-start;
  }

  .step-number {
    width: 38px;
    height: 38px;
  }

  .panel-heading h2 {
    font-size: 27px;
  }

  .selection-grid,
  .options-row {
    grid-template-columns: 1fr;
  }

  .source-choices {
    grid-template-columns: 1fr;
  }

  .source-choice {
    min-height: 61px;
  }

  .review-counter {
    display: none;
  }

  .review-card {
    min-height: 330px;
    padding: 24px 18px;
  }

  .candidate-word {
    font-size: 52px;
  }

  .decision-actions {
    grid-template-columns: 1fr;
  }

  .review-complete > div:last-child,
  .dialog-card menu {
    flex-direction: column;
  }

  .dialog-card menu .primary-button,
  .dialog-card menu .secondary-button {
    width: 100%;
  }

  .preview-list summary {
    grid-template-columns: 1fr auto;
  }

  .dialog-card {
    padding: 33px 22px 25px;
  }
}

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