:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #171717;
  --muted: #8a8a8a;
  --line: #dedede;
  --accent: #111111;
  --accent-ink: #ffffff;
  --warm: #f2c200;
  --shadow: 0 18px 50px rgba(17, 17, 17, 0.06);
  --tag-border: #d9d9d9;
  --tag-bg: #f3f3f3;
  --draft-bg: #f3f3f3;
  --draft-ink: #222222;
  --pre-bg: #171717;
  --pre-ink: #f7f7f7;
  --code-bg: #f1f1f1;
  --empty-bg: rgba(17, 17, 17, 0.025);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090906;
    --paper: #0f0f0f;
    --ink: #f3f3f3;
    --muted: #8f8f8f;
    --line: #2a2a2a;
    --accent: #ffd447;
    --accent-ink: #111006;
    --warm: #f2c200;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --tag-border: #3a3a3a;
    --tag-bg: #151515;
    --draft-bg: #191919;
    --draft-ink: #ffd447;
    --pre-bg: #151515;
    --pre-ink: #f3f3f3;
    --code-bg: #202020;
    --empty-bg: rgba(255, 212, 71, 0.04);
  }
}

:root[data-theme="dark"] {
  --bg: #090906;
  --paper: #0f0f0f;
  --ink: #f3f3f3;
  --muted: #8f8f8f;
  --line: #2a2a2a;
  --accent: #ffd447;
  --accent-ink: #111006;
  --warm: #f2c200;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --tag-border: #3a3a3a;
  --tag-bg: #151515;
  --draft-bg: #191919;
  --draft-ink: #ffd447;
  --pre-bg: #151515;
  --pre-ink: #f3f3f3;
  --code-bg: #202020;
  --empty-bg: rgba(255, 212, 71, 0.04);
}

