.stat-card {
  text-align: center;
  box-shadow: none;
}

.stat-card:hover {
  transform: none;
  box-shadow: none;
}

.stat-number {
  display: block;
  font-family: var(--headings);
  font-size: var(--text-4xl);
  color: var(--shadowColor);
  margin-bottom: 0.5rem;
}

.stat-label {
  display: block;
  font-size: var(--text-sm);
  color: var(--borderColor);
  opacity: 0.8;
}

.loading-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  font-size: var(--text-base);
  color: var(--shadowColor);
  opacity: 0.7;
}

.dot {
  opacity: 0;
  animation: dotPulse 1.4s infinite;
}

.dot1 { animation-delay: 0s; }
.dot2 { animation-delay: 0.2s; }
.dot3 { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

.fade-out {
  animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; }
}

.section-content {
  animation: fadeIn ease 0.5s;
  transition: all 0.3s ease;
}

.project-card {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.project-banner-wrap {
  position: relative;
  display: flex;
  min-width: 0;
}

.project-banner {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-banner-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  height: 100%;
  min-height: 9rem;
  padding: 1rem;
  box-sizing: border-box;
  background-color: var(--contentColor);
  border-right: 0.15rem solid var(--borderColor);
  font-family: var(--theme-heading-font);
  font-size: var(--text-2xl);
  color: var(--borderColor);
  text-align: center;
  word-break: break-word;
}

.project-banner-loader {
  display: block;
}

.project-banner-loader[hidden] {
  display: none;
}

.project-card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.5rem;
}

.project-card-body .card-title {
  font-size: var(--text-2xl);
}

.project-card-body .card-excerpt {
  margin: 0 0 0.5rem 0;
}

.project-card-body .card-link {
  margin-top: auto;
}

#commit-card {
  margin-top: 1.5rem;
  animation: fadeIn ease 0.8s;
  box-shadow: none;
}

#commit-card .card-subtitle {
  font-family: var(--theme-content-font);
  font-size: var(--text-sm);
  color: var(--borderColor);
  margin: -0.25rem 0 0.75rem 0;
}

#commit-card:hover {
  transform: none;
  box-shadow: none;
}

.commit-activity-chart {
  display: flex;
  gap: 0.5rem;
}

.commit-plot {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.commit-chart-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.commit-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.commit-baseline {
  stroke: var(--borderColor);
  stroke-width: 2;
  opacity: 0.5;
}

.commit-line {
  fill: none;
  stroke: var(--linkColor);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.commit-point {
  fill: var(--backgroundColor);
  stroke: var(--linkColor);
  stroke-width: 2;
  cursor: pointer;
  transition: fill 0.2s ease;
}

.commit-point:hover {
  fill: var(--linkColor);
}

.commit-point--empty {
  fill: var(--contentColor);
  stroke: var(--borderColor);
}

.commit-point--edge {
  fill: var(--linkColor);
}

.issue-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.issue-line--open {
  stroke: var(--errorColor);
}

.issue-line--closed {
  stroke: var(--infoColor);
  stroke-dasharray: 6 4;
}

.issue-point {
  cursor: pointer;
  stroke-width: 2;
  transition: fill 0.2s ease;
}

.issue-point--open {
  fill: var(--backgroundColor);
  stroke: var(--errorColor);
}

.issue-point--open:hover {
  fill: var(--errorColor);
}

.issue-point--closed {
  fill: var(--backgroundColor);
  stroke: var(--infoColor);
}

.issue-point--closed:hover {
  fill: var(--infoColor);
}

.issue-point--empty {
  opacity: 0.4;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  justify-content: center;
  margin-bottom: 0.6rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-xs);
  color: var(--borderColor);
  opacity: 0.85;
  line-height: 1;
}

.legend-swatch {
  width: 1.1rem;
  height: 0.25rem;
  border-radius: 0.15rem;
}

.legend-swatch--commits {
  background-color: var(--linkColor);
}

.legend-swatch--open {
  background-color: var(--errorColor);
}

.legend-swatch--closed {
  background-image: repeating-linear-gradient(
    to right,
    var(--infoColor) 0,
    var(--infoColor) 0.4rem,
    transparent 0.4rem,
    transparent 0.8rem
  );
}

.commit-labels {
  display: flex;
  margin-top: 0.4rem;
}

.commit-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--borderColor);
  line-height: 1.2;
  opacity: 0.75;
}

