.sht-app {
  --sht-ink: #23211d;
  --sht-muted: #6d655c;
  --sht-line: #d9d1c5;
  --sht-paper: #fbfaf7;
  --sht-panel: #fff;
  --sht-primary: #ffe100;
  --sht-secondary: #ffdd8a;
  --sht-tertiary: #dff2f7;
  --sht-quaternary: #9bc47b;
  --sht-accent: #2f6f73;
  --sht-canvas-bg: #fbfaf7;
  --sht-link: #145f7c;
  --sht-hebrew-text: #111;
  --sht-translit-text: #ffea00;
  --sht-translit-stroke: #111;
  --sht-hebrew-font: Georgia, "Times New Roman", serif;
  color: var(--sht-ink);
  font-family: Georgia, "Times New Roman", serif;
}

.sht-app * {
  box-sizing: border-box;
}

.sht-searchbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.sht-searchbar label {
  display: grid;
  gap: 7px;
}

.sht-search-modes {
  display: flex;
  gap: 6px;
  grid-column: 1 / 2;
}

.sht-search-modes button,
.sht-fullscreen {
  border: 1px solid var(--sht-line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--sht-muted);
  cursor: pointer;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

.sht-search-modes button.active {
  border-color: rgba(47, 111, 115, 0.38);
  background: rgba(47, 111, 115, 0.09);
  color: var(--sht-accent);
  font-weight: 700;
}

.sht-fullscreen {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
}

.sht-app:fullscreen {
  overflow: auto;
  padding: 18px;
  background: var(--sht-paper);
}

.sht-app.sht-fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 999999;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  padding: 18px;
  background: var(--sht-paper);
}

.sht-fullscreen.active {
  background: var(--sht-accent);
  color: #fff;
}

