/* Loader */

.loader {
  min-height: var(--app-h);
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  color: var(--muted);
}

.loader-mark { font: 600 44px var(--hebrew); color: var(--accent); }

.loader-bar {
  width: 200px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.loader-bar span {
  display: block;
  height: 100%;
  width: 35%;
  border-radius: inherit;
  background: var(--accent);
  animation: slide 1.2s ease-in-out infinite;
}


.loader p { margin: 0; }

.loader.failed .loader-bar { display: none; }

@keyframes slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(300%); }
}

/* Header */

.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  transition: transform 0.25s ease;
}

.bar-hidden .autohide:not(.menu-open) .bar { transform: translateY(-100%); }

.bar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
}

.brand { display: flex; align-items: baseline; gap: 8px; flex: 1; min-width: 0; }
.brand-mark { font: 600 22px var(--hebrew); color: var(--accent); }
.brand-name { font-weight: 600; letter-spacing: 0.01em; }

.picker { display: flex; align-items: center; gap: 6px; min-width: 0; }

.ref-btn {
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.ref-btn:hover, .ref-btn.on { border-color: var(--faint); }

.ref-part {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 0 10px 0 14px;
  border: 0;
  background: none;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s;
}

.ref-part + .ref-sep + .ref-part { flex: none; padding-left: 10px; font-variant-numeric: tabular-nums; }
.ref-part:hover, .ref-part.on { background: var(--hover); }
.ref-sep { flex: none; width: 1px; margin: 8px 0; background: var(--line); }
.ref-part .i { width: 15px; height: 15px; flex: none; }
.ref-part .i-down { color: var(--muted); }
.ref-book { overflow: hidden; text-overflow: ellipsis; }

.tools { flex: 1; display: flex; justify-content: flex-end; gap: 2px; position: relative; }

.select { position: relative; min-width: 0; }

.select select {
  appearance: none;
  -webkit-appearance: none;
  height: 38px;
  max-width: 12rem;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 500;
  cursor: pointer;
  text-overflow: ellipsis;
}


.select select:hover { border-color: var(--faint); }

.select::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s;
}

.icon-btn:hover, .icon-btn.on { background: var(--hover); }
.icon-btn.disabled { opacity: 0.25; cursor: default; background: none; }

