:root {
  color-scheme: dark;
  --page: #07080a;
  --surface: #111215;
  --surface-2: #17181c;
  --surface-3: #202126;
  --text: #f6f7f8;
  --muted: #a5a8ae;
  --soft: #787c84;
  --border: #30333a;
  --border-strong: #555a64;
  --accent: #f4f5f6;
  --accent-text: #0a0b0d;
  --shadow: 0 22px 58px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --content: 1580px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --surface-3: #e8eaee;
  --text: #111215;
  --muted: #5d626b;
  --soft: #7d838d;
  --border: #d8dbe1;
  --border-strong: #aeb4bf;
  --accent: #111215;
  --accent-text: #ffffff;
  --shadow: 0 18px 40px rgba(17, 18, 21, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 420px),
    linear-gradient(180deg, var(--surface) 0, var(--page) 260px, var(--page) 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  line-height: 1.65;
  letter-spacing: 0;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.46);
  outline-offset: 3px;
}

:root[data-theme="light"] :focus-visible {
  outline-color: rgba(0, 0, 0, 0.42);
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-160%);
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 0 max(28px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid var(--border);
  background: rgba(7, 8, 10, 0.86);
  backdrop-filter: blur(16px);
}

:root[data-theme="light"] .site-header {
  background: rgba(246, 246, 247, 0.86);
}

.brand,
.header-actions,
.nav-links,
.hero-actions,
.panel-heading,
.panel-title,
.button,
.availability,
.context-meta div,
.topic-row,
.action-link,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 20px;
  min-height: 52px;
  color: var(--text);
  text-decoration: none;
}

.brand strong {
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1;
}

.brand span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 760;
}

.header-actions {
  gap: 18px;
}

.nav-links {
  gap: 20px;
}

.nav-links a {
  min-height: 44px;
  padding: 10px 4px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 760;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:hover {
  color: var(--text);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.page-shell {
  width: min(100% - 56px, var(--content));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, 0.92fr);
  gap: 44px;
  align-items: center;
  padding: 72px 0 30px;
}

.hero > * {
  min-width: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  font-size: clamp(5.2rem, 9vw, 9.6rem);
  line-height: 0.88;
  letter-spacing: 0;
}

.role {
  max-width: 760px;
  margin: 34px 0 0;
  color: var(--text);
  font-size: clamp(1.55rem, 2.6vw, 2.16rem);
  font-weight: 830;
  line-height: 1.18;
  text-wrap: balance;
}

.phrase {
  display: inline-block;
}

.lede {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  font-weight: 570;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 30px;
}

.button {
  justify-content: center;
  gap: 10px;
  min-width: 248px;
  min-height: 60px;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 820;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.button:hover,
.action-link:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--accent);
  color: var(--accent-text);
}

.button.secondary {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
}

:root[data-theme="light"] .button.secondary {
  background: rgba(0, 0, 0, 0.02);
}

.availability {
  gap: 9px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 680;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
}

.icon path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.context-card,
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0) 42%),
    var(--surface);
  box-shadow: var(--shadow);
}

.context-card {
  padding: 34px;
}

.panel-heading {
  justify-content: space-between;
  gap: 14px;
}

.panel-title {
  gap: 12px;
  min-width: 0;
}

.panel-title p,
.panel-title h2 {
  margin: 0;
  color: var(--text);
  font-size: 1.16rem;
  font-weight: 840;
  line-height: 1.25;
}

.section-icon,
.topic-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
}

.context-card h2 {
  margin: 24px 0 0;
  font-size: clamp(1.55rem, 2vw, 2rem);
  line-height: 1.2;
}

.context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 8px 0 0;
}

.context-meta div {
  gap: 8px;
}

.context-meta dt,
.context-meta dd {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 710;
}

.context-meta dt {
  color: var(--muted);
}

.context-meta dd {
  color: var(--text);
}

.context-topic-wrap {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}

.context-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 760;
}

.context-topics {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
  counter-reset: context-topic;
}

.context-topics li {
  position: relative;
  min-height: 36px;
  padding: 2px 0 0 48px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 760;
}

.context-topics li::before {
  counter-increment: context-topic;
  content: counter(context-topic);
  position: absolute;
  left: 0;
  top: -1px;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 820;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  gap: 18px;
  padding: 0 0 18px;
}

.panel {
  padding: 26px 30px;
}

.topics-panel {
  min-width: 0;
}

.topic-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.topic-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
}

:root[data-theme="light"] .topic-row {
  background: rgba(0, 0, 0, 0.025);
}

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

.topic-row h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.topic-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.profile-lede {
  margin: 16px 0 0;
  color: var(--text);
  font-size: 1rem;
}

.profile-detail-list {
  margin-top: 16px;
}

.contact-panel {
  margin-bottom: 36px;
}

.action-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.action-link {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  text-decoration: none;
}

.action-link > .icon {
  width: 1.35rem;
  height: 1.35rem;
  margin-bottom: 4px;
}

.action-link span {
  font-weight: 820;
  line-height: 1.25;
}

.action-link small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 680;
  line-height: 1.35;
}

.action-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.action-link.is-disabled {
  opacity: 0.58;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 780;
}

.copy-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 700;
}

.site-footer {
  justify-content: center;
  gap: 8px;
  min-height: 58px;
  border-top: 1px solid var(--border);
  color: var(--soft);
  font-size: 0.86rem;
  font-weight: 640;
}