html {
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
  overflow-x: hidden;
  -ms-overflow-style: none;
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

img {
  max-width: 100%;
  height: auto;
}

.site-header {
  width: min(1040px, calc(100% - 96px));
  margin: 0 auto;
  padding: 30px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 1px;
  color: var(--muted);
  font-size: 14px;
}

.icon-link,
.theme-toggle {
  width: 22px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.icon-link:hover,
.theme-toggle:hover {
  border-color: transparent;
  color: var(--accent);
}

.icon-link svg,
.theme-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.icon-link .fill-icon {
  fill: currentColor;
  stroke: none;
}

.icon-link .fill-icon * {
  fill: currentColor;
  stroke: none;
}

.icon-link .x-icon,
.icon-link .rss-icon {
  width: 15px;
  height: 15px;
}

.icon-link .github-icon {
  width: 15px;
  height: 15px;
}

.icon-link .telegram-icon {
  width: 14px;
  height: 14px;
}

.icon-link .bitcoin-icon {
  width: 21px;
  height: 21px;
}

.theme-moon {
  display: none;
}

:root[data-theme="dark"] .theme-sun {
  display: none;
}

:root[data-theme="dark"] .theme-moon {
  display: block;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-sun {
    display: none;
  }

  :root:not([data-theme="light"]) .theme-moon {
    display: block;
  }
}

.home,
.article-page,
.static-page {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto 80px;
}

.narrow {
  width: min(760px, calc(100% - 32px));
}

.index-page {
  width: min(760px, calc(100% - 40px));
  padding-top: 54px;
}

.home-page {
  padding-top: 0;
}

.index-title {
  padding: 34px 0 26px;
}

.index-title p,
.article-meta {
  margin: 0 0 10px;
  color: var(--warm);
  font-size: 13px;
  font-weight: 800;
}

.index-title h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.1;
  letter-spacing: 0;
}

.post-row {
  border-bottom: 1px solid var(--line);
}

.post-row.is-hidden {
  display: none;
}

.post-row.is-page-break {
  margin-top: 26px;
}

.post-row a {
  min-height: 52px;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(74px, auto);
  align-items: center;
  gap: 0;
  color: inherit;
  text-decoration: none;
  background: transparent;
}

.post-row time {
  color: var(--warm);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.post-row h2 {
  margin: 0;
  padding-right: 18px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
}

.row-directory {
  min-width: 74px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
  transform: translateX(0);
  transition: color 160ms ease, transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.directory-name {
  max-width: 98px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-action {
  position: relative;
  width: 11px;
  height: 8px;
  flex: 0 0 11px;
  display: inline-block;
  color: transparent;
  font-size: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(2px) scale(0.9);
  transition: color 160ms ease, opacity 160ms ease, transform 160ms ease, visibility 0s linear 160ms;
}

.row-action::before,
.row-action::after {
  content: "";
  position: absolute;
  top: 50%;
  display: block;
}

.row-action::before {
  left: 0;
  width: 10px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translateY(-50%);
}

.row-action::after {
  right: 0;
  width: 5px;
  height: 5px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.post-row a:hover h2,
.post-row a:focus-visible h2 {
  color: var(--accent);
}

.post-row a:hover .row-action,
.post-row a:focus-visible .row-action {
  color: var(--warm);
  opacity: 1;
  visibility: visible;
  transform: translateX(0) scale(0.9);
  transition-delay: 0s;
}

.post-row a:hover .row-directory,
.post-row a:focus-visible .row-directory {
  color: var(--accent);
  transform: translateX(-12px);
}

.load-more {
  min-width: 82px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 36px auto 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  cursor: pointer;
}

.load-more:hover,
.load-more:focus-visible {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body.home-view.has-home-chaos .site-header {
    position: fixed;
    top: 0;
    left: 50%;
    z-index: 20;
    transform: translateX(-50%);
    pointer-events: none;
  }

  body.home-view.has-home-chaos .brand,
  body.home-view.has-home-chaos .site-header nav {
    opacity: 0;
    visibility: hidden;
    transition: opacity 260ms ease, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 260ms;
  }

  body.home-view.has-home-chaos .brand {
    transform: translateX(-28px);
  }

  body.home-view.has-home-chaos .site-header nav {
    transform: translateX(28px);
  }

  body.home-view.has-home-chaos.is-home-gathered .site-header {
    pointer-events: auto;
  }

  body.home-view.has-home-chaos.is-home-gathered .brand,
  body.home-view.has-home-chaos.is-home-gathered .site-header nav {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition-delay: 40ms;
  }

  body.home-view.has-home-chaos .home-page {
    padding-top: 76px;
  }

  body.home-view.has-home-chaos .load-more {
    opacity: 0;
    pointer-events: none;
    transform: translateY(28px);
  }

  body.home-view.has-home-chaos.is-home-gathered .load-more {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  body.home-view.has-home-chaos .site-footer {
    opacity: 0;
    pointer-events: none;
    transform: translateY(26px);
    transition: opacity 260ms ease, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  body.home-view.has-home-chaos.is-home-gathered .site-footer {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .index-page.has-chaos {
    position: relative;
  }

  .index-page.has-chaos .post-list {
    position: relative;
    z-index: 1;
  }

  .index-page.has-chaos .post-row {
    transform: translate3d(var(--scatter-x, 0), var(--scatter-y, 0), 0) rotate(var(--scatter-r, 0deg));
    transform-origin: center center;
    transition: transform 720ms cubic-bezier(0.2, 0.8, 0.15, 1), opacity 180ms ease;
    transition-delay: var(--scatter-delay, 0ms);
    will-change: transform;
  }

  .index-page.has-chaos.is-gathered .post-row,
  .index-page.has-chaos:focus-within .post-row {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  .index-page.has-chaos .load-more {
    margin-top: 76px;
    transition: margin-top 420ms ease, opacity 260ms ease, transform 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .index-page.has-chaos.is-gathered .load-more,
  .index-page.has-chaos:focus-within .load-more {
    margin-top: 36px;
  }
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags a {
  padding: 5px 9px;
  border: 1px solid var(--tag-border);
  border-radius: 999px;
  color: var(--accent);
  background: var(--tag-bg);
  font-size: 13px;
  text-decoration: none;
}

.article {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding-top: 30px;
}

.article header {
  padding: 20px 0 62px;
  text-align: center;
}

.article h1 {
  width: min(1080px, 100%);
  margin: 20px auto 0;
  font-size: 38px;
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: 0;
}

.article h1::after {
  content: "";
  width: min(220px, 42%);
  height: 1px;
  display: block;
  margin: 24px auto 0;
  background: var(--line);
}

.article-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 9px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
  text-transform: uppercase;
}

.article-meta a {
  color: var(--warm);
  text-decoration: none;
}

.article-category {
  color: var(--warm);
}

.article-meta a:hover,
.article-meta a:focus-visible {
  text-decoration: underline;
}

.article-meta .article-category:hover,
.article-meta .article-category:focus-visible {
  text-decoration: none;
}

.meta-dot {
  color: var(--muted);
}

.summary {
  width: min(1080px, 100%);
  margin: 28px auto 0;
  color: var(--warm);
  font-size: clamp(18px, 2.1vw, 25px);
  font-weight: 500;
  line-height: 1.65;
}

.draft-badge {
  margin-left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--draft-bg);
  color: var(--draft-ink);
}

.article-cover {
  width: min(1080px, 100%);
  margin: 0 auto 52px;
  overflow: hidden;
  border-radius: 0;
  border: 0;
  background: transparent;
}

.article-cover img {
  width: 100%;
  aspect-ratio: 2 / 1;
  object-fit: cover;
  display: block;
}

.content {
  width: min(760px, 100%);
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.85;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  margin: 1.8em 0 0.7em;
  line-height: 1.25;
  letter-spacing: 0;
}

.content h2 {
  font-size: 28px;
}

.content h3 {
  font-size: 22px;
}

.content p,
.content ul,
.content ol,
.content blockquote,
.content pre {
  margin: 0 0 1.1em;
}

.content blockquote {
  padding: 2px 0 2px 18px;
  border-left: 4px solid var(--accent);
  color: var(--muted);
}

.content pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 8px;
  background: var(--pre-bg);
  color: var(--pre-ink);
}

.content code {
  padding: 0.12em 0.3em;
  border-radius: 4px;
  background: var(--code-bg);
  font-size: 0.92em;
}

.content pre code {
  padding: 0;
  background: transparent;
}

.content img {
  display: block;
  margin: 1.4em auto;
  border-radius: 0;
}

.content hr {
  height: 5px;
  margin: 2.8em 0;
  border: 0;
  background: var(--warm);
}

.portfolio-public {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 80px;
  padding-top: 24px;
}

.portfolio-public-card header {
  margin-bottom: 22px;
  text-align: center;
}

.portfolio-public-card h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0;
}

.portfolio-public-card header p:last-child {
  width: min(680px, 100%);
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.portfolio-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  overflow: hidden;
}

.portfolio-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.portfolio-card-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.portfolio-card-head span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.position-table {
  min-width: 0;
}

.position-head,
.position-row.is-static,
.position-row summary {
  display: grid;
  grid-template-columns: minmax(64px, 0.9fr) 54px repeat(4, minmax(0, 1fr));
  align-items: center;
  column-gap: 12px;
}

.position-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.position-row {
  border-bottom: 1px solid var(--line);
}

.position-row:last-child {
  border-bottom: 0;
}

.position-row.is-static,
.position-row summary {
  min-height: 42px;
  padding: 0 14px;
}

.position-row summary {
  cursor: pointer;
  list-style: none;
  transition: background 160ms ease, color 160ms ease;
}

.position-row summary::-webkit-details-marker {
  display: none;
}

.position-row summary strong::after {
  content: "+";
  margin-left: 8px;
  color: var(--warm);
  font-size: 12px;
  font-weight: 900;
}

.position-row[open] summary strong::after {
  content: "-";
}

.position-row summary:hover {
  color: var(--warm);
  background: var(--empty-bg);
}

.position-row > span:not(:first-child),
.position-row > summary > span:not(:first-child),
.position-head > span:not(:first-child) {
  text-align: right;
}

.position-row > span,
.position-row > summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.position-row > span strong,
.position-row > summary > span strong {
  color: var(--ink);
}

.position-status {
  justify-self: end;
  color: #2f9e44;
  font-weight: 900;
}

.position-status.is-holding {
  color: #2f9e44;
}

.position-status.is-building {
  color: var(--warm);
}

.position-status.is-reduced {
  color: #2f80ed;
}

.position-status.is-clear {
  color: #d94b4b;
}

.profit-value {
  color: var(--muted);
  font-weight: 900;
}

.profit-value.is-profit {
  color: #2f9e44;
}

.profit-value.is-loss {
  color: #d94b4b;
}

.addition-list {
  margin: 0 14px 12px;
  padding: 12px;
  border-radius: 6px;
  background: var(--empty-bg);
}

.addition-head,
.addition-row {
  display: grid;
  grid-template-columns: 0.7fr repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.addition-head {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.addition-row {
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.addition-row.is-add span:first-child {
  color: var(--warm);
  font-weight: 900;
}

.addition-row.is-reduce span:first-child {
  color: #d98b8b;
  font-weight: 900;
}

.portfolio-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.portfolio-summary div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.portfolio-summary span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.portfolio-summary strong {
  font-size: 22px;
  line-height: 1.15;
}

.portfolio-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.portfolio-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.portfolio-table th,
.portfolio-table td {
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}

.portfolio-table th:first-child,
.portfolio-table td:first-child,
.portfolio-table th:nth-child(2),
.portfolio-table td:nth-child(2),
.portfolio-table th:last-child,
.portfolio-table td:last-child {
  text-align: left;
}

.portfolio-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.portfolio-table td {
  color: var(--muted);
  font-size: 14px;
}

.portfolio-table td strong {
  color: var(--ink);
}

.portfolio-table tr:last-child td {
  border-bottom: 0;
}

.portfolio-note {
  margin: 0;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--empty-bg);
  text-align: center;
}

.static-page {
  width: min(980px, calc(100% - 40px));
  padding-top: 38px;
}

.static-article header {
  text-align: center;
}

.static-article h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 66px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}

.static-article .draft-badge {
  display: inline-block;
  margin: 18px 0 0;
}

.static-content {
  width: min(760px, 100%);
  margin: 72px auto 0;
  font-size: 19px;
  line-height: 1.9;
}

.static-content ul,
.static-content ol {
  padding-left: 1.5em;
}

.static-content li {
  margin-bottom: 0.8em;
}

.static-content a {
  color: var(--warm);
  font-style: italic;
  font-weight: 700;
  text-decoration-thickness: 0.08em;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--empty-bg);
}

.site-footer {
  width: min(760px, calc(100% - 40px));
  margin: 20px auto 32px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
}

.site-footer p {
  margin: 0 0 6px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 7px;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--warm);
}

.footer-separator {
  color: var(--muted);
  opacity: 0.7;
}

@media (max-width: 720px) {
  .site-header {
    padding: 18px 0;
  }

  .home,
  .article-page,
  .static-page,
  .portfolio-public,
  .site-header {
    width: min(100% - 28px, 1500px);
  }

  .post-row a {
    min-height: 58px;
    grid-template-columns: 52px minmax(0, 1fr) minmax(54px, auto);
    grid-template-areas:
      "date title action";
    column-gap: 12px;
    padding: 14px 0;
  }

  .home-page {
    padding-top: 0;
  }

  .post-row time {
    grid-area: date;
    align-self: start;
    padding-top: 5px;
    font-size: 11px;
  }

  .post-row h2 {
    grid-area: title;
    padding-right: 0;
    font-size: 16px;
    line-height: 1.38;
  }

  .row-directory {
    grid-area: action;
    align-self: start;
    min-width: 54px;
    padding-top: 6px;
    font-size: 11px;
  }

  .directory-name {
    max-width: 58px;
  }

  .row-action {
    width: 10px;
    height: 8px;
    flex-basis: 10px;
  }

  .load-more {
    min-width: 82px;
    height: 30px;
    margin-top: 30px;
    font-size: 10px;
  }

  .index-page.has-chaos::before {
    display: none;
  }

  .index-page.has-chaos .post-list {
    border-top-color: var(--line);
  }

  .index-page.has-chaos .post-row {
    transform: none;
    transition: none;
  }

  .article {
    padding-top: 16px;
  }

  .portfolio-summary {
    grid-template-columns: 1fr;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-public {
    padding-top: 24px;
  }

  .position-head,
  .position-row.is-static,
  .position-row summary {
    grid-template-columns: minmax(58px, 0.9fr) 48px repeat(4, minmax(50px, 0.8fr));
    column-gap: 8px;
  }

  .position-head,
  .position-row.is-static,
  .position-row summary {
    padding-left: 12px;
    padding-right: 12px;
  }

  .portfolio-public-card header {
    margin-bottom: 24px;
  }

  .static-page {
    padding-top: 24px;
  }

  .static-content {
    margin-top: 44px;
    font-size: 17px;
  }

  .site-footer {
    margin-bottom: 24px;
    font-size: 12px;
  }
}
