/* Practice step guide
 * Loaded after each exercise stylesheet. The guide always uses a light palette,
 * even when the surrounding course page has dark mode enabled.
 */
.pc-stage-nav,
.pc-stage-pager {
  --surface: #fffdf7;
  --surface-strong: #ffffff;
  --text: #17201d;
  --muted: #53615b;
  --line: #c8d3cd;
  --accent: #0b7655;
  --accent-strong: #07533d;
  --highlight: #f5c851;
  --shadow: 0 9px 26px rgb(23 32 29 / 9%);
  color-scheme: light;
}

.pc-guide-summary,
.pc-guide-summary *,
.pc-guide-dialog,
.pc-guide-dialog * {
  box-sizing: border-box;
}

.pc-guide-summary,
.pc-guide-dialog {
  --pc-guide-bg: #fffdf7;
  --pc-guide-surface: #ffffff;
  --pc-guide-surface-soft: #f1f7f3;
  --pc-guide-text: #17201d;
  --pc-guide-muted: #53615b;
  --pc-guide-line: #c8d3cd;
  --pc-guide-accent: #0b7655;
  --pc-guide-accent-strong: #07533d;
  --pc-guide-focus: #f5c851;
  color-scheme: light;
  color: var(--pc-guide-text);
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
}

.pc-guide-summary {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(1180px, calc(100% - 32px));
  min-height: 82px;
  align-items: center;
  margin: 0 auto 20px;
  padding: 13px 14px;
  border: 1px solid var(--pc-guide-line);
  border-left: 5px solid var(--pc-guide-accent);
  border-radius: 15px;
  background: var(--pc-guide-bg);
  box-shadow: 0 9px 26px rgb(23 32 29 / 9%);
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  isolation: isolate;
}

.pc-guide-summary__meta {
  display: grid;
  align-content: center;
  gap: 5px;
}

.pc-guide-summary__stage,
.pc-guide-summary__task {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
}

.pc-guide-summary__stage {
  background: var(--pc-guide-accent);
  color: #ffffff;
}

.pc-guide-summary__task {
  border: 1px solid #b9cec3;
  background: var(--pc-guide-surface-soft);
  color: var(--pc-guide-accent-strong);
}

.pc-guide-summary__copy {
  min-width: 0;
}

.pc-guide-summary .pc-guide-summary__title {
  overflow: hidden;
  margin: 0;
  color: var(--pc-guide-text);
  font-size: 1rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-guide-summary .pc-guide-summary__result {
  display: -webkit-box;
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--pc-guide-muted);
  font-size: 0.86rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pc-guide-summary__result strong {
  color: var(--pc-guide-accent-strong);
}

.pc-guide-summary .pc-guide-summary__button,
.pc-guide-dialog .pc-guide-dialog__close {
  min-height: 44px;
  margin: 0;
  border: 1px solid var(--pc-guide-accent);
  border-radius: 10px;
  background: var(--pc-guide-accent);
  color: #ffffff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
}

.pc-guide-summary .pc-guide-summary__button {
  padding: 10px 15px;
  white-space: nowrap;
}

.pc-guide-summary .pc-guide-summary__button:hover,
.pc-guide-dialog .pc-guide-dialog__close:hover {
  border-color: var(--pc-guide-accent-strong);
  background: var(--pc-guide-accent-strong);
}

.pc-guide-summary .pc-guide-summary__button:focus-visible,
.pc-guide-dialog .pc-guide-dialog__close:focus-visible,
.pc-guide-dialog summary:focus-visible {
  outline: 3px solid var(--pc-guide-focus);
  outline-offset: 3px;
}

html.pc-guide-is-open {
  overflow: hidden;
}

.pc-guide-dialog {
  position: fixed;
  inset: 0;
  width: min(1120px, calc(100% - 32px));
  max-width: none;
  height: min(82dvh, 900px);
  max-height: none;
  overflow: hidden;
  margin: auto;
  padding: 0;
  border: 1px solid var(--pc-guide-line);
  border-radius: 20px;
  background: var(--pc-guide-bg);
  color: var(--pc-guide-text);
  box-shadow: 0 28px 80px rgb(35 49 43 / 22%);
}

.pc-guide-dialog:not([open]) {
  display: none;
}

.pc-guide-dialog::backdrop {
  background: rgb(91 105 98 / 24%);
  backdrop-filter: blur(3px);
}

.pc-guide-dialog .pc-guide-dialog__shell {
  display: grid;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--pc-guide-bg);
  grid-template-rows: auto minmax(0, 1fr);
}