@media (max-width: 1180px) {
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .context-card {
    max-width: 760px;
  }
}

@media (max-width: 720px) {
  .site-header {
    min-height: 64px;
    padding: 0 14px;
  }

  .brand {
    gap: 10px;
  }

  .brand strong {
    font-size: 1.3rem;
  }

  .brand span {
    display: none;
  }

  .header-actions {
    gap: 8px;
  }

  .nav-links {
    gap: 8px;
  }

  .nav-links a {
    min-height: 38px;
    padding: 8px 2px;
    font-size: 0.75rem;
  }

  .theme-toggle {
    width: 38px;
    height: 38px;
  }

  .page-shell {
    width: min(100% - 24px, var(--content));
  }

  .hero {
    gap: 34px;
    padding: 42px 0 18px;
  }

  h1 {
    font-size: clamp(4.1rem, 20vw, 5.6rem);
  }

  .role {
    margin-top: 24px;
    font-size: 1.55rem;
    line-height: 1.24;
  }

  .hero-actions {
    display: grid;
    gap: 12px;
  }

  .button {
    width: 100%;
    min-width: 0;
  }

  .context-card,
  .panel {
    padding: 20px;
  }

  .content-grid {
    padding-bottom: 28px;
  }

  .action-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .nav-links a[href="#profile"] {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.edit-layout {
  min-width: 0;
}

.site-preview {
  min-width: 0;
}

.edit-layout.is-editing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  min-height: 100vh;
}

.edit-layout.is-editing .site-header {
  padding: 0 24px;
}

.edit-layout.is-editing .page-shell {
  width: min(100% - 40px, var(--content));
}

.editor-panel {
  position: sticky;
  top: 0;
  z-index: 15;
  height: 100vh;
  overflow: auto;
  border-left: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0)),
    var(--surface);
  color: var(--text);
  padding: 22px;
}

.editor-header {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}

.editor-eyebrow,
.editor-header p,
.editor-count,
.editor-status,
.editor-message {
  margin: 0;
}

.editor-eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 840;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-header h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.editor-header p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.editor-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.editor-warning,
.editor-import,
.editor-draft-indicator,
.editor-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

:root[data-theme="light"] .editor-warning,
:root[data-theme="light"] .editor-import,
:root[data-theme="light"] .editor-draft-indicator,
:root[data-theme="light"] .editor-section {
  background: rgba(0, 0, 0, 0.025);
}

.editor-warning,
.editor-import,
.editor-draft-indicator {
  margin-bottom: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.editor-import {
  display: grid;
  gap: 10px;
}

.editor-import p {
  margin: 0;
}

.editor-draft-indicator {
  border-color: rgba(255, 221, 128, 0.38);
  background: rgba(255, 221, 128, 0.1);
  color: #ffe7ad;
  font-weight: 760;
}

:root[data-theme="light"] .editor-draft-indicator {
  color: #735000;
}

.editor-form,
.editor-section,
.topic-editor-list,
.profile-detail-editor-list,
.base-topic-editor-list,
.contact-editor-list {
  display: grid;
  gap: 12px;
}

.editor-section {
  padding: 14px;
}

.editor-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-section-heading h3 {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.3;
}

.editor-count {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  white-space: nowrap;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field,
.switch-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field span,
.switch-field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
}

.field input,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--page);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
}

.field input {
  min-height: 40px;
  padding: 8px 10px;
}

.field textarea {
  resize: vertical;
  padding: 9px 10px;
}

.field.compact {
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
}

.field.compact span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-weight: 820;
}

.switch-field {
  grid-auto-flow: column;
  align-items: center;
  justify-content: start;
}

.switch-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.contact-editor-row,
.profile-detail-editor-row,
.base-topic-editor-row {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.contact-editor-row legend,
.profile-detail-editor-row legend,
.base-topic-editor-row legend {
  padding: 0 6px;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 820;
}

.editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.editor-actions .mini-button.primary {
  grid-column: 1 / -1;
}

.editor-advanced {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
}

.editor-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 780;
}

.editor-advanced p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.mini-button {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 820;
  line-height: 1.3;
}

.mini-button.primary {
  background: var(--accent);
  color: var(--accent-text);
}

.mini-button.danger {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--muted);
}

.editor-status {
  min-height: 1.4em;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 720;
}

.editor-messages {
  display: grid;
  gap: 6px;
}

.editor-message {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
}

.editor-message.error {
  border: 1px solid rgba(255, 128, 128, 0.42);
  background: rgba(255, 80, 80, 0.12);
  color: #ffdada;
}

:root[data-theme="light"] .editor-message.error {
  color: #8b1111;
}

.editor-message.warning {
  border: 1px solid rgba(255, 221, 128, 0.38);
  background: rgba(255, 221, 128, 0.11);
  color: #ffe7ad;
}

:root[data-theme="light"] .editor-message.warning {
  color: #735000;
}

.output-field textarea {
  min-height: 120px;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  line-height: 1.45;
}

@media (max-width: 1280px) {
  .edit-layout.is-editing {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    position: relative;
    order: -1;
    height: auto;
    max-height: none;
    border-right: 0;
    border-left: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 720px) {
  .editor-panel {
    padding: 14px;
  }

  .field-grid,
  .editor-actions {
    grid-template-columns: 1fr;
  }
}
