:root {
  color-scheme: light;
  --ink: #34302f;
  --muted: #837978;
  --line: #e6dfdc;
  --paper: #f8f4f2;
  --surface: #ffffff;
  --accent: #ad8174;
  --accent-deep: #7f5a50;
  --accent-soft: #eadbd5;
  --rose: #f5e9e5;
  --gold: #b89564;
  --mint: #879b86;
  --blue: #6f8296;
  --violet: #9b6f6f;
  --shadow: 0 24px 70px rgba(89, 70, 62, 0.13);
  font-family:
    "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f5f3f2;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-nav-wrap {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(92vw, 1220px);
  min-height: 66px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 999px;
  padding: 8px 18px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 18px 48px rgba(84, 63, 55, 0.18);
  backdrop-filter: blur(16px);
  transition:
    top 0.24s ease,
    left 0.24s ease,
    width 0.24s ease,
    min-height 0.24s ease,
    border-radius 0.24s ease,
    padding 0.24s ease,
    transform 0.24s ease,
    background 0.24s ease;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #2f2a29;
  font-size: clamp(0.86rem, 1.2vw, 1.03rem);
  font-weight: 900;
  letter-spacing: 0.02em;
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  border: 0;
  background: transparent;
  color: #2f2a29;
  padding: 0;
}

.nav-toggle-label {
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.logo-frame {
  display: block;
  width: 48px;
  height: 48px;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.46);
}

.logo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.site-nav-wrap nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
}

.site-nav-wrap a,
.site-nav-wrap button {
  color: rgba(47, 42, 41, 0.78);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.nav-cta {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  padding: 0 26px;
  color: #1f1c1b;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(173, 129, 116, 0.12);
}

.site-nav-wrap.is-docked {
  top: 50%;
  left: 18px;
  width: auto;
  min-height: auto;
  border-radius: 999px;
  padding: 8px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.76);
}

.site-nav-wrap.is-docked .site-logo {
  display: none;
}

.site-nav-wrap.is-docked .nav-toggle {
  display: inline-flex;
  min-height: auto;
  border-radius: 999px;
  background: transparent;
  padding: 0;
}

.site-nav-wrap.is-docked .logo-frame {
  width: 44px;
  height: 44px;
}

.site-nav-wrap.is-docked .nav-toggle-label,
.site-nav-wrap.is-docked nav {
  display: none;
}

.site-nav-wrap.is-docked.is-open {
  align-items: flex-start;
  border-radius: 28px;
  padding: 8px 10px 12px;
}

.site-nav-wrap.is-docked.is-open .nav-toggle {
  width: 100%;
}

.site-nav-wrap.is-docked.is-open .nav-toggle-label {
  display: inline;
}

.site-nav-wrap.is-docked.is-open nav {
  display: grid;
  gap: 6px;
  min-width: 142px;
  padding-top: 6px;
}

.site-nav-wrap.is-docked.is-open nav a {
  display: block;
  border-radius: 999px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.54);
}

.site-main {
  display: grid;
  gap: 28px;
  min-height: 100vh;
  padding: 0 0 36px;
}

.workspace,
.tag-panel,
.summary-panel,
.calendar-card,
.agenda,
.course-form {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(230, 223, 220, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 4.75rem);
  line-height: 1.04;
}

h2 {
  font-size: 1.05rem;
}

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

.tag-list {
  display: grid;
  gap: 14px;
}

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

.tag-group h3 {
  margin: 0;
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: auto;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--tag-color) 72%, white);
  border-radius: 999px;
  background: var(--tag-color);
  color: white;
  padding: 6px 11px;
  text-align: left;
  box-shadow: 0 10px 20px color-mix(in srgb, var(--tag-color) 22%, transparent);
  opacity: 0.58;
}

.tag-chip[aria-pressed="true"] {
  opacity: 1;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--tag-color) 34%, transparent);
}

.tag-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tag-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: white;
  opacity: 0.9;
}

.tag-count {
  display: grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 0.75rem;
}

