:root {
  --bg: #f5f5f5;
  --text: #222;
  --card-bg: #ffffff;
  --accent: #ff6600;
  --accent-strong: #e85d00;
  --shadow: rgba(0, 0, 0, 0.1);
  --hover-bg: #fff3e6;
  --muted: #666;
  --panel-border: rgba(0, 0, 0, 0.06);
  --overlay: rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] {
  --bg: #121212;
  --text: #e0e0e0;
  --card-bg: #1f1f1f;
  --accent: #ff6600;
  --accent-strong: #ff7b2d;
  --shadow: rgba(0, 0, 0, 0.6);
  --hover-bg: #2a2a2a;
  --muted: #bbbbbb;
  --panel-border: rgba(255, 255, 255, 0.08);
  --overlay: rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", sans-serif;
  transition: background 0.3s ease, color 0.3s ease;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--accent);
}

a:hover {
  color: var(--accent-strong);
}

.site-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.site-header {
  text-align: center;
  padding: 72px 20px 18px;
}

.site-header h1 {
  margin: 0 0 10px;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.15;
  color: var(--text);
}

.site-header p,
.lede {
  margin: 0 auto;
  max-width: 900px;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--muted);
}

.site-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.site-panel {
  background: linear-gradient(145deg, var(--card-bg), var(--hover-bg));
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  box-shadow: 0 8px 28px var(--shadow);
  padding: 32px 26px;
}

.site-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

.site-card {
  background: linear-gradient(145deg, var(--card-bg), var(--hover-bg));
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  box-shadow: 0 4px 20px var(--shadow);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.site-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 10px 25px var(--shadow);
  border-color: rgba(255, 102, 0, 0.3);
}

.site-card a {
  display: block;
  min-height: 92px;
  padding: 24px 18px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.08rem;
  line-height: 1.4;
}

.site-card a:hover {
  color: var(--accent);
}

.button-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.btn,
.download-btn,
button:not(.theme-toggle):not(.close-button):not(.home-button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 8px 20px rgba(255, 102, 0, 0.25);
}

.btn:hover,
.download-btn:hover,
button:not(.theme-toggle):not(.close-button):not(.home-button):hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(255, 102, 0, 0.3);
}

.home-button {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 20;
  padding: 10px 18px;
  border: none;
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 4px 12px var(--shadow);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 700;
}

.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: 0 2px 10px var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  transform: scale(1.08);
}

.theme-toggle span {
  font-size: 20px;
}

.profile {
  text-align: center;
}

.profile img {
  width: min(220px, 100%);
  margin: 0 auto 20px;
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.15);
}

.profile h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
}

.profile p {
  margin: 0 auto;
  max-width: 760px;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--muted);
}

.popup-overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: var(--overlay);
  z-index: 50;
}

.popup-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: none;
  width: min(620px, calc(100% - 30px));
  max-height: 80vh;
  overflow-y: auto;
  padding: 26px 22px 22px;
  border-radius: 18px;
  background: var(--card-bg);
  border: 1px solid var(--panel-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  z-index: 60;
}

.popup-container h2 {
  margin-top: 0;
  margin-bottom: 18px;
}

.popup-container p,
.popup-container li {
  color: var(--muted);
  line-height: 1.7;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 102, 0, 0.12);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.page-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}

.page-list li {
  margin-bottom: 12px;
  color: var(--muted);
}

.changelog-block + .changelog-block {
  margin-top: 26px;
}

.changelog-block h2 {
  margin: 0 0 12px;
  font-size: 1.5rem;
}

.changelog-block ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.changelog-block li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.changelog-block li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: bold;
}

@media (max-width: 640px) {
  .site-header {
    padding-top: 72px;
  }

  .site-panel {
    padding: 24px 18px;
  }

  .home-button {
    top: 16px;
    left: 16px;
  }

  .theme-toggle {
    top: 16px;
    right: 16px;
  }
}
