/* Gallery viewers: markdown popup (.mdv), competitor screenshot browser (.sb), zoom viewer with minimap (.vw) */
html.has-modal { overflow: hidden; }
dialog.mdv, dialog.sb, dialog.vw { padding: 0; border: 0; color: var(--ink, #1f2326); font-family: 'Inter', system-ui, sans-serif; }
dialog.mdv::backdrop, dialog.sb::backdrop { background: rgba(18, 20, 22, .58); backdrop-filter: blur(2px); }
dialog.vw::backdrop { background: #121416; }
.mdv button, .sb button, .vw button, .vw select { font: inherit; color: inherit; }
.mdv :focus-visible, .sb :focus-visible, .vw :focus-visible { outline: 2px solid #DC6925; outline-offset: 2px; }

/* ---------- markdown ---------- */
dialog.mdv { width: min(1200px, 96vw); height: min(94vh, 1400px); max-width: none; max-height: none; border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
dialog.mdv[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.mdv-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #e8e5df; background: #faf9f6; }
.mdv-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mdv-title { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mdv-path { font-size: 12px; color: #7a7f84; font-family: ui-monospace, Consolas, monospace; }
.mdv-back, .mdv-close { width: 36px; height: 36px; border-radius: 10px; border: 1px solid #e0ddd6; background: #fff; cursor: pointer; font-size: 18px; line-height: 1; flex: none; }
.mdv-close { font-size: 22px; }
.mdv-back:hover, .mdv-close:hover, .mdv-btn:hover { border-color: #1f2326; }
.mdv-btn { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid #e0ddd6; background: #fff; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.mdv-body { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 0; }
.mdv.no-toc .mdv-body { grid-template-columns: minmax(0, 1fr); }
.mdv.no-toc .mdv-toc { display: none; }
.mdv-toc { overflow: auto; padding: 18px 10px 30px 16px; border-right: 1px solid #efece6; background: #fcfbf9; font-size: 13px; }
.mdv-toc-h { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #8a8f94; margin: 0 0 8px 8px; }
.mdv-toc a { display: block; padding: 5px 8px; border-radius: 7px; color: #3b4045; text-decoration: none; line-height: 1.35; }
.mdv-toc a.lvl-3 { padding-left: 20px; font-size: 12.5px; color: #6a7075; }
.mdv-toc a:hover { background: #f1eee8; }
.mdv-toc a.is-active { background: #fbe9dc; color: #9c4212; font-weight: 600; }
.mdv-scroll { overflow: auto; padding: 26px clamp(18px, 4vw, 48px) 60px; outline: none; }
.mdv .mdv-scroll:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(220, 105, 37, .22); }
.mdv-loading, .mdv-error { color: #6a7075; }
.mdv-error code { background: #f3f0ea; padding: 1px 5px; border-radius: 4px; }

.md { max-width: 900px; font-size: 15px; line-height: 1.65; color: #26292c; }
.md > :first-child { margin-top: 0; }
.md h1 { font-size: 27px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 18px; }
.md h2 { font-size: 21px; line-height: 1.25; margin: 34px 0 12px; padding-top: 18px; border-top: 1px solid #ece9e3; }
.md h3 { font-size: 17px; margin: 26px 0 8px; }
.md h4 { font-size: 15px; margin: 20px 0 6px; }
.md h1, .md h2, .md h3, .md h4 { scroll-margin-top: 16px; }
.md p { margin: 0 0 12px; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md li > ul, .md li > ol { margin: 4px 0 6px; }
.md a { color: #b24c14; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.md strong { font-weight: 700; }
.md code { font-family: ui-monospace, Consolas, monospace; font-size: .88em; background: #f3f0ea; padding: 1px 5px; border-radius: 4px; }
.md pre { background: #f6f4ef; border: 1px solid #ebe7df; border-radius: 10px; padding: 14px 16px; overflow: auto; font-size: 13px; line-height: 1.5; }
.md pre code { background: none; padding: 0; font-size: inherit; }
.md blockquote { margin: 0 0 14px; padding: 8px 16px; border-left: 3px solid #DC6925; background: #fcf6f1; color: #4a4f54; border-radius: 0 8px 8px 0; }
.md blockquote > :last-child { margin-bottom: 0; }
.md hr { border: 0; border-top: 1px solid #e8e5df; margin: 26px 0; }
.md img { max-width: 100%; border-radius: 8px; }
.md-table { overflow-x: auto; margin: 0 0 16px; border: 1px solid #e8e5df; border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.45; }
.md th, .md td { padding: 7px 11px; border-bottom: 1px solid #efece6; text-align: left; vertical-align: top; }
.md th { background: #faf8f4; font-weight: 700; white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.md tbody tr:nth-child(even) td { background: #fcfbf9; }
.md-shot { display: inline; padding: 0; border: 0; background: none; cursor: zoom-in; }
.md-shot code { background: #fbe9dc; color: #9c4212; box-shadow: inset 0 -1px 0 rgba(156, 66, 18, .35); }
.md-shot:hover code { background: #f7d9c4; }

/* ---------- competitor browser ---------- */
dialog.sb { width: min(1320px, 96vw); height: min(94vh, 1400px); max-width: none; max-height: none; border-radius: 16px; overflow: hidden; background: #f5f3ef;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
dialog.sb[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.sb-head { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: #fff; border-bottom: 1px solid #e8e5df; }
.sb-head strong { font-size: 16px; font-weight: 800; white-space: nowrap; }
.sb-search { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid #e0ddd6; border-radius: 10px; font: inherit; font-size: 14px; background: #faf9f6; }
.sb-close { width: 38px; height: 38px; border-radius: 10px; border: 1px solid #e0ddd6; background: #fff; cursor: pointer; font-size: 22px; line-height: 1; flex: none; }
.sb-close:hover { border-color: #1f2326; }
.sb-tabs { display: flex; gap: 6px; padding: 10px 16px; overflow-x: auto; background: #fff; border-bottom: 1px solid #e8e5df; }
.sb-tab { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid #e0ddd6; background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; }
.sb-tab span { font-size: 11px; color: #8a8f94; font-weight: 700; }
.sb-tab.is-on { background: #1f2326; border-color: #1f2326; color: #fff; }
.sb-tab.is-on span { color: #c9ccd0; }
.sb-scroll { overflow: auto; padding: 14px 16px 30px; }
.sb-info { font-size: 13px; color: #6a7075; margin: 0 0 12px; }
.sb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.sb-card { display: flex; flex-direction: column; gap: 4px; padding: 0 0 12px; border: 1px solid #e4e1db; border-radius: 12px; background: #fff; cursor: zoom-in; text-align: left; overflow: hidden; }
.sb-card:hover { border-color: #1f2326; box-shadow: 0 8px 22px rgba(0, 0, 0, .08); }
.sb-thumb { display: block; aspect-ratio: 1440 / 900; background: #e9e6e0; overflow: hidden; margin-bottom: 6px; }
.sb-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.sb-name { padding: 0 12px; font-size: 14px; font-weight: 700; }
.sb-sub { padding: 0 12px; font-size: 12px; color: #7a7f84; }
.sb-title { padding: 0 12px; font-size: 12.5px; color: #3b4045; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sb-badges { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 12px 0; }
.sb-badges i { font-style: normal; font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #eef3ea; color: #3f5331; border: 1px solid #dde6d6; }

/* ---------- zoom viewer ---------- */
dialog.vw { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; inset: 0; background: #1b1d20; color: #e9e6e1; }
dialog.vw[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.vw-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #24272b; border-bottom: 1px solid #33373c; flex-wrap: nowrap; min-width: 0; }
.vw-titles { display: flex; flex-direction: column; min-width: 0; flex: 1 1 120px; }
.vw-name { font-size: 15px; font-weight: 800; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-sub { font-size: 12px; color: #9ea3a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-views, .vw-zoom, .vw-nav { display: flex; align-items: center; gap: 4px; }
.vw-views:empty { display: none; }
.vw-b, .vw-view, .vw-pct { height: 34px; min-width: 34px; padding: 0 9px; border-radius: 9px; border: 1px solid #3c4046; background: #2c3035; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.vw-b:hover, .vw-view:hover, .vw-pct:hover { background: #363a40; border-color: #555a61; }
.vw-view.is-on { background: #DC6925; border-color: #DC6925; color: #1a1512; }
.vw-pct { min-width: 64px; font-variant-numeric: tabular-nums; }
.vw-b[data-act="close"] { font-size: 20px; width: 38px; }
.vw-count { font-size: 12px; color: #9ea3a8; min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }
.vw-secsel { height: 34px; max-width: 200px; min-width: 0; flex: 0 1 200px; padding: 0 8px; border-radius: 9px; border: 1px solid #3c4046; background: #2c3035; font-size: 13px; }
.vw-link { font-size: 13px; font-weight: 600; color: #f0a06a; text-decoration: none; white-space: nowrap; padding: 0 4px; }
.vw-link:hover { text-decoration: underline; }
.vw-body { display: grid; grid-template-columns: minmax(0, 1fr) 260px; min-height: 0; }
.vw-main { position: relative; overflow: auto; outline: none; min-width: 0; touch-action: pan-x pan-y; overscroll-behavior: contain; background: #1b1d20; }
.vw-main:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(220, 105, 37, .35); }
.vw-main::-webkit-scrollbar { width: 12px; height: 12px; }
.vw-main::-webkit-scrollbar-thumb { background: #3f444a; border-radius: 6px; border: 3px solid #1b1d20; }
.vw-main::-webkit-scrollbar-corner { background: #1b1d20; }
.vw-stage { box-sizing: border-box; width: max-content; min-width: 100%; padding: 24px; text-align: center; line-height: 0; }
.vw-img { display: inline-block; max-width: none; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); cursor: grab; user-select: none; -webkit-user-drag: none; }
.vw-main.is-dragging .vw-img { cursor: grabbing; }
.vw-main.is-loading .vw-img { opacity: .25; }
.vw-loading { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); padding: 10px 16px; border-radius: 10px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 14px; pointer-events: none; }
.vw-side { position: relative; display: flex; border-left: 1px solid #33373c; background: #202327; min-height: 0; }
.vw-mini { position: relative; flex: 1; overflow: hidden; cursor: pointer; }
.vw-mini-inner { position: relative; margin: 10px 0; }
.vw-mini-img { position: absolute; top: 0; display: block; max-width: none; background: #fff; opacity: .92; user-select: none; -webkit-user-drag: none; }
.vw-rect { position: absolute; border: 2px solid #DC6925; background: rgba(220, 105, 37, .16); border-radius: 2px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .28); cursor: grab; pointer-events: auto; }
.vw-marks { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.vw-mark { position: absolute; left: 0; height: 0; padding: 0; border: 0; border-top: 1px solid rgba(240, 160, 106, .55); background: none; cursor: pointer; pointer-events: auto; }
.vw-mark span { position: absolute; right: 12px; bottom: 2px; max-width: calc(100% - 16px); font-size: 11px; line-height: 1.25; color: #b3b7bc; text-align: right;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.vw-mark:hover span { color: #fff; }
.vw-mark.no-label span { display: none; }
.vw-mark.is-current { border-top-color: #DC6925; border-top-width: 2px; }
.vw-mark.is-current span { color: #fff; font-weight: 700; }
.vw-track { position: relative; width: 14px; flex: none; margin: 10px 6px 10px 2px; border-radius: 7px; background: #2c3035; cursor: pointer; }
.vw-track-marks i { position: absolute; left: 2px; right: 2px; height: 2px; margin-top: -1px; background: rgba(240, 160, 106, .7); border-radius: 1px; }
.vw-thumb { position: absolute; left: 0; right: 0; min-height: 18px; border-radius: 7px; background: rgba(220, 105, 37, .55); border: 1px solid #DC6925; cursor: grab; }
.vw-status { display: flex; align-items: center; gap: 18px; min-width: 0; overflow: hidden; padding: 6px 14px; background: #24272b; border-top: 1px solid #33373c; font-size: 12.5px; color: #b3b7bc; min-height: 32px; }
.vw-cursec { color: #fff; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.vw-posinfo { font-variant-numeric: tabular-nums; white-space: nowrap; }
.vw-help { margin-left: auto; color: #80858b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1100px) {
  .vw-body { grid-template-columns: minmax(0, 1fr) 200px; }
  .vw-help { display: none; }
  .vw-top { flex-wrap: wrap; }
}
@media (max-width: 800px) {
  .mdv-body { grid-template-columns: 1fr; }
  .mdv-toc { display: none; }
  .vw-body { grid-template-columns: minmax(0, 1fr) 72px; }
  .vw-mark span { display: none; }
  .vw-secsel { max-width: 150px; }
  .vw-zoom [data-act="one"], .vw-zoom [data-act="all"] { display: none; }
  .vw-link { display: none; }
}
@media (max-width: 560px) {
  .vw-body { grid-template-columns: minmax(0, 1fr) 26px; }
  .vw-titles { flex-basis: 100%; }
  .vw-mini { display: none; }
  .vw-zoom [data-act="fitw"] { display: none; }
}