.pc-guide-dialog .pc-guide-dialog__toolbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--pc-guide-line);
  background: var(--pc-guide-surface-soft);
}

.pc-guide-dialog .pc-guide-dialog__close {
  padding: 9px 14px;
}

.pc-guide-dialog .pc-guide-dialog__scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.pc-guide-dialog .pc-stage-brief__header {
  display: block;
  margin: 0;
  padding: 26px 28px;
  border: 0;
  border-bottom: 1px solid var(--pc-guide-line);
  border-radius: 0;
  background: var(--pc-guide-bg);
  color: var(--pc-guide-text);
  box-shadow: none;
}

.pc-guide-dialog .pc-stage-brief__eyebrow,
.pc-guide-dialog .pc-stage-brief__lead,
.pc-guide-dialog .pc-stage-task__files,
.pc-guide-dialog .pc-stage-task__result,
.pc-guide-dialog .pc-stage-brief__hint,
.pc-guide-dialog .pc-stage-observe__step p {
  margin: 0;
}

.pc-guide-dialog .pc-stage-brief__eyebrow {
  color: var(--pc-guide-accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.pc-guide-dialog .pc-stage-brief__title {
  margin: 0;
  color: var(--pc-guide-text);
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  line-height: 1.25;
  text-wrap: balance;
}

.pc-guide-dialog .pc-stage-brief__lead {
  max-width: 76ch;
  margin-top: 10px;
  color: var(--pc-guide-muted);
}

.pc-guide-dialog .pc-stage-brief__section {
  display: block;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 26px 28px;
  border: 0;
  border-bottom: 1px solid var(--pc-guide-line);
  border-radius: 0;
  background: transparent;
  color: var(--pc-guide-text);
  box-shadow: none;
}

.pc-guide-dialog .pc-stage-brief__section:last-child {
  border-bottom: 0;
}

.pc-guide-dialog .pc-stage-brief__section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
}

.pc-guide-dialog .pc-stage-brief__section-head > span {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 10px;
  background: var(--pc-guide-accent);
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  font-weight: 900;
}

.pc-guide-dialog .pc-stage-brief__section-head h2 {
  margin: 0;
  color: var(--pc-guide-text);
  font-size: 1.18rem;
  line-height: 1.35;
}

.pc-guide-dialog .pc-stage-task-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.pc-guide-dialog .pc-stage-task {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 17px;
  border: 1px solid var(--pc-guide-line);
  border-radius: 14px;
  background: var(--pc-guide-surface);
  color: var(--pc-guide-text);
  box-shadow: none;
}

.pc-guide-dialog .pc-stage-task[data-state="current"] {
  border-color: var(--pc-guide-accent);
  background: var(--pc-guide-surface-soft);
  box-shadow: inset 0 0 0 2px rgb(11 118 85 / 18%);
}

.pc-guide-dialog .pc-stage-task[data-state="done"] {
  border-color: #9fc4b4;
}

.pc-guide-dialog .pc-stage-task__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 12px;
}

.pc-guide-dialog .pc-stage-task__id,
.pc-guide-dialog .pc-stage-task__state {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 900;
  line-height: 1.2;
}

