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

:root {
  --bg: #f6f5f1;
  --bg-card: #ffffff;
  --text-primary: #2c2c2c;
  --text-secondary: #7a7a7a;
  --text-tertiary: #b0aca6;
  --accent: #5b7a6a;
  --accent-light: #e8efeb;
  --border: #e8e6e1;
  --shadow: 0 2px 20px rgba(0,0,0,0.04);
  --shadow-hover: 0 8px 32px rgba(0,0,0,0.08);
  --radius: 16px;
  --transition: cubic-bezier(0.23, 1, 0.32, 1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Serif SC', 'Georgia', serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle background texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(91,122,106,0.06), transparent),
    radial-gradient(ellipse 60% 50% at 85% 80%, rgba(180,160,130,0.05), transparent);
  pointer-events: none;
  z-index: 0;
}

/* Layout */
.page {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 40px;
  gap: 48px;
}

.main {
  flex: 1;
  min-width: 0;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 60px;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}

/* Header */
.header {
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--transition) 0.1s forwards;
}

.header h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.header h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 32px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s var(--transition);
}

.header:hover h1::after {
  width: 100%;
}

.header .subtitle {
  margin-top: 18px;
  font-size: 14px;
  color: var(--text-secondary);
  letter-spacing: 2px;
  font-weight: 400;
}

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

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.5s var(--transition);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--transition);
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-light);
}

.tool-card:hover::before {
  transform: scaleX(1);
}

.tool-card .card-icon {
  font-size: 32px;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s var(--transition);
}

.tool-card .card-icon-image {
  border-radius: 8px;
  overflow: hidden;
  background: var(--accent-light);
}

.tool-card .card-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tool-card:hover .card-icon {
  transform: scale(1.1) rotate(-3deg);
}

.tool-card .card-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
}

.tool-card .card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.tool-card .card-arrow {
  margin-top: auto;
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.3s, gap 0.4s var(--transition);
}

.tool-card:hover .card-arrow {
  color: var(--accent);
  gap: 10px;
}

/* Sidebar */
.sidebar-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--transition) 0.3s forwards;
}

.avatar-wrap {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--border);
  transition: border-color 0.4s, transform 0.5s var(--transition);
}

.avatar-wrap:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 3px;
}

.github-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: all 0.4s var(--transition);
  text-decoration: none;
}

.github-link:hover {
  color: var(--text-primary);
  background: var(--accent-light);
  transform: scale(1.1);
}

.github-link svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.divider {
  width: 40px;
  height: 1px;
  background: var(--border);
}

.hitokoto {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.8;
  min-height: 40px;
  opacity: 0;
  transition: opacity 0.6s;
  font-style: italic;
}

.hitokoto.loaded { opacity: 1; }

.hitokoto-from {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-style: normal;
}

.footer-text {
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 2px;
  margin-top: 8px;
}

/* Animations */
@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-animated {
  animation: fadeSlideUp 0.6s var(--transition) forwards;
}

/* Responsive */
@media (max-width: 860px) {
  .page {
    flex-direction: column-reverse;
    padding: 32px 20px;
    gap: 32px;
  }

  .sidebar {
    position: static;
    width: 100%;
  }

  .sidebar-inner {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 24px;
    gap: 16px;
  }

  .avatar-wrap {
    width: 64px;
    height: 64px;
  }

  .profile-name { font-size: 16px; }

  .hitokoto-section {
    flex-basis: 100%;
    text-align: center;
  }

  .divider { display: none; }

  .header { margin-bottom: 32px; }

  .tool-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }

  .tool-card { padding: 22px 18px; }
}

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

  .header h1 {
    font-size: 22px;
  }
}

/* Loading placeholder */
.loading-shimmer {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 160px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.load-error {
  color: var(--text-secondary);
  grid-column: 1 / -1;
}