.myspace-fallback {
  text-align: center;
  color: var(--shadowColor);
  font-style: italic;
}

.leetcode-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

#lc-recent {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 2rem;
  font-size: var(--text-base);
  color: var(--shadowColor);
}

#lc-recent p {
  margin: 0;
  line-height: 1;
}

#lc-link {
  margin-left: auto;
}

#lc-profile-link {
  display: inline;
  margin-top: 0;
  line-height: 1;
  vertical-align: baseline;
}

#lc-fallback {
  display: none;
  text-align: center;
  color: var(--shadowColor);
  font-style: italic;
}

#lc-submissions-card {
  margin-top: 1.5rem;
  box-shadow: none;
}

#lc-submissions-card:hover {
  transform: none;
  box-shadow: none;
}

.lc-activity {
  position: relative;
  min-height: 6rem;
  margin-bottom: 1.2rem;
  padding: 0.75rem;
  background-color: var(--contentColor);
  border: 0.1rem solid var(--borderColor);
  border-radius: 0.3rem;
}

.lc-activity-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 4.5rem;
  text-align: center;
  color: var(--shadowColor);
  font-size: var(--text-sm);
}

.lc-loading {
  flex-direction: row;
  gap: 0.6rem;
}

.lc-spinner {
  width: 1.1rem;
  height: 1.1rem;
  border: 0.15rem solid var(--shadowColor);
  border-top-color: transparent;
  border-radius: 50%;
  animation: lcSpinner 0.7s linear infinite;
}

@keyframes lcSpinner {
  to { transform: rotate(360deg); }
}

.lc-error {
  flex-direction: row;
  gap: 0.6rem;
}

.lc-error-icon {
  flex: 0 0 auto;
  width: 1.3rem;
  height: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.12rem solid var(--borderColor);
  border-radius: 50%;
  font-family: var(--headings);
  font-size: var(--text-sm);
  color: var(--shadowColor);
}

.lc-error-text {
  color: var(--shadowColor);
  font-style: italic;
  opacity: 0.85;
}

.lc-activity-chart {
  display: flex;
  gap: 0.5rem;
}