.summary-panel {
  border-radius: 8px;
  padding: 16px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-grid div {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, #fff, var(--paper));
  padding: 14px;
}

.stat-grid span {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-grid small {
  color: var(--muted);
}

.workspace {
  min-width: 0;
  border-radius: 8px;
  margin: 0 clamp(18px, 4vw, 52px);
  padding: 22px;
}

.tag-panel {
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 15px 16px;
}

.hero-banner {
  position: relative;
  min-height: min(760px, 100vh);
  overflow: hidden;
  border-radius: 0;
  background: var(--paper);
}

.hero-banner img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 1;
}

.hero-banner::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.93) 0 30%, rgba(255, 255, 255, 0.58) 50%, rgba(255, 255, 255, 0.08) 100%),
    linear-gradient(0deg, rgba(84, 63, 55, 0.2), transparent 48%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: center;
  max-width: 760px;
  min-height: min(760px, 100vh);
  padding: 124px clamp(28px, 8vw, 110px) clamp(52px, 8vw, 96px);
}

.hero-copy h1 {
  max-width: 720px;
  font-weight: 800;
}

.hero-copy p:last-child {
  max-width: 22rem;
  margin: 18px 0 0;
  color: #625a58;
  font-size: 1rem;
  line-height: 1.9;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.toolbar h2 {
  font-size: clamp(1.55rem, 2.6vw, 2.2rem);
}

.toolbar-actions,
.dialog-actions,
.dialog-actions div {
  display: flex;
  align-items: center;
  gap: 9px;
}

.primary-button,
.secondary-button,
.text-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
}

.primary-button {
  background: var(--accent);
  color: white;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(173, 129, 116, 0.24);
}

.secondary-button,
.icon-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.text-button {
  min-height: auto;
  background: transparent;
  color: var(--accent-deep);
  padding: 4px 0;
}

.danger-button {
  border-color: #f0c4c1;
  background: #fff1f0;
  color: #a12620;
}

.icon-button {
  width: 38px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
  margin-top: 16px;
}

.calendar-card,
.agenda {
  border-radius: 8px;
  padding: 16px;
}

.calendar-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(250, 247, 245, 0.94));
}

.weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekdays {
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.calendar-grid {
  gap: 8px;
}

.day-cell {
  display: flex;
  min-height: 118px;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 9px;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.day-cell:hover {
  border-color: rgba(173, 129, 116, 0.58);
  box-shadow: 0 12px 26px rgba(81, 68, 61, 0.07);
  transform: translateY(-1px);
}

.day-cell.outside {
  opacity: 0.42;
}

.day-cell.today {
  border-color: var(--accent);
  background: #fffaf8;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.course-pill {
  display: block;
  border: 0;
  border-left: 4px solid var(--tag-color);
  border-radius: 6px;
  background: color-mix(in srgb, var(--tag-color) 15%, white);
  color: var(--ink);
  padding: 7px 8px;
  text-align: left;
  box-shadow: 0 8px 16px rgba(81, 68, 61, 0.05);
}

.course-pill strong {
  display: block;
  overflow: hidden;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-pill span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.agenda {
  position: sticky;
  top: 110px;
  max-height: calc(100vh - 134px);
  overflow: auto;
}

#agendaRange {
  color: var(--muted);
  font-size: 0.86rem;
}

.agenda-list {
  display: grid;
  gap: 10px;
}

.agenda-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--tag-color) 14%, white) 0 6px, transparent 6px),
    var(--surface);
  padding: 12px;
  box-shadow: 0 12px 24px rgba(81, 68, 61, 0.05);
}