.pc-guide-dialog .pc-stage-task__id {
  background: var(--pc-guide-accent);
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.pc-guide-dialog .pc-stage-task__state {
  background: var(--pc-guide-surface-soft);
  color: var(--pc-guide-accent-strong);
}

.pc-guide-dialog .pc-stage-task__title {
  margin: 0 0 12px;
  color: var(--pc-guide-text);
  font-size: 1rem;
  line-height: 1.45;
}

.pc-guide-dialog .pc-stage-task__files,
.pc-guide-dialog .pc-stage-task__result {
  color: var(--pc-guide-muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.pc-guide-dialog .pc-stage-task__result {
  margin-top: 8px;
}

.pc-guide-dialog .pc-stage-brief__hint {
  margin: -6px 0 14px;
  color: var(--pc-guide-muted);
  font-size: 0.9rem;
}

.pc-guide-dialog .pc-stage-change-list {
  display: grid;
  gap: 12px;
}

.pc-guide-dialog .pc-stage-change {
  display: block;
  margin: 0;
  padding: 0;
  border: 1px solid var(--pc-guide-line);
  border-radius: 14px;
  background: var(--pc-guide-surface);
  color: var(--pc-guide-text);
}

.pc-guide-dialog .pc-stage-change[open] {
  border-color: #7daf99;
}

.pc-guide-dialog .pc-stage-change__summary {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  color: var(--pc-guide-text);
  font-weight: 800;
  cursor: pointer;
  list-style-position: inside;
}

.pc-guide-dialog .pc-stage-change__language {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 900;
}

.pc-guide-dialog .pc-stage-change__status {
  color: var(--pc-guide-accent-strong);
  font-size: 0.82rem;
}

.pc-guide-dialog .pc-stage-change__file {
  margin: 0;
  padding: 0 16px 10px;
  color: var(--pc-guide-muted);
  font-size: 0.84rem;
}

.pc-guide-dialog .pc-stage-change__file code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #edf2ef;
  color: var(--pc-guide-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pc-guide-dialog .pc-stage-change__diff {
  display: grid;
  padding: 0 16px 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pc-guide-dialog .pc-stage-change__side {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pc-guide-dialog .pc-stage-change__side h4 {
  margin: 0 0 7px;
  color: var(--pc-guide-muted);
  font-size: 0.82rem;
}

.pc-guide-dialog .pc-stage-change__side pre {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 24rem;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--pc-guide-line);
  border-radius: 10px;
  background: #f3f5f4;
  color: var(--pc-guide-text);
  font: 0.78rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: left;
  white-space: pre;
  tab-size: 2;
  overscroll-behavior-inline: contain;
}

.pc-guide-dialog .pc-stage-change__side code {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  white-space: inherit;
}

.pc-guide-dialog .pc-stage-observe {
  display: grid;
  margin: 0;
  padding: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  list-style: none;
}

.pc-guide-dialog .pc-stage-observe__step {
  display: block;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--pc-guide-line);
  border-radius: 12px;
  background: var(--pc-guide-surface);
  color: var(--pc-guide-text);
}

.pc-guide-dialog .pc-stage-observe__step > span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e3f1ea;
  color: var(--pc-guide-accent-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

.pc-guide-dialog .pc-stage-observe__step p {
  color: var(--pc-guide-muted);
  font-size: 0.9rem;
}

@media (max-width: 820px) {
  .pc-guide-dialog .pc-stage-task-grid,
  .pc-guide-dialog .pc-stage-observe {
    grid-template-columns: 1fr;
  }

  .pc-guide-dialog .pc-stage-change__diff {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .pc-guide-summary {
    width: calc(100% - 20px);
    min-height: 0;
    margin-bottom: 14px;
    padding: 11px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .pc-guide-summary__meta {
    align-self: start;
  }

  .pc-guide-summary .pc-guide-summary__title {
    white-space: normal;
  }

  .pc-guide-summary .pc-guide-summary__button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .pc-guide-dialog {
    inset: auto 0 0;
    width: 100%;
    height: min(92dvh, 920px);
    max-height: 92dvh;
    margin: 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 20px 20px 0 0;
  }

  .pc-guide-dialog .pc-guide-dialog__toolbar {
    min-height: 58px;
    padding: 8px 12px 8px 16px;
  }

  .pc-guide-dialog .pc-stage-brief__header,
  .pc-guide-dialog .pc-stage-brief__section {
    padding: 20px 16px;
  }

  .pc-guide-dialog .pc-stage-task__head,
  .pc-guide-dialog .pc-stage-change__summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .pc-guide-dialog .pc-stage-change__diff {
    padding-right: 10px;
    padding-left: 10px;
  }
}