.i {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.i-left { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 18l-6-6 6-6'/%3E%3C/svg%3E"); }
.i-right { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E"); }
.i-gear { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E"); }
.i-pin { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5'/%3E%3Cpath d='M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z'/%3E%3C/svg%3E"); }
.pin-btn.on .i-pin { transform: rotate(0deg); }
.pin-btn:not(.on) .i-pin { transform: rotate(35deg); }
.i-close { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E"); }
.i-pen { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E"); }
.i-eraser { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 21-4.3-4.3a1 1 0 0 1 0-1.4l10-10a1 1 0 0 1 1.4 0l5.6 5.6a1 1 0 0 1 0 1.4L11 21'/%3E%3Cpath d='M22 21H7'/%3E%3Cpath d='m5 11 9 9'/%3E%3C/svg%3E"); }
.i-hand { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 11V6a2 2 0 0 0-4 0v5'/%3E%3Cpath d='M14 10V4a2 2 0 0 0-4 0v6'/%3E%3Cpath d='M10 10.5V6a2 2 0 0 0-4 0v8'/%3E%3Cpath d='M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-6-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15'/%3E%3C/svg%3E"); }
.i-book { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 4h6a4 4 0 0 1 4 4v13a3 3 0 0 0-3-3H2Z'/%3E%3Cpath d='M22 4h-6a4 4 0 0 0-4 4v13a3 3 0 0 1 3-3h7Z'/%3E%3C/svg%3E"); }
.i-minus { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
.i-plus { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.i-more { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Ccircle cx='5' cy='12' r='1.8'/%3E%3Ccircle cx='12' cy='12' r='1.8'/%3E%3Ccircle cx='19' cy='12' r='1.8'/%3E%3C/svg%3E"); }
.i-undo { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14 4 9l5-5'/%3E%3Cpath d='M4 9h10.5a5.5 5.5 0 0 1 0 11H11'/%3E%3C/svg%3E"); }
.i-redo { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 14 5-5-5-5'/%3E%3Cpath d='M20 9H9.5a5.5 5.5 0 0 0 0 11H13'/%3E%3C/svg%3E"); }
.i-ribbon { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-6-4.5L6 21Z'/%3E%3C/svg%3E"); }
.i-ribbon-fill { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='1.9' stroke-linejoin='round'%3E%3Cpath d='M6 3h12v18l-6-4.5L6 21Z'/%3E%3C/svg%3E"); color: var(--accent); }
.i-down { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.i-download { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3Cpath d='M12 15V3'/%3E%3C/svg%3E"); }

/* Settings menu */

.menu-backdrop { position: fixed; inset: 0; z-index: 40; }
.tools > .icon-btn, .ref-btn { position: relative; z-index: 42; }
.picker { position: relative; }

@media (min-width: 601px) {
  .picker .menu { right: auto; left: 50%; translate: -50% 0; }
}

.menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 41;
  width: 368px;
  max-height: calc(var(--app-h) - var(--bar-h) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--raised);
  box-shadow: var(--shadow);
}

.menu:focus { outline: none; }

.go-tabs {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2px;
  margin-bottom: 6px;
  padding: 3px;
  border-radius: 12px;
  background: var(--hover);
}

.go-tab {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 6px 10px 7px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
}

.go-tab:hover { color: var(--text); }
.go-tab.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px var(--shade); }
.go-tab-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.go-tab-value { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.go-tab.on .go-tab-label { color: var(--accent-text); }

.menu-section { padding: 14px 0 8px; border-bottom: 1px solid var(--line); }
.menu-section:first-child { padding-top: 4px; }
.menu-section.last, .menu > div > .menu-section:last-child { border-bottom: 0; padding-bottom: 0; }

.menu-section h2 {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.h2-value {
  margin-left: 8px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 500;
  font-size: 12px;
  color: var(--faint);
}

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  font-weight: 500;
}

.menu-label { display: flex; align-items: baseline; gap: 8px; }
.menu-sample { font: 1.05rem var(--hebrew); color: var(--muted); }

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--hover);
}

.segmented button {
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.segmented button.on { background: var(--raised); color: var(--text); box-shadow: 0 1px 3px var(--shade); }
.segmented button:disabled { opacity: 0.4; cursor: default; }

.swatches { display: grid; grid-template-columns: repeat(7, 30px); justify-content: space-between; padding: 8px 0 6px; }

.swatch {
  position: relative;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 0.15s, box-shadow 0.15s;
}

.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--accent); }

.swatch-face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--accent);
  font: 600 14px var(--hebrew);
  box-shadow: inset 0 0 0 1px var(--line);
}

.swatch-face + .swatch-face { clip-path: polygon(100% 0, 100% 100%, 0 100%); }

.faces { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 0 6px; }

.face {
  display: grid;
  place-items: center;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.face:hover { border-color: var(--faint); }
.face.on { border-color: var(--accent); background: var(--accent-soft); }
.face-sample { font: 1.45rem/1 var(--reading); color: var(--text); }

.layouts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 14px; }

.layout-card {
  display: grid;
  gap: 2px;
  padding: 8px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.layout-card:hover { border-color: var(--faint); }
.layout-card.on { border-color: var(--accent); background: var(--accent-soft); }
.layout-card .thumb { margin-bottom: 6px; }
.layout-name { font-weight: 600; font-size: 13.5px; padding-inline: 2px; }
.layout-desc { font-size: 11.5px; line-height: 1.35; color: var(--muted); padding-inline: 2px; }
.layout-card.on .layout-name { color: var(--accent-text); }
.layout-card:disabled { opacity: 0.45; cursor: default; border-color: var(--line); }
.menu-note { margin: 12px 2px 4px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.about-note { margin: 6px 0 10px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.about-note a { color: var(--accent); }

.thumb {
  display: grid;
  height: 58px;
  padding: 8px;
  gap: 4px;
  border-radius: 9px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
}

.thumb span { border-radius: 2px; }
.thumb-study { grid-template-columns: 1fr 32%; gap: 6px; }
.thumb-study span:first-child { background: repeating-linear-gradient(var(--faint) 0 3px, transparent 3px 8px); opacity: 0.8; }
.thumb-study span:last-child { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); border-radius: 4px; }
.thumb-interlinear { grid-template-columns: repeat(4, 1fr); gap: 5px 4px; }
.thumb-interlinear span { background: linear-gradient(var(--text) 0 40%, transparent 40% 62%, var(--accent) 62% 84%, transparent 84%); opacity: 0.7; }
.thumb-scroll { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumb-scroll span { background: repeating-linear-gradient(var(--faint) 0 2px, transparent 2px 6px); opacity: 0.8; }
.thumb-scroll span + span { box-shadow: 3px 0 0 -2px var(--line); }
.thumb-focus { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.thumb-focus span:nth-child(1) { width: 70%; height: 7px; background: var(--text); opacity: 0.75; }
.thumb-focus span:nth-child(2) { width: 46%; height: 3px; background: var(--faint); }
.thumb-focus span:nth-child(3) { width: 36%; height: 3px; background: var(--accent); border-radius: 9px; margin-top: 6px; }

.thumb.mini { width: 22px; height: 18px; padding: 3px; gap: 2px; border-radius: 5px; background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.thumb.mini span { opacity: 1; }
.thumb.mini.thumb-study { gap: 2px; }
.thumb.mini.thumb-study span:first-child { background: repeating-linear-gradient(currentColor 0 1.5px, transparent 1.5px 3.5px); }
.thumb.mini.thumb-study span:last-child { background: currentColor; box-shadow: none; opacity: 0.35; border-radius: 1px; }
.thumb.mini.thumb-interlinear { grid-template-columns: repeat(4, 1fr); gap: 2px 1px; }
.thumb.mini.thumb-interlinear span { background: linear-gradient(currentColor 0 45%, transparent 45% 65%, currentColor 65% 85%, transparent 85%); opacity: 0.8; }
.thumb.mini.thumb-scroll { gap: 2px; }
.thumb.mini.thumb-scroll span { background: repeating-linear-gradient(currentColor 0 1.5px, transparent 1.5px 3px); box-shadow: none; }
.thumb.mini.thumb-focus { gap: 2px; }
.thumb.mini.thumb-focus span:nth-child(1) { height: 3px; background: currentColor; }
.thumb.mini.thumb-focus span:nth-child(2) { height: 1.5px; background: currentColor; opacity: 0.5; }
.thumb.mini.thumb-focus span:nth-child(3) { display: none; }

.menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.menu-foot .link-btn { margin: 0; font-size: 12.5px; }
.confirm-text { font-weight: 600; color: var(--text); }
.confirm-actions { display: flex; gap: 6px; }

.confirm-btn {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.confirm-btn.danger { border-color: #c2413a; background: #c2413a; color: #fff; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.2s;
}

.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 0.2s;
}

.switch.on { background: var(--accent); }
.switch.on span { transform: translateX(18px); }
.switch:disabled { opacity: 0.45; cursor: default; }

.stepper { display: flex; align-items: center; gap: 8px; }

.stepper button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.stepper button:disabled { opacity: 0.35; cursor: default; }

.dots { display: flex; gap: 4px; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.dots span.on { background: var(--accent); }