.lc-yaxis {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.lc-axis-label {
  font-family: var(--headings);
  color: var(--borderColor);
  font-size: var(--text-sm);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  opacity: 0.75;
}

.lc-plot {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.lc-total {
  align-self: flex-end;
  font-family: var(--headings);
  font-size: var(--text-sm);
  color: var(--shadowColor);
  margin-bottom: 0.4rem;
}

.lc-activity-bars {
  display: flex;
  /* align-items: flex-end; */
  gap: 0.5rem;
  height: 15rem;
  /* width: 45rem; */
  overflow: visible;
}

.lc-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.lc-tooltip-date {
  display: block;
  font-family: var(--headings);
  font-size: var(--text-sm);
}

.lc-tooltip-date em,
.lc-tooltip-max em {
  font-style: normal;
  opacity: 0.75;
  font-size: var(--text-xs);
}

.lc-tooltip-count {
  display: block;
  font-size: var(--text-sm);
  margin-top: 0.35rem;
}

.lc-tooltip-meter {
  display: block;
  width: 9rem;
  max-width: 100%;
  height: 0.3rem;
  background-color: var(--backgroundColor);
  border: 0.05rem solid var(--borderColor);
  border-radius: 0.15rem;
  overflow: hidden;
  margin-top: 0.35rem;
}

.lc-tooltip-meter span {
  display: block;
  height: 100%;
  background-color: var(--linkColor);
}

.lc-tooltip-max {
  display: block;
  font-size: var(--text-xs);
  opacity: 0.85;
  margin-top: 0.15rem;
}

.lc-bar {
  width: 100%;
  background-color: var(--linkColor);
  opacity: 0.85;
  border-radius: 0.15rem 0.15rem 0 0;
  transition: opacity 0.2s ease;
}

.lc-bar:hover {
  opacity: 1;
}

.lc-col-label {
  font-size: var(--text-xs);
  color: var(--borderColor);
  line-height: 1;
  margin-top: 0.25rem;
  opacity: 0.75;
  text-align: center;
  white-space: normal;
}

.lc-submission-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lc-submission-empty {
  padding: 0.6rem 0.3rem;
  font-size: var(--text-sm);
  color: var(--shadowColor);
  font-style: italic;
  opacity: 0.8;
}

.lc-submission {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  padding: 0.6rem 0.3rem;
  border-bottom: 0.1rem solid var(--borderColor);
  font-size: var(--text-sm);
}

.lc-submission:last-child {
  border-bottom: none;
}

.lc-submission:hover {
  background-color: var(--contentColor);
}

.lc-submission-title {
  flex: 1 1 auto;
  min-width: 12rem;
  color: var(--linkColor);
  text-decoration: none;
  border-bottom: 0.1rem solid transparent;
  transition: all 0.2s ease;
}

.lc-submission-title:hover {
  color: var(--linkHover);
  border-bottom-color: var(--linkHover);
}

.lc-submission-status {
  font-family: var(--headings);
  font-size: var(--text-xs);
  padding: 0.15rem 0.5rem;
  border-radius: 0.2rem;
  color: var(--shadowColor);
  background-color: var(--contentColor);
}

.lc-submission-status.is-accepted {
  background-color: var(--linkColor);
  color: var(--backgroundColor);
}

.lc-submission-status.is-wronganswer {
  background-color: var(--errorColor);
  color: var(--errorTextColor);
}

.lc-submission-lang {
  color: var(--borderColor);
  opacity: 0.85;
}

.lc-submission-time {
  color: var(--borderColor);
  opacity: 0.7;
}

.page-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 5%;
  display: block;
}

.myspace-section {
  margin-bottom: 2rem;
}

.myspace-section--full {
  grid-column: 1 / -1;
}

.books-filter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.books-filter-menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  background-color: var(--backgroundColor);
  border: 0.15rem solid var(--borderColor);
  border-radius: 0.4rem;
  box-shadow: 0.2rem 0.2rem var(--shadowColor);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.books-filter-menu[hidden] {
  display: none;
}

.books-filter-menu button {
  background: none;
  border: 0.1rem solid var(--backgroundColor);
  padding: 0.5rem 0.75rem;
  font-size: var(--text-sm);
  font-family: var(--poppins);
  color: var(--shadowColor);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  border-radius: 0.25rem;
  transition: border-color 0.2s ease, background 0.2s ease;
  width: 100%;
}

.books-filter-menu button:hover {
  border-color: var(--borderColor);
}

.books-filter-menu button.active {
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
}

.books-filter-toggle {
  box-sizing: border-box;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  border: 0.2rem solid var(--borderColor);
  background-color: var(--contentColor);
  color: var(--borderColor);
  font-family: var(--headings);
  font-size: var(--text-sm);
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0.2rem 0.2rem var(--shadowColor);
  transition: all 0.2s ease;
}

.books-filter-toggle:hover {
  transform: translateY(-0.1rem) translateX(0.1rem);
  box-shadow: 0.3rem 0.3rem var(--shadowColor);
}

.books-grid {
  columns: 260px;
  column-gap: 1.25rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  animation: fadeIn ease 0.8s;
  animation-fill-mode: both;
  overflow: hidden;
  break-inside: avoid;
  margin-bottom: 1.25rem;
  padding: 0;
}

.book-card:hover {
  cursor: pointer;
}

.book-card:nth-child(1) { animation-delay: 0.05s; }
.book-card:nth-child(2) { animation-delay: 0.15s; }
.book-card:nth-child(3) { animation-delay: 0.25s; }

.book-banner-wrap {
  position: relative;
  width: 100%;
}

.book-banner-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: var(--bannerDim);
  z-index: 1;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.book-card:hover .book-banner-wrap::after {
  opacity: 0;
}

.book-banner {
  width: 100%;
  height: auto;
  display: block;
}

.book-category {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 2;
  font-size: var(--text-xs);
  background-color: var(--backgroundColor);
  color: var(--shadowColor);
  padding: 0.25rem 0.6rem;
  border-radius: 0.3rem;
  font-family: var(--poppins);
  border: 0.1rem solid var(--borderColor);
}

.book-card:hover .book-category {
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
}

.book-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2;
  height: 2rem;
  background-color: var(--backgroundColor);
  border-top: 0.1rem solid var(--borderColor);
}

