:root {
  --bg-top: #f6efe4;
  --bg-bottom: #dbe7f7;
  --ink: #1c2333;
  --ink-soft: #485a78;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(222, 231, 244, 0.95);
  --accent: #2b5ca8;
  --accent-soft: #9db8dd;
  --star-base: #d9dbe3;
  --star-fill: #f3b340;
  --shadow: rgba(74, 95, 127, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 15%, rgba(255, 255, 255, 0.75) 0 18%, transparent 18%),
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.55) 0 12%, transparent 12%),
    linear-gradient(165deg, var(--bg-top), var(--bg-bottom));
}

.hidden {
  display: none !important;
}

.page {
  position: relative;
  margin: 0 auto;
}

.home-page {
  width: min(1040px, 92vw);
  padding: 56px 0 72px;
}

.detail-page {
  width: min(1560px, 96vw);
  padding: 24px 0;
  height: 100vh;
}

.account-menu {
  position: absolute;
  right: clamp(12px, 2vw, 24px);
  top: clamp(10px, 1.8vw, 20px);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.account-toggle {
  border: none;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(61, 79, 109, 0.18);
  color: #243650;
}

.account-icon {
  width: 24px;
  height: 24px;
}

.account-dropdown {
  margin-top: 8px;
  min-width: 170px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 14px 26px rgba(51, 70, 106, 0.14);
  padding: 6px;
}

.dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  display: block;
  text-align: left;
  text-decoration: none;
  color: #283854;
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.dropdown-item:hover {
  background: #eef4ff;
}

.account-language-switch {
  display: flex;
  gap: 8px;
  padding: 6px 8px 8px;
}

.language-button {
  border: 1px solid #d9e2f0;
  background: #fff;
  color: #30415e;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: lowercase;
}

.language-button.active {
  background: #eaf2ff;
  border-color: #9db8dd;
  color: #25497e;
}

.logout-item {
  color: #be2333;
}

.hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.home-hero {
  align-items: center;
  text-align: center;
}

.detail-hero {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.18em;
  font-size: 0.75rem;
  color: #30496a;
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  padding-bottom: 10px;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.home-hero h1 {
  font-size: clamp(2.7rem, 5.4vw, 4.8rem);
}

.detail-hero h1 {
  font-size: clamp(2.2rem, 3.8vw, 4rem);
}

.hero-code {
  margin: 0;
  color: #4b5c79;
  font-size: 1.08rem;
  font-weight: 700;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-hero .hero-meta {
  justify-content: center;
}

.detail-hero .hero-meta {
  justify-content: center;
}

.hero-meta-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(157, 184, 221, 0.72);
  background: rgba(240, 246, 255, 0.92);
  border-radius: 999px;
  padding: 8px 14px;
  color: #2f4b76;
  font-size: 0.92rem;
  font-weight: 600;
}

.home-search-wrap {
  width: min(680px, 92vw);
  margin-top: 10px;
}

.search-wrap {
  position: relative;
}

.search-input-row {
  position: relative;
}

.filter-toggle {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #1f2a3e;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 10px;
  transition: background-color 0.16s ease;
}

.filter-toggle.is-active {
  background: rgba(223, 234, 251, 0.95);
}

.filter-icon {
  width: 21px;
  height: 21px;
}

.filter-badge {
  position: absolute;
  right: -3px;
  bottom: -2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #2f5ca5;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#module-search {
  width: 100%;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 16px 52px 16px 52px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 35px rgba(123, 142, 166, 0.12);
  transition: border-color 0.2s ease;
}

#module-search:focus {
  outline: none;
  border-color: var(--accent-soft);
}

.search-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #334158;
  width: 38px;
  height: 38px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1;
  opacity: 0.8;
}

.search-close:hover {
  opacity: 1;
}

.filter-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 10px);
  width: min(290px, 84vw);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 28px rgba(63, 77, 98, 0.15);
  padding: 12px;
  z-index: 15;
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.filter-title {
  margin: 0;
  font-size: 0.85rem;
  color: #4a5874;
  font-weight: 600;
}

