:root {
  color-scheme: dark;
  --background: #000;
  --text: #f4f4f4;
  --muted: #9e9e9e;
  --line: #343434;
  --accent: #96a1ff;
  --content-width: 500px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  width: 100%;
  min-height: 132px;
  padding: 24px 32px 0;
}

.language-switcher {
  grid-column: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 22px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.language-switcher button {
  border: 0;
  padding: 4px 2px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: var(--muted);
}

.language-switcher button:hover,
.language-switcher button.active {
  color: #fff;
}

.brand {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.12);
}

.brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.brand-name {
  display: flex;
  font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  line-height: 1;
  white-space: nowrap;
}

.brand-name span {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -0.055em;
}

#app {
  width: min(var(--content-width), calc(100% - 48px));
  margin: -12px auto 80px;
}

.post-list {
  width: 100%;
}

.post-card {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 8px 18px;
  background: transparent;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.post-card:first-child {
  border-top: 1px solid var(--line);
}

.post-card:hover,
.post-card:focus-visible {
  background: #0a0a0a;
  outline: none;
}

.post-card-title {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.post-card-meta {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.post-card-meta time {
  white-space: nowrap;
}

.post-card-summary {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article {
  width: 100%;
  padding-top: 2px;
}

.article-header {
  margin-bottom: 28px;
  text-align: center;
}

.article-header h1 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: clamp(20px, 4vw, 32px);
  line-height: 1.25;
}

.article-header time {
  color: var(--muted);
  font-size: 12px;
}

.article-back {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.article-back:hover {
  color: #fff;
}

.article-content {
  font-size: 14px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.article-content > :first-child {
  margin-top: 0;
}

.article-content h1,
.article-content h2,
.article-content h3 {
  margin: 28px 0 12px;
  color: var(--accent);
  line-height: 1.35;
}

.article-content h1 {
  font-size: 24px;
  text-align: center;
}

.article-content h2 {
  font-size: 20px;
}

.article-content h3 {
  font-size: 17px;
}

.article-content p {
  margin: 0 0 18px;
}

.article-content a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  border: 1px solid var(--line);
}

.article-content img.markdown-emoji {
  display: inline;
  width: 1.25em;
  height: 1.25em;
  margin: 0 0.08em;
  border: 0;
  vertical-align: -0.22em;
  object-fit: contain;
}

.article-content blockquote {
  margin: 20px 0;
  border-left: 2px solid #fff;
  padding: 2px 0 2px 16px;
  color: #ddd;
}

.article-content pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  padding: 14px;
  background: #090909;
}

.article-content code {
  font-family: Consolas, "Courier New", monospace;
}

.article-content ul,
.article-content ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

.progress-list {
  display: grid;
  gap: 14px;
  margin: 18px 0 24px;
  border: 1px solid var(--line);
  padding: 18px;
  background: #080808;
}

.progress-item {
  display: grid;
  gap: 7px;
}

.progress-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}

.progress-label strong {
  color: var(--accent);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  background: #242424;
}

.progress-fill {
  width: var(--progress);
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent);
}

.article-video {
  margin: 24px 0;
  border: 1px solid var(--line);
  background: #080808;
}

.article-video video {
  display: block;
  width: 100%;
  max-height: 520px;
  background: #000;
}

.article-video figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.markdown-gif {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 24px auto;
}

.markdown-gif video,
.article-gif video {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: #000;
}

.article-gif {
  margin: 24px 0;
  text-align: center;
}

.article-gif video {
  width: 100%;
  max-height: 520px;
}

.article-gif figcaption {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.empty-state,
.loading-state,
.error-state {
  padding: 32px 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 700px) {
  .topbar {
    grid-template-columns: 74px 1fr 74px;
    min-height: 112px;
    padding: 14px 16px 0;
  }

  .language-switcher {
    grid-column: 1;
    align-items: flex-start;
    padding-top: 16px;
  }

  .brand {
    grid-column: 2;
    justify-self: center;
  }

  .brand img {
    width: 44px;
    height: 44px;
  }

  .brand-name span {
    font-size: 30px;
  }

  #app {
    width: calc(100% - 32px);
  }

  .post-card {
    padding-inline: 4px;
  }

  .post-card-summary {
    display: none;
  }
}

@media (max-width: 430px) {
  .topbar {
    grid-template-columns: 56px 1fr 56px;
  }

  .brand {
    gap: 6px;
  }

  .brand img {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    display: flex;
  }

  .brand-name span {
    font-size: 18px;
  }
}