.agenda-open {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.agenda-date {
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 800;
}

.agenda-title {
  margin: 5px 0;
  font-weight: 800;
}

.agenda-meta {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.agenda-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid color-mix(in srgb, var(--tag-color) 40%, var(--line));
  border-radius: 999px;
  margin-top: 9px;
  padding: 0 12px;
  background: color-mix(in srgb, var(--tag-color) 12%, white);
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
}

.detail-dialog {
  width: min(980px, calc(100vw - 28px));
  border: 0;
  background: transparent;
  padding: 0;
}

.detail-dialog::backdrop {
  background: rgba(37, 31, 29, 0.42);
  backdrop-filter: blur(6px);
}

.detail-book {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: white;
  box-shadow: 0 30px 90px rgba(41, 32, 28, 0.34);
  opacity: 0;
  transform: perspective(1200px) rotateY(-12deg) translateY(18px);
  transform-origin: left center;
  transition:
    opacity 0.32s ease,
    transform 0.46s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.detail-book.is-open {
  opacity: 1;
  transform: perspective(1200px) rotateY(0deg) translateY(0);
}

.detail-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1;
}

.detail-dm {
  display: grid;
  min-height: 560px;
  align-content: end;
  gap: 18px;
  padding: clamp(28px, 5vw, 52px);
  background:
    linear-gradient(180deg, transparent 0 22%, rgba(0, 0, 0, 0.28) 100%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.22), transparent 36%),
    var(--tag-color);
  color: white;
}

.detail-dm h2 {
  max-width: 16rem;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.08;
}

.dm-image {
  width: min(100%, 340px);
  max-height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 18px 42px rgba(39, 33, 31, 0.24);
}

.detail-dm p {
  max-width: 19rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.8;
}

.dm-label,
.dm-footer span {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 900;
}

.dm-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-info {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: clamp(28px, 5vw, 54px);
}

.detail-info h2 {
  max-width: 30rem;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.18;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.detail-list dd {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.detail-note {
  margin: 0;
  color: var(--muted);
}

.detail-link {
  display: inline-grid;
  width: fit-content;
  min-height: 44px;
  place-items: center;
  border-radius: 999px;
  background: var(--tag-color);
  color: white;
  padding: 0 22px;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--tag-color) 28%, transparent);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.course-dialog {
  width: min(560px, calc(100vw - 28px));
  border: 0;
  background: transparent;
  padding: 0;
}

.course-dialog::backdrop {
  background: rgba(39, 33, 31, 0.38);
  backdrop-filter: blur(4px);
}

.course-form {
  display: grid;
  gap: 14px;
  border-radius: 8px;
  padding: 20px;
}

.course-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.course-form input,
.course-form select,
.course-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dialog-actions {
  justify-content: space-between;
  margin-top: 4px;
}

@media (max-width: 1120px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .agenda {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .site-nav-wrap {
    top: 10px;
    width: calc(100vw - 20px);
    min-height: auto;
    align-items: stretch;
    border-radius: 24px;
    padding: 10px;
    flex-direction: column;
    gap: 10px;
  }

  .site-nav-wrap.is-docked {
    top: 50%;
    left: 10px;
    width: auto;
    align-items: flex-start;
    border-radius: 999px;
    padding: 7px;
    transform: translateY(-50%);
  }

  .site-nav-wrap.is-docked.is-open {
    border-radius: 24px;
    padding: 8px;
  }

  .site-logo {
    justify-content: center;
    font-size: 0.88rem;
  }

  .site-nav-wrap nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .site-nav-wrap a,
  .site-nav-wrap button {
    display: grid;
    min-height: 34px;
    place-items: center;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.32);
    font-size: 0.78rem;
    padding: 0 6px;
    text-align: center;
  }

  .nav-cta {
    grid-column: 1 / -1;
    min-height: 38px;
  }

  .site-main {
    padding: 0 0 12px;
  }

  .hero-banner,
  .hero-copy {
    min-height: 560px;
  }

  .hero-banner::after {
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.4) 42%, rgba(255, 255, 255, 0.82)),
      linear-gradient(90deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.34));
  }

  .hero-copy {
    padding: 190px 24px 48px;
  }

  .workspace {
    margin: 0 12px;
  }

  .toolbar,
  .toolbar-actions,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 38px 1fr 38px;
  }

  .calendar-card {
    overflow-x: auto;
  }

  .weekdays,
  .calendar-grid {
    min-width: 680px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .detail-book {
    grid-template-columns: 1fr;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }

  .detail-dm {
    min-height: 360px;
  }

  .detail-list div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
