:root {
  color-scheme: light;
  --page: #edf3f6;
  --surface: #ffffff;
  --ink: #10202a;
  --muted: #60717a;
  --line: #c7d5dc;
  --blue: #176f96;
  --blue-strong: #0f5677;
  --green: #16734a;
  --amber: #9a6113;
  --red: #a33a35;
  --radius: 6px;
  --content: 720px;
  font-family: "IBM Plex Sans", "Noto Sans JP", Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle, rgba(23, 111, 150, 0.24) 0 1px, transparent 1.15px),
    var(--page);
  background-size: 40px 40px;
  color: var(--ink);
  line-height: 1.55;
}

button,
summary {
  font: inherit;
}

a {
  color: inherit;
}

.site-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 8px max(20px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--line);
  background: rgba(237, 243, 246, 0.94);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.brand img {
  width: 32px;
  height: 40px;
  object-fit: contain;
}

.manual-link {
  color: var(--blue-strong);
  font-size: 0.86rem;
  font-weight: 750;
  text-underline-offset: 3px;
}

.writer-shell {
  width: min(var(--content), calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 36px;
}

.intro {
  margin-bottom: 24px;
}

.eyebrow,
.step-label {
  margin: 0;
  color: var(--blue-strong);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 7vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.intro > p:last-child {
  max-width: 600px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.writer {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.writer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 3px 0 0;
  font-size: 1.15rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.release-badge {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.7rem;
}

.profile-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 20px;
  padding: 1px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--line);
}

.profile-option {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border: 0;
  background: #f7fafb;
  color: var(--ink);
  cursor: pointer;
}

.profile-option:first-child {
  border-radius: 3px 0 0 3px;
}

.profile-option:last-child {
  border-radius: 0 3px 3px 0;
}

.profile-option:hover {
  background: #ffffff;
}

.profile-option.is-selected {
  background: var(--ink);
  color: #ffffff;
}

.profile-name {
  font-size: 1rem;
  font-weight: 850;
}

.profile-use {
  color: inherit;
  font-size: 0.73rem;
  opacity: 0.72;
}

.profile-summary {
  display: grid;
  gap: 2px;
  min-height: 62px;
  padding: 0 20px 17px;
}

.profile-summary strong {
  font-size: 0.94rem;
}

.profile-summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.preparation {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  border-block: 1px solid var(--line);
  background: #f7fafb;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
}

.status-indicator {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.preparation[data-state="loading"] .status-indicator {
  border-right-color: transparent;
  animation: spin 800ms linear infinite;
}

.preparation[data-state="ready"] {
  color: var(--green);
}

.preparation[data-state="error"],
.preparation[data-state="unsupported"] {
  color: var(--red);
}

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

.write-action {
  padding: 20px;
}

.install-action {
  margin-top: 8px;
  width: 100%;
  min-height: 54px;
  padding: 12px 18px;
  border: 0;
  border-radius: 5px;
  background: var(--blue);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.98rem;
  font-weight: 850;
}

.install-action:hover:not(:disabled) {
  background: var(--blue-strong);
}

.install-action:disabled {
  background: #91a1a9;
  cursor: wait;
}

.write-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  height: 0;
  overflow: hidden;
  color: var(--blue-strong);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0;
  transition: height 160ms ease, opacity 160ms ease;
}

.write-progress.is-visible {
  height: 32px;
  margin-top: 9px;
  opacity: 1;
}

.write-progress progress {
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 2px;
  overflow: hidden;
  background: #dbe5e9;
}

.write-progress progress::-webkit-progress-bar {
  background: #dbe5e9;
}

.write-progress progress::-webkit-progress-value {
  background: var(--blue);
}

.write-progress progress::-moz-progress-bar {
  background: var(--blue);
}

.write-scope {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1px 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #f7fafb;
  font-size: 0.76rem;
}

.write-scope > span:first-child {
  grid-row: 1 / 3;
  align-self: center;
  padding: 3px 6px;
  border: 1px solid var(--blue);
  border-radius: 3px;
  color: var(--blue-strong);
  font-family: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  font-weight: 800;
}

.write-scope > span:last-child {
  color: var(--muted);
}

.connection-help {
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
}

.connection-help h2 {
  margin: 0;
  padding: 11px 2px;
  color: var(--blue-strong);
  font-size: 0.84rem;
  font-weight: 750;
}

.connection-help p,
.footnote {
  color: var(--muted);
  font-size: 0.78rem;
}

.connection-help p {
  margin: 0 0 13px;
}

.footnote {
  margin: 13px 0 0;
}

footer {
  display: flex;
  width: min(var(--content), calc(100% - 32px));
  justify-content: space-between;
  margin: 0 auto;
  padding: 18px 0 30px;
  color: var(--muted);
  font-size: 0.76rem;
}

@media (max-width: 560px) {
  .writer-shell {
    padding-top: 28px;
  }

  .writer-heading {
    align-items: flex-start;
  }

  .profile-switch {
    grid-template-columns: 1fr;
  }

  .profile-option:first-child,
  .profile-option:last-child {
    border-radius: 3px;
  }

  .profile-option {
    min-height: 56px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .preparation[data-state="loading"] .status-indicator {
    animation: none;
    border-right-color: currentColor;
  }
}
