:root,
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-elevated: #161b22;
  --bg-muted: #21262d;
  --bg-hover: #30363d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79b8ff;
  --green: #3fb950;
  --green-bg: rgba(63, 185, 80, 0.15);
  --green-border: rgba(63, 185, 80, 0.3);
  --error: #f85149;
  --btn-primary-bg: #238636;
  --btn-primary-hover: #2ea043;
  --asset-hover: rgba(255, 255, 255, 0.02);
  --icon-win-bg: rgba(88, 166, 255, 0.15);
  --icon-mac-bg: rgba(163, 113, 247, 0.15);
  --icon-other-bg: rgba(210, 153, 34, 0.15);
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", Helvetica, Arial, sans-serif;
}

[data-theme='light'] {
  color-scheme: light;
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-muted: #f6f8fa;
  --bg-hover: #eef1f4;
  --border: #d0d7de;
  --text: #1f2328;
  --text-muted: #656d76;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --green: #1a7f37;
  --green-bg: #dafbe1;
  --green-border: rgba(26, 127, 55, 0.4);
  --error: #cf222e;
  --btn-primary-bg: #1f883d;
  --btn-primary-hover: #1a7f37;
  --asset-hover: #f6f8fa;
  --icon-win-bg: #ddf4ff;
  --icon-mac-bg: #fbefff;
  --icon-other-bg: #fff8c5;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background 0.2s, color 0.2s;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 20px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
}

.brand h1 {
  font-size: 20px;
  font-weight: 600;
}

.subtitle {
  color: var(--text-muted);
  font-size: 13px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.download-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.btn-primary {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: #fff;
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
}

.btn-theme {
  padding: 8px 10px;
  min-width: 40px;
  justify-content: center;
}

.theme-menu {
  position: relative;
}

.theme-trigger-icon {
  display: none;
}

[data-theme-pref='light'] .icon-pref-light,
[data-theme-pref='dark'] .icon-pref-dark,
[data-theme-pref='auto'] .icon-pref-auto {
  display: block;
}

.theme-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 100;
  min-width: 192px;
  padding: 8px 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme='dark'] .theme-dropdown {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.theme-option:hover {
  background: var(--bg-hover);
}

.theme-option[aria-checked='true'] {
  font-weight: 600;
}

.theme-option span {
  flex: 1;
}

.theme-check {
  opacity: 0;
  color: var(--accent);
}

.theme-option[aria-checked='true'] .theme-check {
  opacity: 1;
}

.hero {
  padding: 32px 0 8px;
}

.hero-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.hero-card h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.hero-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.hero-notes {
  font-size: 14px;
  color: var(--text);
}

.hero-notes h1, .hero-notes h2, .hero-notes h3 {
  margin: 16px 0 8px;
  font-size: 15px;
}

.hero-notes h2:first-child, .hero-notes h3:first-child {
  margin-top: 0;
}

.hero-notes ul, .hero-notes ol,
.notes-body ul, .notes-body ol {
  padding-left: 20px;
  margin: 8px 0 12px;
}

.hero-notes li,
.notes-body li {
  margin: 6px 0;
}

.hero-notes p,
.notes-body p {
  margin: 8px 0;
}

.hero-notes code {
  background: var(--bg-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.release {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}

.release-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.release-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.release-title h3 {
  font-size: 18px;
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tag-latest {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.release-date {
  color: var(--text-muted);
  font-size: 13px;
}

.assets {
  list-style: none;
}

.asset {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.asset:last-child { border-bottom: none; }

.asset:hover { background: var(--asset-hover); }

.asset-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.asset-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.icon-win { background: var(--icon-win-bg); }
.icon-mac { background: var(--icon-mac-bg); }
.icon-other { background: var(--icon-other-bg); }

.asset-name {
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
}

.asset-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.asset-download {
  flex-shrink: 0;
}

.release-notes {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.release-notes summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  user-select: none;
}

.release-notes summary:hover {
  color: var(--accent-hover);
}

.release-notes .notes-body {
  margin-top: 12px;
}

.loading, .error, .empty {
  color: var(--text-muted);
  padding: 40px 0;
  text-align: center;
}

.error { color: var(--error); }

.footer {
  margin-top: 48px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.footer .container {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .asset {
    flex-direction: column;
    align-items: flex-start;
  }
  .asset-download { width: 100%; }
  .asset-download .btn { width: 100%; justify-content: center; }
}
