*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --border: #d2d2d7;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --shadow: rgba(0, 0, 0, 0.08);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #1d1d1f;
  --surface: #2c2c2e;
  --text: #f5f5f7;
  --text-secondary: #a1a1a6;
  --border: #3a3a3c;
  --accent: #2997ff;
  --accent-hover: #64b5f6;
  --shadow: rgba(0, 0, 0, 0.3);
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 2.5rem 1.5rem 1.5rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 640px;
  line-height: 1.5;
}

#theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
}

#theme-toggle:hover {
  border-color: var(--accent);
}

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

main {
  flex: 1;
  padding: 0 1.5rem 3rem;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 0.2s, border-color 0.2s;
  text-decoration: none;
  color: inherit;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--shadow);
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.card p {
  color: var(--text-secondary);
  font-size: 0.925rem;
  flex: 1;
}

.card-links {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.card-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.card-links a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }
}
