:root {
      --bg-color: #ffffff;
      --text-color: #333333;
      --select-text-bg-color: #b5d6fc;
      --accent: #4183c4;
    }

    * {
      box-sizing: border-box;
    }

    html {
      font-size: 14px;
      background-color: var(--bg-color);
      color: var(--text-color);
      font-family: "Open Sans", "Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
      -webkit-font-smoothing: antialiased;
      overflow-x: initial;
    }

    body {
      margin: 0;
      padding: 0 30px;
      font-size: 1rem;
      line-height: 1.6;
      color: #333;
      tab-size: 4;
    }

    @media screen and (max-width: 500px) {
      body { padding: 0; }
    }

    #write {
	      max-width: 860px;
	      margin: 0 auto;
	      padding: 20px 24px 100px;
	    }

    @media only screen and (min-width: 1400px) {
      #write { max-width: 1024px; }
    }
    @media only screen and (min-width: 1800px) {
      #write { max-width: 1200px; }
    }

    /* ── Typography ── */
    a { color: var(--accent); }
    a:active, a:hover { outline: 0; }

    h2, h3, h4, h5, h6, p {
      position: relative;
      margin-top: 1rem;
      margin-bottom: 1rem;
    }

    h2 {
      font-size: 1.75em;
      font-weight: bold;
      line-height: 1.225;
      border-bottom: 1px solid #eee;
      padding-bottom: 6px;
    }
    h3 {
      font-size: 1.3em;
      font-weight: bold;
      line-height: 1.43;
    }
    h4 {
      font-size: 1.1em;
      font-weight: bold;
    }

    p { margin: 0.8em 0; text-indent: 2em; }
    p.no-indent { text-indent: 0; }
    blockquote, ul, ol, dl, table { margin: 0.8em 0; }
    li > ol, li > ul { margin: 0; }
    ul, ol { padding-left: 30px; }

    blockquote {
      border-left: 4px solid #dfe2e5;
      padding: 0 15px;
      color: #777;
    }

    img, video { max-width: 100%; vertical-align: middle; }
    iframe { max-width: 100%; width: 100%; border: none; }

    hr {
      height: 2px;
      padding: 0;
      margin: 16px 0;
      background-color: #e7e7e7;
      border: 0;
      overflow: hidden;
    }

    mark {
      background-color: #ff0;
      color: #000;
    }

    code, kbd, pre, samp, tt {
      font-family: "Lucida Console", Consolas, "Courier", monospace;
    }
    kbd {
      margin: 0 0.1em;
      padding: 0.1em 0.6em;
      font-size: 0.8em;
      color: #242729;
      background: #fff;
      border: 1px solid #adb3b9;
      border-radius: 3px;
      box-shadow: rgba(12,13,14,0.2) 0 1px 0, #fff 0 0 0 2px inset;
      white-space: nowrap;
      vertical-align: middle;
    }

    /* ── Tables ── */
    figure {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      margin: 1.2em 0;
      padding: 0;
    }

    table {
      border-collapse: collapse;
      border-spacing: 0;
      width: 100%;
      overflow: auto;
      text-align: left;
      padding: 0;
      word-break: initial;
    }

    table tr {
      border-top: 1px solid #dfe2e5;
      margin: 0;
      padding: 0;
    }
    table tr:nth-child(2n),
    thead { background-color: #f8f8f8; }

    table th {
      font-weight: bold;
      border: 1px solid #dfe2e5;
      border-bottom: 0;
      padding: 6px 13px;
    }
    table td {
      border: 1px solid #dfe2e5;
      padding: 6px 13px;
    }
    table th:first-child,
    table td:first-child {
      width: 40px;
      word-break: break-all;
    }
    table td:last-child {
      word-break: break-all;
    }

    @media (max-width: 768px) {
      table { font-size: 12px; }
      table th, table td { padding: 4px 6px; }
    }

    /* ── Print ── */
    @media print {
      html { font-size: 13px; }
      body, html {
        border: 1px solid transparent;
        height: 99%;
        font-variant-ligatures: no-common-ligatures;
      }
      #write { margin-top: 0; padding-top: 0; border-color: transparent !important; }
      table, pre { page-break-inside: avoid; }
      h1, h2, h3, h4, h5, h6 { break-inside: avoid; }
      .typora-export { -webkit-print-color-adjust: exact; }
    }

    /* ── Back to top ── */
    #back-to-top {
      position: fixed;
      bottom: 40px;
      right: 40px;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      background: var(--accent);
      color: #fff;
      border: none;
      font-size: 22px;
      cursor: pointer;
      opacity: 0;
      transition: opacity 0.3s, transform 0.3s;
      transform: translateY(20px);
      pointer-events: none;
      z-index: 999;
      box-shadow: 0 2px 8px rgba(0,0,0,0.2);
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
    }
    #back-to-top.visible {
      opacity: 1;
      transform: translateY(0);
      pointer-events: auto;
    }
    #back-to-top:hover {
      background: #2a6496;
    }
    @media (max-width: 768px) {
      #back-to-top {
        bottom: 20px;
        right: 20px;
        width: 38px;
        height: 38px;
        font-size: 18px;
      }
    }

    /* ── Utility ── */
    .ml-4em { margin-left: 4em; }
    .red { color: #d00; }