.clear-all-filters {
  border: none;
  background: transparent;
  color: #5a6b89;
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.filter-options {
  display: grid;
  gap: 7px;
}

.filter-groups {
  display: grid;
  gap: 10px;
}

.filter-group {
  display: grid;
  gap: 8px;
}

.filter-group-header {
  border: none;
  background: transparent;
  color: #324566;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 2px 2px 0;
  cursor: pointer;
  text-align: left;
}

.filter-group-triangle {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid #5b6f92;
  transition: transform 0.18s ease;
  transform-origin: 35% 50%;
}

.filter-group-header[aria-expanded="true"] .filter-group-triangle {
  transform: rotate(90deg);
}

.filter-option {
  border: 1px solid #e7ecf5;
  border-radius: 10px;
  background: #f7f9fd;
  text-align: left;
  padding: 8px 10px;
  color: #2f3f60;
  cursor: pointer;
}

.filter-option.active {
  border-color: #9db8dd;
  background: #e9f1ff;
  color: #25497e;
}

.active-filters {
  margin-top: 10px;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: #e6ecf7;
  color: #33435f;
  opacity: 0.72;
  padding: 6px 10px 6px 12px;
  font-size: 0.88rem;
}

.filter-chip button {
  border: none;
  background: transparent;
  color: #2f3f5f;
  cursor: pointer;
  font-size: 0.95rem;
  opacity: 0.85;
  padding: 0 2px;
}

.module-list-section {
  margin-top: 34px;
}

.home-list-section {
  width: min(100%, 940px);
  margin-left: auto;
  margin-right: auto;
}

.module-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.module-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 18px;
  box-shadow: 0 10px 20px rgba(74, 95, 127, 0.08);
  padding: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.module-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(74, 95, 127, 0.12);
}

.module-card.is-selected {
  border-color: rgba(43, 92, 168, 0.3);
  box-shadow: 0 18px 28px rgba(43, 92, 168, 0.12);
}

.module-card-button {
  width: 100%;
  border: none;
  background: transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
}

.module-card-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.module-card-name {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-card-rating {
  font-size: 0.95rem;
  color: #41536f;
}

.module-card-stars {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 108px;
}

.compact-stars {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.12rem;
}

.compact-stars-track {
  position: relative;
  display: inline-block;
  line-height: 1;
}

.compact-stars-back {
  color: var(--star-base);
}

.compact-stars-front {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--star-fill);
  white-space: nowrap;
  overflow: hidden;
}

.compact-stars-value {
  font-size: 0.88rem;
  color: #44506d;
}

.detail-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  height: calc(100vh - 48px);
}

.browse-panel,
.detail-stage,
.module-panel {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: 0 16px 34px var(--shadow);
}

.browse-panel,
.detail-stage {
  border-radius: 24px;
  min-height: 0;
  overflow: hidden;
}

.browse-scroll {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 18px 18px;
}

.browse-header {
  display: grid;
  gap: 4px;
}

.browse-eyebrow {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #607498;
  font-weight: 700;
}

.browse-title {
  margin: 0;
  font-size: 1.42rem;
  letter-spacing: -0.03em;
}

.detail-search-wrap {
  flex: 0 0 auto;
}

.detail-list-section {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.detail-stage {
  min-width: 0;
}

.detail-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 28px 30px 34px;
}

.detail-hero-top {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: start;
  gap: 12px;
}

.detail-hero-copy {
  text-align: center;
}

.detail-hero-spacer {
  width: 44px;
  height: 44px;
}

.back-button {
  border: none;
  background: transparent;
  color: #1f2123;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chevron-icon {
  width: 28px;
  height: 28px;
  display: block;
}

.chevron-left {
  transform: rotate(180deg);
}

.module-panel {
  border-radius: 24px;
  padding: 28px 26px;
}

.empty-panel {
  width: min(100%, 980px);
  margin: 0 auto;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 10px;
}

.empty-panel h2 {
  margin: 0;
  font-size: clamp(1.7rem, 2.1vw, 2.2rem);
}

.empty-panel p {
  margin: 0;
  max-width: 56ch;
  color: var(--ink-soft);
  line-height: 1.6;
}

.module-view {
  display: grid;
  gap: 20px;
  width: min(100%, 1120px);
  margin: 0 auto;
}

