:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --text: #202124;
  --text-muted: #5f6368;
  --border: #e0e0e0;
  --primary: #1a73e8;
  --primary-hover: #1765cc;
  --primary-soft: #e8f0fe;
  --accent: #ea4335;
  --star: #fbbc04;
  --radius: 12px;
  --shadow-1: 0 1px 2px rgba(60, 64, 67, 0.1), 0 1px 3px rgba(60, 64, 67, 0.08);
  --shadow-2: 0 2px 6px rgba(60, 64, 67, 0.15), 0 1px 2px rgba(60, 64, 67, 0.1);
  --header-height: 64px;
  --nav-height: 48px;
  --max-width: 1280px;
  --font-sans: "Google Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #202124;
    --surface: #2d2e31;
    --surface-2: #35363a;
    --text: #e8eaed;
    --text-muted: #9aa0a6;
    --border: #3c4043;
    --primary: #8ab4f8;
    --primary-hover: #aecbfa;
    --primary-soft: #1f2a3a;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: 8px 12px;
  z-index: 999;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ------- Header ------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: var(--header-height);
  padding: 0 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 18px;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: conic-gradient(from 90deg, #4285f4, #34a853, #fbbc04, #ea4335, #4285f4);
  box-shadow: inset 0 0 0 6px var(--surface);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--primary);
}
.brand-name em { font-style: normal; color: var(--text-muted); font-weight: 400; margin-left: 4px; }

.search {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0 6px 0 18px;
  max-width: 640px;
  width: 100%;
  justify-self: center;
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.search:focus-within {
  background: var(--surface);
  border-color: var(--primary);
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 10px 8px;
  font-size: 15px;
  color: var(--text);
  outline: none;
}
.search button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  width: 36px; height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search button:hover { background: var(--surface-2); color: var(--text); }
.search svg { width: 18px; height: 18px; }

.header-actions { display: flex; gap: 8px; align-items: center; }

.primary-btn, .ghost-btn {
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.primary-btn { background: var(--primary); color: #fff; }
.primary-btn:hover { background: var(--primary-hover); }
.ghost-btn { background: transparent; color: var(--primary); border-color: var(--border); }
.ghost-btn:hover { background: var(--primary-soft); border-color: var(--primary-soft); }

.primary-nav {
  border-top: 1px solid var(--border);
}
.primary-nav ul {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-height);
  list-style: none;
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.primary-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  font-weight: 500;
  font-size: 14px;
}
.primary-nav a:hover { color: var(--text); text-decoration: none; }
.primary-nav a.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ------- Layout ------- */
.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
}

.sidebar {
  position: sticky;
  top: calc(var(--header-height) + var(--nav-height) + 24px);
  align-self: start;
}
.sidebar h2 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 8px 12px 12px;
}
.sidebar ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
}
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.sidebar .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  flex: 0 0 auto;
}

/* ------- Hero ------- */
.hero {
  background: linear-gradient(135deg, #4285f4 0%, #34a853 100%);
  color: #fff;
  border-radius: 16px;
  padding: 40px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: center;
  overflow: hidden;
  position: relative;
}
.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  opacity: .85;
  margin: 0 0 8px;
}
.hero h1 { font-size: 36px; line-height: 1.2; margin: 0 0 12px; }
.hero .lead { margin: 0 0 24px; font-size: 16px; opacity: .9; }
.hero .primary-btn { background: #fff; color: var(--primary); }
.hero .primary-btn:hover { background: #f1f3f4; }
.hero-art {
  height: 200px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.55), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(255,255,255,.35), transparent 50%),
    rgba(255,255,255,.12);
  backdrop-filter: blur(6px);
}

/* ------- Shelf / Cards ------- */
.shelf { margin-top: 40px; }
.shelf-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.shelf-header h2 { font-size: 20px; margin: 0; }
.see-all { color: var(--primary); font-size: 14px; font-weight: 500; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.theme-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.card:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
  border-color: transparent;
}

.card-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 20px;
}
.card-title { margin: 4px 0 0; font-size: 16px; }
.card-author { margin: 0; font-size: 13px; color: var(--text-muted); }
.card-desc {
  margin: 4px 0 8px;
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}
.rating { color: var(--star); letter-spacing: 1px; }

.card-theme { padding: 0; overflow: hidden; }
.card-theme .card-title { padding: 0 16px; }
.card-theme .card-author { padding: 0 16px; }
.card-theme .card-meta { padding: 0 16px 16px; }
.theme-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

/* ------- Footer ------- */
.site-footer {
  margin-top: 80px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.footer-inner ul { display: flex; list-style: none; padding: 0; margin: 0; gap: 20px; }

/* ------- Responsive ------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero { grid-template-columns: 1fr; padding: 28px; }
  .hero h1 { font-size: 28px; }
}
@media (max-width: 720px) {
  .header-inner { grid-template-columns: auto 1fr; gap: 12px; padding: 0 16px; }
  .header-actions { display: none; }
  .search { max-width: none; }
  .layout { padding: 16px; }
}