.book-progress-bar {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--contentColor);
}

.book-progress-fill {
  height: 100%;
  background-color: var(--linkColor);
  transition: width 0.3s ease;
}

.book-progress-pct {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-base);
  font-family: var(--poppins);
  font-weight: bold;
  color: var(--borderColor);
  background-color: var(--backgroundColor);
  border: 0.1rem solid var(--borderColor);
  border-radius: 1rem;
  padding: 0 0.35rem;
  line-height: 1;
  white-space: nowrap;
}

.book-progress-meta {
  color: var(--borderColor);
  padding: 0.35rem 0.6rem;
  background-color: var(--backgroundColor);
  border-top: 0.1rem solid var(--borderColor);
  font-size: var(--text-xs);
  line-height: 1.3;
}

#book-view {
  display: block;
}

#book-back-btn,
#study-plan-back-btn {
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
  border: 0.2rem solid var(--borderColor);
  border-radius: 0.3rem;
  padding: 0.6rem 1.2rem;
  font-family: var(--theme-content-font);
  font-size: var(--text-base);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0.15rem 0.15rem var(--shadowColor);
  margin-bottom: 1.5rem;
}

#book-back-btn:hover,
#study-plan-back-btn:hover {
  transform: translateY(-0.1rem) translateX(0.1rem);
  box-shadow: 0.3rem 0.3rem var(--shadowColor);
  background-color: var(--backgroundColor);
  color: var(--borderColor);
}

.book-detail {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.book-detail-cover {
  width: 100%;
  position: sticky;
  top: 1rem;
}

#book-banner {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
  border: 0.2rem solid var(--borderColor);
  border-radius: 0.4rem;
  box-shadow: 0.3rem 0.3rem var(--shadowColor);
}

.book-detail-main {
  min-width: 0;
}

.book-detail-content {
  min-width: 0;
}

#book-title {
  font-family: var(--theme-heading-font);
  color: var(--shadowColor);
  font-size: var(--text-3xl);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
}

#book-author {
  color: var(--shadowColor);
  font-size: var(--text-base);
  margin: 0 0 0.4rem 0;
  font-family: var(--theme-content-font);
  opacity: 0.85;
}

#book-meta {
  color: var(--borderColor);
  font-size: var(--text-sm);
  margin: 0 0 1.2rem 0;
  font-family: var(--theme-content-font);
  opacity: 0.8;
}

#book-excerpt {
  font-size: var(--text-base);
  color: var(--borderColor);
  line-height: 1.6;
  margin: 0 0 1.5rem 0;
}

#book-excerpt p,
#book-thoughts p {
  margin: 0;
}

#book-thoughts {
  font-size: var(--text-base);
  color: var(--shadowColor);
  line-height: 1.7;
  margin: 1.5rem 0 0 0;
  padding-top: 1.5rem;
  border-top: 0.1rem solid var(--borderColor);
}