.module-top {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1fr);
  gap: 20px;
  padding-top: 20px;
}

.overall {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.section-label {
  margin: 0;
  color: #3c5177;
  font-size: 0.95rem;
  font-weight: 600;
}

.categories {
  width: min(100%, 360px);
  margin: 24px auto 0;
  display: grid;
  gap: 16px;
}

.category-block {
  text-align: left;
}

.category-name {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 1.02rem;
}

.star-line {
  position: relative;
  display: inline-block;
  line-height: 1;
  font-size: 1.25rem;
}

.stars-back {
  color: var(--star-base);
}

.stars-front {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--star-fill);
  white-space: nowrap;
  overflow: hidden;
}

.star-value {
  margin-left: 10px;
  font-size: 0.95rem;
  color: #44506d;
}

.review-action-button {
  margin: 28px auto 0;
  border: none;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
  color: #2f4976;
  cursor: pointer;
  font-size: 1rem;
  display: block;
}

.right-panel h3,
.comments-panel h3 {
  margin: 0 0 14px;
  font-size: 1.1rem;
}

.materials-list,
.comments-list {
  margin: 0;
  padding-left: 18px;
  color: #3e4d6a;
  display: grid;
  gap: 10px;
}

.review-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 45, 69, 0.2);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.review-modal-overlay.hidden {
  display: none;
}

.review-modal {
  width: min(540px, 92vw);
  background: rgba(255, 255, 255, 0.98);
  border-radius: 14px;
  border: 1px solid #dde6f6;
  box-shadow: 0 16px 30px rgba(49, 65, 95, 0.17);
  padding: 20px 18px;
}

.review-modal h3 {
  margin: 0 0 14px;
}

.review-field {
  margin-bottom: 12px;
}

.review-field label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.rating-select {
  display: inline-flex;
  gap: 2px;
}

.rating-select button {
  border: none;
  background: transparent;
  font-size: 1.45rem;
  color: #d7dbe4;
  cursor: pointer;
  padding: 0;
}

.rating-select button.active {
  color: var(--star-fill);
}

#review-comment {
  width: 100%;
  border: 1px solid #d7dfec;
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
}

.review-word-counter,
.review-overall-preview {
  margin: 6px 0 0;
  color: #516180;
  font-size: 0.9rem;
}

.review-error {
  margin: 6px 0 4px;
  color: #b81f2a;
  font-weight: 600;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.review-cancel,
.review-submit {
  border: 1px solid #ced8ea;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
}

.review-submit {
  background: #2b5ca8;
  color: #fff;
  border-color: #2b5ca8;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .detail-shell {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .detail-scroll {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (max-width: 960px) {
  .home-page {
    width: min(100%, 94vw);
  }

  .detail-page {
    width: min(100%, 94vw);
    height: auto;
    min-height: 100vh;
    padding-top: 72px;
    padding-bottom: 40px;
  }

  .detail-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .browse-panel,
  .detail-stage {
    overflow: visible;
  }

  .browse-scroll,
  .detail-scroll {
    height: auto;
    overflow: visible;
  }

  .detail-list-section {
    overflow: visible;
    padding-right: 0;
  }

  .module-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .home-page,
  .detail-page {
    width: min(100%, 95vw);
  }

  .home-page {
    padding-top: 72px;
  }

  .account-menu {
    right: 10px;
    top: 12px;
  }

  .module-panel,
  .browse-panel,
  .detail-stage {
    border-radius: 20px;
  }

  .module-panel {
    padding: 22px 18px;
  }

  .browse-scroll {
    padding: 18px 14px 14px;
  }

  .detail-scroll {
    padding: 22px 18px 24px;
  }

  .hero-meta-chip {
    font-size: 0.84rem;
    padding: 7px 12px;
  }

  .detail-hero-top {
    grid-template-columns: 40px minmax(0, 1fr) 40px;
    gap: 8px;
  }

  .module-card-button {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .module-card-stars {
    justify-content: flex-start;
    min-width: 0;
  }

  .compact-stars {
    font-size: 1rem;
  }

  .filter-panel {
    width: min(100%, 320px);
  }
}
