:root {
  --primary: #3BB0D0;
  --primary-hover: #34a0bd;
  --primary-soft: rgba(59, 176, 208, 0.10);

  --blueish-bg: #F5F9FC;
  --blueish-surface: #ECF2F7;
  --soft-blue: #D9EEF4;

  --danger: #e74c3c;
  --red: #CC3D6A;
  --light-red: #F0D4DD;
  --green: #508B26;
  --light-green: #D7E4D0;
  --warning: #FFA500;
  --warning-light: #FFF3CD;

  --text: #1a1a1a;
  --text-secondary: #808080;
  --text-muted: #666666;

  --bg: #ffffff;
  --bg-soft: #fafafa;
  --border: #E0E0E0;
  --border-soft: #e8e8e8;

  --radius: 15px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 14px rgba(59, 176, 208, 0.10);

  --font: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--blueish-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* --- Header --- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.avatar { flex-shrink: 0; }

.nav a {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 160ms ease, color 160ms ease;
}

.nav a:hover {
  color: var(--text);
  background: var(--blueish-surface);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary);
  padding: 8px 12px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  border: none;
  font-size: 14px;
  transition: background 160ms ease;
}

.avatar:hover { background: var(--primary-hover); }

/* --- Page --- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* --- Category grid --- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* --- Category card (mirrors NavigationCard container) --- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-box {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}

.card-text { flex: 1; min-width: 0; }

.card-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
}

.card-subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

.count-pill {
  background: var(--blueish-surface);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

/* --- Download item (chevron row) --- */
.items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 140ms ease, transform 140ms ease;
}

.item:hover {
  background: var(--blueish-surface);
}

.item .item-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.item .item-icon svg { width: 15px; height: 15px; }

.item .item-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item .chevron {
  color: var(--border);
  flex-shrink: 0;
  transition: color 140ms ease, transform 140ms ease;
}

.item:hover .chevron {
  color: var(--primary);
  transform: translateX(2px);
}

.item {
  transition: background 140ms ease, transform 140ms ease, opacity 260ms ease, max-height 320ms ease, padding 260ms ease, margin 260ms ease;
}

.item.is-collapsible {
  overflow: hidden;
  max-height: 60px;
}

.item.is-hidden {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
  pointer-events: none;
  transform: translateY(-4px);
}

.show-more {
  margin-top: 4px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-top: 1px dashed var(--border-soft);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 140ms ease;
}

.show-more:hover { background: var(--primary-soft); }

.show-more .arrow {
  transition: transform 200ms ease;
}

.show-more.is-open .arrow {
  transform: rotate(180deg);
}

/* Optional: external link tag */
.badge-ext {
  font-size: 10px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* --- Responsive --- */
@media (max-width: 720px) {
  .header-inner {
    padding: 10px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .brand { flex: 1; min-width: 0; }
  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
  }
  .avatar { order: 2; margin-left: auto; }
  .nav {
    order: 3;
    flex-basis: 100%;
    margin-left: 0;
    gap: 2px;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .timer {
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .page { padding: 20px 14px 40px; }
  .grid { grid-template-columns: 1fr; }
}