@media (max-width: 720px) {

  .stat-number {
    font-size: var(--text-3xl);
  }

  .page-container {
    padding: 0 3%;
  }

  .leetcode-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .project-banner-wrap {
    min-height: 10rem;
  }

  .project-banner-fallback {
    border-right: none;
    border-bottom: 0.15rem solid var(--borderColor);
  }


  .book-detail {
    grid-template-columns: 1fr;
  }

  .book-detail-cover {
    position: static;
    max-width: 220px;
  }

  .lc-submission-title {
    min-width: 100%;
  }
}

.study-summary {
  position: relative;
  margin-bottom: 1.5rem;
}

.study-title {
  font-family: var(--theme-heading-font);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--shadowColor);
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
  text-align: center;
}

.study-progress-track {
  position: relative;
  width: 100%;
  height: 1.5rem;
  background-color: var(--contentColor);
  border: 0.1rem solid var(--borderColor);
  border-radius: 0.3rem;
  overflow: hidden;
}

.study-progress-fill {
  height: 100%;
  background-color: var(--linkColor);
  transition: width 0.3s ease;
  border-radius: 0.2rem;
}

.study-progress-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-base);
  font-family: var(--theme-content-font);
  font-weight: bold;
  color: var(--borderColor);
  background-color: var(--backgroundColor);
  border: 0.1rem solid var(--borderColor);
  border-radius: 1rem;
  padding: 0 0.35rem;
  line-height: 1;
  white-space: nowrap;
}

.study-focus {
  margin-top: 0.8rem;
  font-size: var(--text-sm);
  color: var(--shadowColor);
  font-family: var(--theme-content-font);
  font-style: italic;
  text-align: center;
}

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

.study-plan-card {
  cursor: pointer;
  text-align: left;
  font-family: var(--theme-content-font);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.25rem;
}

.study-plan-card-title {
  font-family: var(--theme-heading-font);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--shadowColor);
  line-height: 1.3;
}

.study-plan-card-focus {
  font-size: var(--text-sm);
  color: var(--borderColor);
  opacity: 0.85;
  line-height: 1.4;
}

.study-plan-card-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
}

.study-plan-card-track {
  flex: 1;
  height: 0.7rem;
  background-color: var(--contentColor);
  border: 0.1rem solid var(--borderColor);
  border-radius: 0.2rem;
  overflow: hidden;
}

.study-plan-card-fill {
  height: 100%;
  background-color: var(--linkColor);
  border-radius: 0.15rem;
  transition: width 0.3s ease;
}

.study-plan-card-pct {
  font-family: var(--theme-heading-font);
  font-size: var(--text-sm);
  color: var(--shadowColor);
  white-space: nowrap;
}

.study-plan-card-meta {
  font-size: var(--text-xs);
  color: var(--borderColor);
  opacity: 0.8;
}

.word-tree {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5rem;
  padding: 0.5rem 0;
}

.word-tree::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(25% - 0.5rem);
  width: 0.1rem;
  background-color: var(--borderColor);
  opacity: 0.5;
}

.wt-branch {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  column-gap: 2rem;
  row-gap: 0.75rem;
  width: 100%;
  padding: 1rem;
}

