:root {
  color-scheme: light;
  --paper: #f7f2e7;
  --ink: #24302f;
  --muted: #66716d;
  --line: #d6cdbd;
  --panel: #fffaf0;
  --panel-strong: #ece1cd;
  --green: #137a63;
  --red: #9b2f2f;
  --blue: #315f8f;
  --shadow: 0 22px 50px rgba(37, 48, 47, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.dark {
  color-scheme: dark;
  --paper: #17201f;
  --ink: #f4ecd9;
  --muted: #b9c0ba;
  --line: #40504d;
  --panel: #202b29;
  --panel-strong: #2c3833;
  --green: #6bd5b9;
  --red: #ff9f9f;
  --blue: #9ec8f0;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(36, 48, 47, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(36, 48, 47, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  color: var(--ink);
}

button,
textarea,
code {
  font: inherit;
}

.site-header,
main,
.site-footer {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  padding: 56px 0 32px;
}

.eyebrow,
.stamp {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.35rem;
  line-height: 1.25;
}

.lead {
  max-width: 780px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.language-control {
  position: relative;
}

.language-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 4px;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.language-option {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.language-option.active {
  background: var(--green);
  color: var(--paper);
  font-weight: 800;
}

.flow {
  display: grid;
  gap: 34px;
  padding: 8px 0 36px;
}

.panel,
.doc-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
}

.panel {
  padding: 26px;
}

.step-panel {
  width: min(860px, 100%);
}

.step-panel + .step-panel {
  margin-top: 2px;
}

.step-panel:last-child {
  margin-bottom: 28px;
}

.steps {
  display: grid;
  gap: 16px;
  margin: 24px 0;
  padding: 0;
  list-style: none;
}

.steps li {
  border-left: 3px solid var(--green);
  padding-left: 14px;
  color: var(--muted);
  line-height: 1.65;
}

.steps strong {
  display: block;
  color: var(--ink);
}

.steps span {
  display: block;
  margin-top: 4px;
}

.session-link-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.session-link-row {
  margin-top: 16px;
}

.plain-copy {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.session-link-row code {
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-strong);
  color: var(--blue);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  text-align: center;
}

.button.primary {
  border-color: var(--green);
  background: var(--green);
  color: var(--paper);
  font-weight: 700;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.note {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.format-control {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.format-control > span {
  color: var(--muted);
  font-weight: 700;
}

.format-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.format-option {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.format-option.active {
  border-color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, var(--panel));
  color: var(--green);
  font-weight: 800;
}

label {
  display: block;
  margin: 22px 0 8px;
  color: var(--muted);
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 176px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: color-mix(in srgb, var(--paper) 82%, white);
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.6;
  word-break: break-word;
}

:root.dark textarea {
  background: #121917;
}

#resultOutput {
  min-height: 260px;
}

.status {
  display: block;
  min-height: 24px;
  margin-top: 10px;
  color: var(--green);
  font-size: 0.92rem;
}

.warnings {
  margin-top: 16px;
  border: 1px solid color-mix(in srgb, var(--red) 45%, var(--line));
  border-radius: 8px;
  padding: 12px;
  color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, transparent);
}

.warnings p {
  margin: 0;
  line-height: 1.6;
}

.warnings p + p {
  margin-top: 6px;
}

pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel-strong);
}

.path-list {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.path-list li {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-strong);
}

.path-list code {
  overflow-wrap: anywhere;
  color: var(--blue);
}

.site-footer {
  display: grid;
  grid-template-columns: minmax(160px, 0.7fr) 1fr;
  gap: 22px;
  align-items: start;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  padding: 28px 0 56px;
  color: var(--muted);
}

.footer-heading {
  display: grid;
  gap: 8px;
}

.footer-heading::after {
  content: "";
  width: 48px;
  height: 3px;
  border-radius: 999px;
  background: var(--green);
}

.footer-heading p {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(4, max-content);
  gap: 22px;
  justify-content: end;
}

.footer-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
  white-space: nowrap;
}

.footer-links a:hover {
  color: var(--green);
}

.footer-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  overflow: hidden;
}

.footer-links a:hover .footer-icon {
  color: var(--green);
}

.footer-icon img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100% - 32px));
  min-height: 48px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 14px;
  padding: 11px 14px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px) scale(0.98);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--green) 18%, transparent);
  color: var(--green);
}

.toast.error .toast-icon {
  background: color-mix(in srgb, var(--red) 18%, transparent);
  color: var(--red);
}

.toast-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@media (max-width: 860px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 28px, 720px);
  }

  .site-header {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 34px 0 28px;
  }

  .header-actions {
    justify-content: space-between;
  }

  .step-panel {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 24px, 480px);
  }

  .site-header {
    padding: 78px 0 22px;
  }

  .header-actions {
    position: absolute;
    top: 20px;
    right: 0;
    align-items: center;
    justify-content: flex-end;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .language-menu {
    right: 0;
    min-width: 128px;
  }

  .theme-toggle {
    flex: 0 0 auto;
  }

  h1 {
    font-size: 2rem;
    line-height: 1.12;
  }

  h2 {
    font-size: 1.2rem;
  }

  .lead {
    margin-top: 14px;
    font-size: 0.98rem;
    line-height: 1.7;
  }

  .flow {
    gap: 28px;
    padding-bottom: 24px;
  }

  .step-panel:last-child {
    margin-bottom: 24px;
  }

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

  .session-link-row,
  .action-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .button {
    width: 100%;
    min-height: 46px;
    padding: 11px 12px;
  }

  .format-options {
    display: grid;
    grid-template-columns: 1fr;
  }

  .format-option {
    min-height: 44px;
  }

  .session-link-row code {
    display: block;
    width: 100%;
    font-size: 0.82rem;
    line-height: 1.5;
  }

  label {
    margin-top: 18px;
  }

  textarea {
    min-height: 154px;
    padding: 12px;
    font-size: 0.86rem;
  }

  #resultOutput {
    min-height: 220px;
  }

  .path-list li {
    padding: 11px;
  }

  .toast {
    bottom: 18px;
    width: calc(100% - 28px);
    justify-content: flex-start;
  }

  .site-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 0 42px;
  }

  .footer-links {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    justify-content: start;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 1.72rem;
  }

  .panel {
    padding: 18px 14px;
  }

  .language-menu {
    min-width: 120px;
  }
}
