  :root {
    --paper: #FBFAF6;
    --grid: #E7E9EE;
    --ink: #22202B;
    --ink-soft: #605C6E;
    --line: #DDD9D0;
    --card: #FFFFFF;
    --brand: #D6336C;
    --brand-soft: #FBE3EC;
    --marker: #E7F24B;
    --marker-edge: #C9D81f;
    --ok: #1F8A5B;
    --radius: 7px;
    --maxw: 1240px;
    --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    --ui: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --display: var(--ui);
  }

  * {
    box-sizing: border-box
  }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0
  }

  html,
  body {
    margin: 0
  }

  body {
    font-family: var(--ui);
    color: var(--ink);
    background: var(--paper);
    background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
  }

  .wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 20px
  }

  header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: rgba(251, 250, 246, .86);
    backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--line)
  }

  .bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    flex-wrap: wrap
  }

  .logo {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-right: 6px
  }

  .mark {
    width: 34px;
    height: 34px;
    flex: none;
    border: 2px solid var(--ink);
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--card)
  }

  .brandname {
    font-family: var(--display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -.02em
  }

  .brandname b {
    color: var(--brand)
  }

  .tagline {
    font-size: 11.5px;
    color: var(--ink-soft);
    margin-top: -3px
  }

  .sources {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
    align-items: center
  }

  .src {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--line);
    background: var(--card);
    padding: 7px 11px;
    border-radius: 99px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    transition: .16s;
    white-space: nowrap
  }

  .src:hover {
    border-color: var(--ink);
    color: var(--ink);
    transform: translateY(-1px)
  }

  .src .dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--line)
  }

  .src.live .dot {
    background: var(--ok)
  }

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

  .account .who {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
    white-space: nowrap;
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis
  }

  .site-footer {
    border-top: 1px solid var(--line);
    margin-top: 40px;
    padding: 18px 0 28px
  }

  .site-footer .wrap {
    display: flex;
    gap: 18px;
    flex-wrap: wrap
  }

  .site-footer a {
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none
  }

  .site-footer a:hover {
    color: var(--ink)
  }

  .src.dropbox .ic {
    color: #0061FF
  }

  .src.drive .ic {
    color: #1FA463
  }

  .src.rav .ic {
    color: #EE6E62
  }

  .toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding: 18px 0 6px
  }

  .btn {
    font-family: var(--ui);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    border: 1px solid var(--ink);
    background: var(--ink);
    color: #fff;
    padding: 10px 15px;
    border-radius: var(--radius);
    transition: .16s;
    display: inline-flex;
    gap: 8px;
    align-items: center
  }

  .btn:hover {
    transform: translateY(-1px)
  }

  .btn.ghost {
    background: var(--card);
    color: var(--ink)
  }

  .btn.brand {
    background: var(--brand);
    border-color: var(--brand)
  }

  .hint {
    font-size: 12.5px;
    color: var(--ink-soft)
  }

  .empty {
    border: 1.5px dashed var(--line);
    border-radius: 14px;
    background: var(--card);
    padding: 46px 26px;
    text-align: center;
    margin: 14px 0 40px
  }

  .provider-panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 10px 0 14px;
    padding: 14px;
  }

  .provider-head {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
    margin-bottom: 12px
  }

  .provider-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0
  }

  .provider-head p {
    margin: 2px 0 0;
    color: var(--ink-soft);
    font-size: 13px
  }

  .provider-files {
    display: grid;
    gap: 8px
  }

  .provider-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
    color: var(--ink);
    padding: 10px 12px;
    font-family: var(--ui);
    cursor: pointer;
    text-align: left
  }

  .provider-file:hover {
    border-color: var(--brand);
    background: var(--brand-soft)
  }

  .provider-file span {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13.5px
  }

  .provider-file strong {
    flex: none;
    color: var(--brand);
    font-size: 12px;
    font-weight: 700
  }

  .provider-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px
  }

  .privacy-body {
    display: grid;
    gap: 12px
  }

  .privacy-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
  }

  #privacyExport {
    width: 100%;
    min-height: 190px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
    color: var(--ink);
    padding: 10px;
    font: 12px/1.5 var(--mono)
  }

  @media(max-width:620px) {
    .provider-file {
      align-items: flex-start;
      flex-direction: column
    }
  }

  .empty h1 {
    font-family: var(--display);
    font-size: clamp(26px, 4vw, 40px);
    letter-spacing: -.03em;
    margin: 6px 0 8px;
    font-weight: 700
  }

  .empty p {
    max-width: 560px;
    margin: 0 auto 20px;
    color: var(--ink-soft);
    font-size: 15px
  }

  .empty .row {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap
  }

  .swatch {
    display: inline-grid;
    grid-template-columns: repeat(6, 9px);
    gap: 3px;
    margin-bottom: 18px
  }

  .swatch i {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    display: block
  }

  .app {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 22px;
    align-items: start;
    padding-bottom: 60px
  }

  @media(max-width:920px) {
    .app {
      grid-template-columns: 1fr
    }
  }

  .reader {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden
  }

  .reader-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap
  }

  .doc-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -.01em
  }

  .doc-meta {
    font-size: 12px;
    color: var(--ink-soft)
  }

  .reader-tools {
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center
  }

  .chip {
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: 99px;
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--ink-soft);
    transition: .15s
  }

  .chip:hover {
    border-color: var(--ink);
    color: var(--ink)
  }

  .chip.on {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink)
  }

  .pattern {
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.95;
    padding: 8px 4px 24px;
    max-height: 70vh;
    overflow: auto
  }

  .line {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 1px 18px;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
    border-left: 3px solid transparent
  }

  .line .ltext {
    flex: 1;
    min-width: 0
  }

  .line-note {
    flex-basis: 100%;
    margin: 2px 0 4px 40px;
    padding: 6px 8px;
    border-left: 2px solid var(--brand);
    background: var(--brand-soft);
    color: var(--ink);
    font-family: var(--ui);
    font-size: 12px;
    line-height: 1.35;
    white-space: normal
  }

  .note-marker {
    flex: none;
    align-self: flex-start;
    color: var(--brand);
    font-family: var(--ui);
    font-weight: 700;
    line-height: 1.95
  }

  .line.head {
    font-family: var(--display);
    font-weight: 700;
    font-size: 13px;
    color: var(--brand);
    margin-top: 14px;
    letter-spacing: .05em;
    text-transform: uppercase
  }

  .line.title {
    font-family: var(--display);
    font-weight: 700;
    font-size: 21px;
    color: var(--ink);
    letter-spacing: -.02em;
    margin-bottom: 2px
  }

  .line.instr {
    cursor: pointer
  }

  .line.instr:hover {
    background: #FCFBF7
  }

  .line.current {
    background: var(--brand-soft);
    border-left-color: var(--brand)
  }

  .line.current::after {
    content: "reading";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--ui);
    font-size: 10px;
    font-weight: 700;
    color: var(--brand);
    letter-spacing: .08em
  }

  .line .num {
    flex: none;
    width: 26px;
    text-align: right;
    color: #BFBAB0;
    font-size: 11px;
    user-select: none;
    padding-top: 1px
  }

  .abbr {
    border-bottom: 2px dotted var(--brand);
    cursor: help;
    transition: background .12s;
    border-radius: 2px
  }

  .abbr:hover,
  .abbr.flash {
    background: var(--brand-soft)
  }

  .sz {
    border-radius: 3px;
    padding: 0 1px;
    transition: background .18s, box-shadow .18s
  }

  .sz.active {
    background: var(--marker);
    box-shadow: 0 0 0 2px var(--marker);
    mix-blend-mode: multiply;
    font-weight: 700
  }

  body.only-mine .sz.sz-on:not(.active) {
    opacity: .3
  }

  .rail {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 78px
  }

  @media(max-width:920px) {
    .rail {
      position: static
    }
  }

  .panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden
  }

  .panel h3 {
    font-family: var(--display);
    font-size: 12px;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin: 0;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between
  }

  .panel h3 .tag {
    font-size: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    padding: 2px 7px;
    border-radius: 99px;
    letter-spacing: .04em;
    text-transform: capitalize
  }

  .panel .body {
    padding: 14px 16px
  }

  .glance .summary {
    font-size: 14px;
    margin: 0 0 12px
  }

  .kv {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 6px 10px;
    font-size: 13px
  }

  .kv dt {
    color: var(--ink-soft);
    font-weight: 600
  }

  .kv dd {
    margin: 0
  }

  .mat {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    font-size: 12.5px
  }

  .mat li {
    padding: 5px 0;
    border-top: 1px dotted var(--line);
    display: flex;
    gap: 8px
  }

  .mat li::before {
    content: "";
    width: 7px;
    height: 7px;
    flex: none;
    margin-top: 6px;
    border-radius: 2px;
    background: var(--brand)
  }

  .sizes-row {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 10px
  }

  .size-pill {
    min-width: 42px;
    text-align: center;
    border: 1px solid var(--line);
    background: var(--paper);
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: .14s;
    font-family: var(--mono)
  }

  .size-pill:hover {
    border-color: var(--ink)
  }

  .size-pill.sel {
    background: var(--marker);
    border-color: var(--marker-edge);
    color: var(--ink)
  }

  .size-note {
    font-size: 11.5px;
    color: var(--ink-soft);
    margin: 4px 0 12px
  }

  .toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 12.5px;
    cursor: pointer;
    user-select: none
  }

  .switch {
    width: 38px;
    height: 22px;
    border-radius: 99px;
    background: var(--line);
    position: relative;
    transition: .18s;
    flex: none
  }

  .switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 99px;
    background: #fff;
    transition: .18s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .2)
  }

  .toggle.on .switch {
    background: var(--brand)
  }

  .toggle.on .switch::after {
    left: 18px
  }

  .gloss {
    max-height: 330px;
    overflow: auto
  }

  .gitem {
    display: flex;
    gap: 12px;
    padding: 9px 16px;
    border-top: 1px solid var(--line);
    align-items: baseline;
    cursor: pointer;
    transition: .12s
  }

  .gitem:first-child {
    border-top: 0
  }

  .gitem:hover,
  .gitem.flash {
    background: var(--brand-soft)
  }

  .gitem .abbr-k {
    font-family: var(--mono);
    font-weight: 700;
    color: var(--brand);
    flex: none;
    min-width: 54px;
    font-size: 13px
  }

  .gitem .mean {
    font-size: 13px
  }

  .gitem .grp {
    font-size: 10px;
    color: var(--ink-soft);
    margin-left: auto;
    flex: none;
    text-transform: uppercase;
    letter-spacing: .05em
  }

  .gloss-search {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 10px;
    font-family: var(--ui);
    font-size: 13px
  }

  .gloss-search:focus {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand)
  }

  .counter {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: center;
    padding: 6px 0 2px
  }

  .counter .val {
    font-family: var(--mono);
    font-size: 40px;
    font-weight: 700;
    min-width: 70px;
    text-align: center;
    letter-spacing: -.02em
  }

  .cbtn {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid var(--ink);
    background: var(--card);
    font-size: 24px;
    cursor: pointer;
    font-family: var(--display);
    line-height: 1;
    display: grid;
    place-items: center
  }

  .cbtn:hover {
    background: var(--ink);
    color: #fff
  }

  .cbtn.big {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff
  }

  .cmeta {
    text-align: center;
    font-size: 11.5px;
    color: var(--ink-soft);
    margin-top: 8px
  }

  .creset {
    background: none;
    border: 0;
    color: var(--brand);
    font-weight: 600;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--ui)
  }

  .note-current {
    width: 100%;
    justify-content: center;
    margin-top: 12px
  }

  .named-counters {
    display: grid;
    gap: 8px;
    margin-top: 12px
  }

  .named-counter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 30px 38px 30px auto auto;
    gap: 6px;
    align-items: center;
    border-top: 1px solid var(--line);
    padding-top: 8px;
    font-size: 12px
  }

  .counter-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 700
  }

  .named-counter strong {
    font-family: var(--mono);
    text-align: center;
    font-size: 16px
  }

  .mini-counter {
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 7px;
    cursor: pointer;
    font-weight: 700
  }

  .counter-link {
    border: 0;
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    font: 600 11.5px var(--ui);
    padding: 2px
  }

  .counter-form {
    padding: 16px 18px
  }

  .counter-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 10px 12px;
    font: 13px var(--ui)
  }

  .note-modal textarea {
    min-height: 170px
  }

  #pop {
    position: fixed;
    z-index: 80;
    max-width: 240px;
    background: var(--ink);
    color: #fff;
    border-radius: 9px;
    padding: 10px 12px;
    font-size: 12.5px;
    line-height: 1.45;
    display: none;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .22)
  }

  #pop .pk {
    font-family: var(--mono);
    font-weight: 700;
    color: var(--marker);
    display: block;
    margin-bottom: 2px
  }

  .loader {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    color: var(--ink-soft);
    padding: 6px 0
  }

  .spin {
    width: 16px;
    height: 16px;
    border: 2px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 99px;
    animation: s .7s linear infinite;
    flex: none
  }

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

  .skel {
    height: 11px;
    background: linear-gradient(90deg, #eee, #f6f6f6, #eee);
    background-size: 200% 100%;
    animation: sh 1.2s infinite;
    border-radius: 4px;
    margin: 7px 0
  }

  @keyframes sh {
    to {
      background-position: -200% 0
    }
  }

  .errbox {
    font-size: 13px;
    color: #9b1c3c;
    background: #fdeef2;
    border: 1px solid #f6c9d6;
    border-radius: 8px;
    padding: 10px 12px
  }

  .errbox button {
    margin-top: 8px
  }

  .modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(34, 32, 43, .4);
    z-index: 90;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px
  }

  .modal {
    background: var(--card);
    border-radius: 14px;
    width: min(620px, 100%);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden
  }

  .modal .mhead {
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center
  }

  .modal h2 {
    font-family: var(--display);
    font-size: 17px;
    margin: 0
  }

  .modal .x {
    background: none;
    border: 0;
    font-size: 22px;
    cursor: pointer;
    color: var(--ink-soft)
  }

  .modal textarea {
    flex: 1;
    min-height: 260px;
    border: 0;
    padding: 16px 18px;
    font-family: var(--mono);
    font-size: 13px;
    resize: none;
    outline: none
  }

  .modal .foot {
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 10px;
    justify-content: flex-end
  }

  .notes {
    max-width: 760px;
    margin: 0 auto 70px;
    font-size: 13.5px;
    color: var(--ink-soft)
  }

  .notes summary {
    cursor: pointer;
    font-family: var(--display);
    font-weight: 600;
    color: var(--ink);
    font-size: 14px;
    padding: 10px 0
  }

  .notes p {
    margin: 8px 0
  }

  .notes b {
    color: var(--ink)
  }

  .notes .real {
    color: var(--ok);
    font-weight: 700
  }

  .notes .stub {
    color: var(--brand);
    font-weight: 700
  }

  :focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px
  }

  @media(prefers-reduced-motion:reduce) {
    * {
      animation: none !important;
      transition: none !important;
      scroll-behavior: auto !important
    }

    .btn:hover,
    .src:hover {
      transform: none
    }
  }

  .hidden {
    display: none !important
  }