.is-clickable {
  cursor: pointer;
  box-shadow: 0.2rem 0.2rem var(--shadowColor);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.is-clickable:hover {
  transform: translateY(-0.15rem);
  box-shadow: 0.3rem 0.3rem var(--shadowColor);
}

.is-static {
  cursor: default;
  box-shadow: none;
  transition: none;
}

.wt-root {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.15rem;
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
  border: 0.15rem solid var(--shadowColor);
  /* border-top: 0.4rem solid var(--linkColor); */
  border-radius: 0.35rem;
  padding: 0.55rem 0.9rem;
  font-family: var(--theme-heading-font);
  justify-self: center;
  flex: 0 0 auto;
  min-width: 30%;
  max-width: 100%;
}

.wt-root-num {
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
  opacity: 0.85;
  text-transform: uppercase;
}

.wt-root-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: inherit;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.wt-root-meta {
  font-size: var(--text-xs);
  font-family: var(--theme-content-font);
  color: var(--backgroundColor);
  opacity: 0.85;
  white-space: nowrap;
}

.wt-root.is-expandable {
  padding: 2rem 0.9rem 0.55rem;
  background-color: var(--contentColor);
  color: var(--shadowColor);
}

/* Distinct back control: a full-width inverted header strip pinned inside the
   top of the drill-down week node, so the click target and its behaviour
   (returning to the phase overview) are unmistakable. */
.wt-root.is-expandable .wt-back {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
  font-family: var(--theme-content-font);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: background-color 0.2s ease, color 0.2s ease;
  pointer-events: none;
}

.wt-root.is-expandable .wt-back::before {
  content: '\2190';
  font-size: var(--text-sm);
  line-height: 1;
}

.wt-root.is-expandable .wt-root-meta {
  color: var(--shadowColor);
}

.wt-root.is-expandable:hover {
  border-color: var(--borderColor);
}

.wt-root.is-expandable:hover .wt-back {
  background-color: var(--borderColor);
}

.wt-leaves {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  row-gap: 0.75rem;
  width: 100%;
}

.wt-leaf {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  background-color: var(--contentColor);
  color: var(--shadowColor);
  border: 0.15rem solid var(--shadowColor);
  border-top: 0.25rem solid var(--linkColor);
  border-radius: 0.35rem;
  padding: 0.3rem 0.7rem;
  font-family: var(--theme-heading-font);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  justify-self: start;
  max-width: 100%;
  box-sizing: border-box;
}

.wt-leaf:hover {
  background-color: var(--contentColor);
  color: var(--shadowColor);
  border-color: var(--borderColor);
  border-top-color: var(--linkColor);
}

.wt-leaf.is-complete {
  background-color: var(--contentColor);
  color: var(--borderColor);
  border-color: var(--linkColor);
  border-top-color: var(--linkColor);
}

.wt-leaf.is-complete:hover {
  background-color: var(--contentColor);
}

.wt-leaf.is-complete .wt-leaf-text,
.wt-leaf.is-complete .wt-leaf-kicker {
  text-decoration: line-through;
  text-decoration-color: var(--shadowColor);
  text-decoration-thickness: 0.2rem;
}

.wt-leaf.is-rest {
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
  border-color: var(--shadowColor);
  border-top-color: var(--shadowColor);
  opacity: 0.85;
}

.wt-leaf.is-rest:hover {
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
  border-color: var(--shadowColor);
  border-top-color: var(--shadowColor);
}

.wt-leaf.is-week {
  padding-right: 1.7rem;
}

.wt-leaf.is-week::after {
  content: '\203A';
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
  font-size: var(--text-xl);
  line-height: 1;
  color: inherit;
  opacity: 0.55;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.wt-leaf.is-week:hover::after {
  transform: translateY(-50%) rotate(90deg);
}

@keyframes wt-root-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes wt-leaf-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes wt-branch-out {
  to {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
}

.wt-branch.is-week-detail .wt-root.is-expandable {
  animation: wt-root-in 0.25s ease backwards;
}

.wt-branch.is-week-detail .wt-leaf {
  animation: wt-leaf-in 0.35s ease backwards;
  animation-delay: calc(var(--leaf-index) * 45ms);
}

.wt-branch.is-week-detail.is-collapsing {
  animation: wt-branch-out 0.15s ease forwards;
  pointer-events: none;
}

.wt-tree-reenter {
  animation: fadeIn 0.35s ease both;
}

.wt-leaf-kicker {
  font-size: var(--text-xs);
  font-family: var(--theme-heading-font);
  color: inherit;
  opacity: 0.85;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.wt-branch::before,
.wt-branch::after {
  content: '';
  position: absolute;
  z-index: 0;
  pointer-events: none;
  background-color: var(--borderColor);
  opacity: 0.6;
}

.wt-branch::before {
  left: 50%;
  top: 0;
  bottom: 0;
  width: 0.1rem;
}

.wt-branch::after {
  left: calc(25% - 0.5rem);
  right: 50%;
  top: 50%;
  height: 0.1rem;
}

.wt-leaf::before {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  transform: translateY(-50%);
  width: 1rem;
  height: 0.1rem;
  background-color: var(--borderColor);
  opacity: 0.6;
  pointer-events: none;
}

.study-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bannerDim);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.study-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.study-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(480px, 90vw);
  height: 100vh;
  max-height: 100vh;
  background-color: var(--backgroundColor);
  border-left: 0.2rem solid var(--borderColor);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.study-drawer.is-open {
  transform: translateX(0);
}

.study-drawer-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--shadowColor);
  color: var(--backgroundColor);
  border: none;
  border-radius: 0.3rem;
  font-size: var(--text-xl);
  box-shadow: none;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
  line-height: 1;
  font-family: var(--theme-content-font);
}


#study-drawer-body {
  padding: 2rem 1.5rem 3rem;
}