.sht-display-panel {
  margin: 0 0 14px;
  border: 1px solid var(--sht-line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.sht-display-panel summary {
  cursor: pointer;
  color: var(--sht-accent);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
}

.sht-display-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.sht-display-grid label {
  display: grid;
  gap: 5px;
}

.sht-display-grid span {
  color: var(--sht-muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sht-display-grid select,
.sht-display-grid input,
.sht-reset-display {
  min-height: 34px;
  border: 1px solid var(--sht-line);
  border-radius: 7px;
  background: #fff;
  color: var(--sht-ink);
  font: 13px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sht-display-grid input[type="color"] {
  width: 100%;
  padding: 3px;
}

.sht-reset-display {
  align-self: end;
  padding: 7px 10px;
  cursor: pointer;
  font-weight: 700;
}

.sht-searchbar span,
.sht-panel-head h2,
.sht-meta,
.sht-label {
  color: var(--sht-muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sht-search {
  width: 100%;
  border: 1px solid var(--sht-line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--sht-ink);
}

.sht-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(420px, 1fr) minmax(220px, 300px);
  gap: 16px;
  align-items: start;
}

.sht-results,
.sht-detail,
.sht-family,
.sht-tree-panel {
  border: 1px solid var(--sht-line);
  border-radius: 8px;
  background: var(--sht-panel);
  padding: 14px;
}

.sht-main {
  display: grid;
  gap: 16px;
}

.sht-tree-panel {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  padding: 0;
  background:
    linear-gradient(rgba(47, 111, 115, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 111, 115, 0.06) 1px, transparent 1px),
    var(--sht-canvas-bg);
  background-size: 42px 42px;
}

.sht-tree-canvas {
  display: block;
  width: 100%;
  min-height: 640px;
}

.sht-link {
  fill: none;
  stroke: var(--sht-link);
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 6;
}

.sht-arrow-head {
  fill: var(--sht-link);
}

.sht-tree-illustration {
  opacity: 0.34;
  pointer-events: none;
}

.sht-node {
  cursor: pointer;
}

.sht-node .sht-bubble {
  stroke: rgba(35, 33, 29, 0.14);
  stroke-width: 1;
  filter: drop-shadow(0 8px 12px rgba(35, 33, 29, 0.12));
}

.sht-node.selected .sht-bubble {
  stroke: var(--sht-accent);
  stroke-width: 4;
}

.sht-node text {
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.sht-strong {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
}

.sht-translit,
.sht-meaning {
  fill: #ffea00;
  font-size: 17px;
  font-weight: 800;
  paint-order: stroke;
  stroke: #111;
  stroke-linejoin: round;
  stroke-width: 3px;
}

.sht-translit {
  fill: var(--sht-translit-text);
  stroke: var(--sht-translit-stroke);
}

.sht-hebrew-node {
  direction: rtl;
  fill: var(--sht-hebrew-text);
  font-family: var(--sht-hebrew-font);
  font-size: 27px;
  font-weight: 800;
  unicode-bidi: bidi-override;
}

.sht-level-label {
  fill: #0f0c09;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 800;
  dominant-baseline: middle;
  text-anchor: middle;
}

.sht-level-label-bg {
  opacity: 1;
  stroke: #17120d;
  stroke-width: 1.5;
  filter: drop-shadow(4px 4px 0 rgba(35, 33, 29, 0.18));
}

.sht-apple {
  pointer-events: none;
  filter: drop-shadow(0 3px 5px rgba(35, 33, 29, 0.22));
}

.sht-apple-body {
  fill: #c93f32;
  stroke: #7f251f;
  stroke-width: 1;
}

.sht-apple-stem {
  fill: none;
  stroke: #5f3f24;
  stroke-linecap: round;
  stroke-width: 2;
}

.sht-apple-leaf {
  fill: #4f8b46;
  stroke: #356a30;
  stroke-width: 0.8;
}

.sht-tree-tooltip {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 6px;
  max-width: 260px;
  border: 1px solid rgba(35, 33, 29, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(35, 33, 29, 0.18);
  color: var(--sht-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.25;
  pointer-events: none;
}

.sht-tree-tooltip[hidden] {
  display: none;
}

.sht-tree-tooltip strong,
.sht-tree-tooltip span {
  display: block;
}

.sht-tooltip-hebrew {
  color: #111;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-align: right;
}

.sht-tooltip-origin {
  color: #235a73;
  font-weight: 700;
}

.sht-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sht-panel-head h2 {
  margin: 0;
}

.sht-panel-head span,
.sht-badge {
  border: 1px solid var(--sht-line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff;
  color: var(--sht-muted);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
}

.sht-result-list,
.sht-family-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
}

.sht-result,
.sht-family-item {
  width: 100%;
  border: 1px solid var(--sht-line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--sht-ink);
  text-align: left;
  cursor: pointer;
}

.sht-result:hover,
.sht-result.active,
.sht-family-item:hover,
.sht-family-item.active {
  border-color: var(--sht-accent);
}

.sht-result.primitive {
  border-color: #d0b800;
  background: linear-gradient(90deg, rgba(255, 225, 0, 0.28), #fff 70%);
}

.sht-result strong,
.sht-family-item strong {
  display: block;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

.sht-result span,
.sht-family-item span {
  display: block;
  color: var(--sht-muted);
  font-size: 14px;
  line-height: 1.25;
}

.sht-hebrew {
  direction: rtl;
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 8px;
}

.sht-title {
  margin: 0;
  font-size: 30px;
}

.sht-definition {
  margin: 8px 0 14px;
  font-size: 19px;
  line-height: 1.35;
}

.sht-grid {
  display: grid;
  gap: 10px;
}

.sht-row {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--sht-line);
  padding-top: 10px;
}

.sht-row strong {
  font-size: 17px;
  line-height: 1.35;
}

.sht-card {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid rgba(47, 111, 115, 0.22);
  border-radius: 8px;
  padding: 12px;
  background: rgba(47, 111, 115, 0.06);
}

.sht-card h3 {
  margin: 0;
  font-size: 18px;
}

.sht-card p {
  margin: 0;
  line-height: 1.35;
}

.sht-card a {
  color: var(--sht-accent);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-decoration: none;
}

.sht-card a:hover {
  text-decoration: underline;
}

.sht-filter-note {
  color: var(--sht-muted);
  font-size: 14px;
  line-height: 1.35;
  margin: 12px 0 0;
}

@media (max-width: 980px) {
  .sht-searchbar {
    grid-template-columns: 1fr;
  }

  .sht-display-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .sht-search-modes,
  .sht-fullscreen {
    grid-column: auto;
    grid-row: auto;
  }

  .sht-layout {
    grid-template-columns: 1fr;
  }

  .sht-tree-canvas {
    min-width: 760px;
  }

  .sht-tree-panel {
    overflow: auto;
  }
}