.drawer-breadcrumb {
  font-size: var(--text-sm);
  color: var(--borderColor);
  font-family: var(--theme-content-font);
  margin-bottom: 0.4rem;
  opacity: 0.7;
}

.drawer-title {
  font-family: var(--theme-heading-font);
  font-size: var(--text-2xl);
  color: var(--shadowColor);
  margin: 0 0 1rem 0;
  line-height: 1.3;
}

.drawer-mini-progress {
  margin: 1rem 0;
}

.drawer-mini-progress-track {
  width: 100%;
  height: 0.8rem;
  background-color: var(--contentColor);
  border: 0.1rem solid var(--borderColor);
  border-radius: 0.2rem;
  overflow: hidden;
}

.drawer-mini-progress-fill {
  height: 100%;
  background-color: var(--linkColor);
  transition: width 0.3s ease;
}

.drawer-mini-progress-label {
  font-size: var(--text-xs);
  color: var(--borderColor);
  font-family: var(--theme-content-font);
  margin-top: 0.2rem;
}

.drawer-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.drawer-checklist-item {
  padding: 0.5rem 0;
  border-bottom: 0.1rem solid var(--borderColor);
  font-size: var(--text-base);
  font-family: var(--theme-content-font);
  color: var(--shadowColor);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  line-height: var(--leading-relaxed);
}

.drawer-checklist-item:last-child {
  border-bottom: none;
}

.drawer-checklist-item.is-done {
  text-decoration: line-through;
  opacity: 0.5;
}

.drawer-checklist-item.is-done .check-mark {
  color: var(--linkColor);
}

.check-mark {
  flex: 0 0 1.2rem;
  font-family: var(--theme-content-font);
  font-size: var(--text-sm);
  opacity: 0.5;
}

.drawer-item-main {
  display: block;
}

.drawer-item-subs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.3rem;
}

.drawer-item-sub {
  font-size: var(--text-xs);
  font-family: var(--theme-content-font);
  color: var(--linkColor);
  text-decoration: underline;
  word-break: break-word;
}

.drawer-item-sub:hover {
  color: var(--borderColor);
}

@media (max-width: 720px) {
  .word-tree::before {
    left: 50%;
    transform: translateX(-50%);
  }

  .wt-branch {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    row-gap: 0.75rem;
  }

  .wt-leaves {
    grid-template-columns: minmax(0, 1fr);
    column-gap: 0;
    row-gap: 1.25rem;
  }

  .wt-branch::before {
    left: 50%;
    top: 0;
    bottom: 0;
  }

  .wt-branch::after {
    display: none;
  }

  .wt-leaf {
    justify-self: center;
  }

  .wt-leaf::before {
    right: auto;
    left: 0;
    width: 50%;
  }

  .study-drawer {
    width: 100vw;
    max-width: 100vw;
  }

  .study-plans-grid {
    grid-template-columns: 1fr;
  }

  #study-drawer-body {
    padding: 1.5rem 1rem 3rem;
  }

  .drawer-title {
    font-size: var(--text-xl);
  }
}

/* Touch-tap replacements for :hover. Hover is neutralized below so taps leave
   no sticky state; .tapped (toggled by shared.js) restores feedback while the
   finger is down, or persists for underline effects. */
@media (max-width: 720px) {
  .stat-card:hover,
  #commit-card:hover,
  #lc-submissions-card:hover {
    transform: none;
    box-shadow: none;
  }

  .stat-card.tapped,
  #commit-card.tapped,
  #lc-submissions-card.tapped {
    transform: none;
    box-shadow: none;
  }

  .commit-point:hover {
    fill: var(--backgroundColor);
  }

  .commit-point.tapped {
    fill: var(--linkColor);
  }

  .issue-point--open:hover,
  .issue-point--closed:hover {
    fill: var(--backgroundColor);
  }

  .issue-point--open.tapped {
    fill: var(--errorColor);
  }

  .issue-point--closed.tapped {
    fill: var(--infoColor);
  }

  .lc-bar:hover {
    opacity: 0.85;
  }

  .lc-bar.tapped {
    opacity: 1;
  }

  .lc-submission:hover {
    background-color: transparent;
  }

  .lc-submission.tapped {
    background-color: var(--contentColor);
  }

  .lc-submission-title:hover {
    color: var(--linkColor);
    border-bottom-color: transparent;
  }

  .lc-submission-title.tapped {
    color: var(--linkHover);
    border-bottom-color: var(--linkHover);
  }

  .book-card:hover .book-banner-wrap::after {
    opacity: 1;
  }

  .book-card.tapped .book-banner-wrap::after {
    opacity: 0;
  }

  .book-card:hover .book-category {
    background-color: var(--backgroundColor);
    color: var(--shadowColor);
  }

  .book-card.tapped .book-category {
    background-color: var(--shadowColor);
    color: var(--backgroundColor);
  }

  #book-back-btn:hover,
  #study-plan-back-btn:hover {
    transform: none;
    box-shadow: 0.15rem 0.15rem var(--shadowColor);
    background-color: var(--shadowColor);
    color: var(--backgroundColor);
  }

  #book-back-btn.tapped,
  #study-plan-back-btn.tapped {
    transform: translateY(-0.1rem) translateX(0.1rem);
    box-shadow: 0.3rem 0.3rem var(--shadowColor);
    background-color: var(--backgroundColor);
    color: var(--borderColor);
  }

  .is-clickable:hover {
    transform: none;
    box-shadow: 0.2rem 0.2rem var(--shadowColor);
  }

  .is-clickable.tapped {
    transform: translateY(-0.15rem);
    box-shadow: 0.3rem 0.3rem var(--shadowColor);
  }

  .wt-leaf:hover {
    background-color: var(--contentColor);
    color: var(--shadowColor);
    border-color: var(--shadowColor);
    border-top-color: var(--linkColor);
  }

  .wt-leaf.tapped {
    background-color: var(--contentColor);
    color: var(--shadowColor);
    border-color: var(--borderColor);
    border-top-color: var(--linkColor);
  }

  .wt-leaf.is-complete:hover {
    background-color: var(--contentColor);
  }

  .wt-leaf.is-complete.tapped {
    background-color: var(--contentColor);
  }

  .wt-root.is-expandable:hover {
    border-color: var(--shadowColor);
  }

  .wt-root.is-expandable:hover .wt-back {
    background-color: var(--shadowColor);
  }

  .wt-root.is-expandable.tapped {
    border-color: var(--borderColor);
  }

  .wt-root.is-expandable.tapped .wt-back {
    background-color: var(--borderColor);
  }

  .wt-leaf.is-week:hover::after {
    transform: translateY(-50%);
  }

  .wt-leaf.is-week.tapped::after {
    transform: translateY(-50%) rotate(90deg);
  }

  .drawer-item-sub:hover {
    color: var(--linkColor);
  }

  .drawer-item-sub.tapped {
    color: var(--borderColor);
  }
}
