:root {
  --paper: #f4f0e7;
  --panel: #fffdf8;
  --ink: #16211d;
  --muted: #6f7974;
  --line: #d7d8d0;
  --green: #08a57c;
  --green-dark: #08745a;
  --green-soft: #def5ed;
  --blue: #3f75f2;
  --blue-dark: #2859bc;
  --blue-soft: #e7eeff;
  --coral: #f36d53;
  --coral-dark: #b44735;
  --coral-soft: #ffe1d8;
  --yellow: #f2c44d;
  --yellow-soft: #fff1c7;
  --shadow: 0 22px 60px rgb(38 43 38 / 12%);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 2% 5%, rgb(8 165 124 / 15%), transparent 25%),
    radial-gradient(circle at 97% 5%, rgb(243 109 83 / 18%), transparent 28%),
    var(--paper);
  font-family: Inter, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

button,
input,
textarea { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 4px solid rgb(63 117 242 / 24%);
  outline-offset: 3px;
}

.page {
  width: min(1540px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 38px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(430px, .85fr);
  align-items: end;
  gap: 12px 28px;
  padding: 0 4px 24px;
}

.hero-title { grid-column: 1 / -1; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 9px;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
}

.eyebrow i {
  position: relative;
  width: 25px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.eyebrow i::before,
.eyebrow i::after {
  position: absolute;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  content: "";
}

.eyebrow i::before { top: 5px; left: 4px; width: 9px; }
.eyebrow i::after { right: 3px; bottom: 4px; width: 13px; background: var(--coral); }

h1 {
  margin: 0;
  font-family: "Arial Black", Inter, sans-serif;
  font-size: clamp(56px, 6.7vw, 106px);
  line-height: .94;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.35vw, 23px);
  font-weight: 800;
  line-height: 1.5;
}

.lead span { color: var(--green-dark); }

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

.support-badge,
.utility-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: 13px;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.support-badge {
  gap: 8px;
  padding: 0 14px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #99d8c5;
}

.support-badge i {
  width: 9px;
  height: 9px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(8 165 124 / 13%);
}

.utility-button {
  justify-content: center;
  padding: 0 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
}

.utility-button--dark {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.studio {
  display: grid;
  grid-template-columns: minmax(330px, .72fr) minmax(0, 1.6fr);
  align-items: stretch;
  gap: 18px;
}

.control-card,
.preview-card,
.guide-card,
.code-card {
  overflow: hidden;
  background: rgb(255 253 248 / 97%);
  border: 1px solid var(--line);
  border-radius: 25px;
  box-shadow: var(--shadow);
}

.control-card { grid-column: 1; grid-row: 1; }
.preview-card { grid-column: 2; grid-row: 1; min-width: 0; }
.guide-card { grid-column: 1; grid-row: 2; }
.code-card {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  color: #f8fbf9;
  background: #101a16;
  border-color: #101a16;
}

.panel-head {
  display: flex;
  align-items: center;
  min-height: 78px;
  gap: 12px;
  padding: 16px 20px;
  background: rgb(255 253 248 / 97%);
  border-bottom: 1px solid var(--line);
}

.panel-head > div { min-width: 0; }

.panel-head p,
.code-head span {
  margin: 0 0 3px;
  color: var(--coral-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .11em;
}

.panel-head h2,
.code-head h2 {
  margin: 0;
  font-size: clamp(18px, 1.45vw, 25px);
  line-height: 1.15;
}

.section-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fff;
  border-radius: 13px;
  font-size: 11px;
  font-weight: 900;
}

.section-mark--green { background: var(--green); }
.section-mark--blue { background: var(--blue); }
.section-mark--coral { background: var(--coral); }

.panel-head--preview { padding-right: 22px; }
.panel-head--compact { min-height: 72px; }

.native-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 8px 12px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .07em;
}

.native-badge i {
  width: 18px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.control-section {
  padding: 21px 20px;
  border-bottom: 1px solid var(--line);
}

.control-label {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.control-label div { display: grid; gap: 4px; }
.control-label span,
.map-head span,
.rule-note > span,
.feature-detail > span,
.behavior-strip span,
.form-intro > span,
.context-card > span,
.external-actions > div span {
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .11em;
}

.control-label b { font-size: 15px; }
.control-label output { color: var(--green-dark); font-size: 10px; font-weight: 900; }

.mode-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding: 4px;
  background: #ebeae4;
  border: 1px solid #d7d6cf;
  border-radius: 14px;
}

.mode-switch button {
  position: relative;
  z-index: 1;
  min-height: 40px;
  padding: 0 10px;
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.mode-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgb(37 43 39 / 12%);
  transform: translateX(100%);
  transition: transform .35s var(--ease-out);
}

.mode-switch:has(button[data-layout="inside"][aria-pressed="true"]) .mode-indicator { transform: translateX(0); }

.control-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.6;
}

.sample-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.sample-grid button {
  display: grid;
  min-height: 64px;
  place-content: center;
  gap: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  cursor: pointer;
}

.sample-grid button[aria-pressed="true"] {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: var(--green);
}

.sample-grid span { font-size: 10px; font-weight: 900; }
.sample-grid b { font-size: 11px; }

.owner-map {
  margin: 20px;
  padding: 16px;
  background: linear-gradient(145deg, #eff8f5, #f8fbf9);
  border: 1px solid #b7dfd2;
  border-radius: 18px;
}

.map-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.map-head b { font-size: 12px; }

.map-node {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid #cddbd6;
  border-radius: 12px;
}

.map-node > i { width: 27px; height: 22px; border: 2px solid var(--ink); border-radius: 5px; }
.map-node--button > i { height: 16px; border-radius: 999px; background: var(--coral); }
.map-node span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.map-node code { color: var(--muted); font-size: 10px; font-weight: 900; }
.map-node b { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }

.map-link {
  position: relative;
  display: grid;
  height: 46px;
  place-items: center;
}

.map-link i { position: absolute; width: 2px; height: 100%; background: var(--green); }
.map-link i::before,
.map-link i::after { position: absolute; left: 50%; width: 7px; height: 7px; border: 2px solid var(--green); border-radius: 50%; background: #fff; content: ""; transform: translateX(-50%); }
.map-link i::before { top: -1px; }
.map-link i::after { bottom: -1px; }
.map-link span { position: relative; z-index: 1; padding: 4px 8px; color: var(--green-dark); background: #eff8f5; font-size: 10px; font-weight: 900; }

.rule-note {
  margin: 0 20px 20px;
  padding: 16px;
  color: #7d621e;
  background: var(--yellow-soft);
  border: 1px solid #e8ca6c;
  border-radius: 17px;
}

.rule-note > span { display: block; color: #8c6a12; margin-bottom: 7px; }
.rule-note > code { display: block; padding: 10px 11px; color: var(--ink); background: #fffdf8; border: 1px solid #e1d5ac; border-radius: 10px; font-size: 13px; font-weight: 900; }
.rule-note p { margin: 9px 0 0; font-size: 10px; font-weight: 700; line-height: 1.6; }

.app-stage {
  padding: 18px 18px 0;
  background-image:
    linear-gradient(rgb(40 72 60 / 6%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(40 72 60 / 6%) 1px, transparent 1px);
  background-size: 28px 28px;
}

.browser-bar {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: #e9e9e5;
  border: 1px solid #ced1cd;
  border-bottom: 0;
  border-radius: 17px 17px 0 0;
}

.browser-bar span { display: flex; gap: 5px; }
.browser-bar i { width: 7px; height: 7px; background: var(--coral); border-radius: 50%; }
.browser-bar i:nth-child(2) { background: var(--yellow); }
.browser-bar i:nth-child(3) { background: var(--green); }
.browser-bar p { margin: 0; padding: 4px 10px; background: #fff; border-radius: 6px; text-align: center; font-size: 10px; font-weight: 800; }

.app-shell {
  position: relative;
  min-height: 490px;
  overflow: hidden;
  background: #f8faf8;
  border: 1px solid #ced1cd;
  border-radius: 0 0 17px 17px;
}

.app-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid #dfe2de;
}

.app-nav a { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.app-nav a i { width: 24px; height: 24px; background: var(--green); border: 6px solid var(--green-soft); border-radius: 50%; box-shadow: 9px 0 0 -4px var(--coral); }
.app-nav b { font-size: 11px; letter-spacing: .08em; }
.app-nav > span { color: var(--muted); font-size: 10px; font-weight: 900; }

.app-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(190px, .58fr);
  gap: 16px;
  padding: 20px 20px 110px;
}

.form-column { padding: 20px; background: #fff; border: 1px solid #dfe2de; border-radius: 15px; }
.form-intro > span { color: var(--blue-dark); }
.form-intro h3 { margin: 5px 0 3px; font-size: 21px; }
.form-intro p { margin: 0 0 16px; color: var(--muted); font-size: 10px; font-weight: 700; }

#profile-form { display: grid; gap: 13px; }
#profile-form label { display: grid; gap: 6px; }
#profile-form label > span { font-size: 11px; font-weight: 900; }
#profile-form em { color: var(--coral-dark); font-size: 10px; font-style: normal; }
#profile-form input,
#profile-form textarea {
  width: 100%;
  color: var(--ink);
  background: #fbfcfb;
  border: 1.5px solid #bfc7c2;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}
#profile-form input { min-height: 42px; padding: 0 12px; }
#profile-form textarea { min-height: 80px; padding: 11px 12px; resize: none; }
#profile-form input:user-invalid,
#profile-form textarea:user-invalid { border-color: var(--coral); box-shadow: 0 0 0 3px rgb(243 109 83 / 13%); }

.inside-actions {
  display: none;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.inside-actions button,
.external-actions button {
  min-height: 39px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #bfc8c3;
  background: #fff;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
}

.inside-actions button:last-child,
.external-actions button:last-child { color: #fff; background: var(--ink); border-color: var(--ink); }

.context-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 20px 14px;
  background: var(--green-soft);
  border: 1px solid #a9d9ca;
  border-radius: 15px;
  text-align: center;
}

.status-orb { display: grid; width: 74px; height: 74px; margin: 21px 0 13px; place-items: center; background: #fff; border: 2px solid var(--green); border-radius: 50%; }
.status-orb i { width: 23px; height: 18px; border: 3px solid var(--green); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(2px, -2px); }
.context-card[data-state="error"] { background: var(--coral-soft); border-color: #f1ad9f; }
.context-card[data-state="error"] .status-orb { border-color: var(--coral); }
.context-card[data-state="error"] .status-orb i { width: 28px; height: 3px; background: var(--coral); border: 0; transform: rotate(45deg); }
.context-card[data-state="error"] .status-orb i::after { display: block; width: 28px; height: 3px; background: var(--coral); content: ""; transform: rotate(90deg); }
.context-card[data-state="success"] { background: var(--blue-soft); border-color: #b8c9fb; }
.context-card[data-state="success"] .status-orb { border-color: var(--blue); }
.context-card[data-state="success"] .status-orb i { border-color: var(--blue); }
.context-card > b { font-size: 16px; }
.context-card > p { margin: 6px 0 16px; color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.55; }
.status-route { width: 100%; margin-top: auto; padding: 9px; background: rgb(255 255 255 / 72%); border-radius: 9px; }
.status-route span { display: block; color: var(--muted); font-size: 10px; font-weight: 900; }
.status-route code { display: block; overflow: hidden; margin-top: 3px; font-size: 10px; font-weight: 900; text-overflow: ellipsis; }

.external-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 72px;
  padding: 10px 12px;
  background: rgb(255 255 255 / 96%);
  border: 1px solid #cfd5d1;
  border-radius: 14px;
  box-shadow: 0 14px 30px rgb(31 39 34 / 15%);
  transition: opacity .25s ease, transform .35s var(--ease-out);
}

.external-actions > div { display: grid; gap: 3px; }
.external-actions > div span { color: var(--coral-dark); }
.external-actions > div b { font-size: 11px; }

.owner-connector {
  position: absolute;
  right: 47%;
  bottom: 73px;
  display: grid;
  justify-items: center;
  color: var(--green-dark);
  transition: opacity .2s ease;
}

.owner-connector span { position: relative; z-index: 1; padding: 5px 8px; background: var(--green-soft); border: 1px solid #a7d9ca; border-radius: 999px; font-size: 10px; font-weight: 900; }
.owner-connector i { width: 2px; height: 33px; background: var(--green); }

.app-stage[data-layout="inside"] .external-actions,
.app-stage[data-layout="inside"] .owner-connector { opacity: 0; pointer-events: none; transform: translateY(16px); }
.app-stage[data-layout="inside"] .inside-actions { display: flex; }
.app-stage[data-layout="inside"] .app-body { padding-bottom: 20px; }
.app-stage[data-layout="inside"] .app-shell { min-height: 455px; }

.behavior-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  padding: 12px 18px 18px;
}

.behavior-strip div { min-width: 0; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.behavior-strip span { display: block; overflow: hidden; color: var(--blue-dark); text-overflow: ellipsis; white-space: nowrap; }
.behavior-strip b { display: block; overflow: hidden; margin-top: 5px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }

.feature-list { display: grid; gap: 8px; padding: 18px 18px 12px; }
.feature-list button {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 67px;
  padding: 10px 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: left;
  cursor: pointer;
}
.feature-list button[aria-pressed="true"] { color: var(--green-dark); background: var(--green-soft); border-color: var(--green); }
.feature-list button > span { display: grid; width: 30px; height: 30px; place-items: center; color: #fff; background: var(--green); border-radius: 9px; font-size: 10px; font-weight: 900; }
.feature-list button div { display: grid; gap: 4px; min-width: 0; }
.feature-list b { color: var(--ink); font-size: 12px; }
.feature-list small { color: var(--muted); font-size: 10px; font-weight: 700; line-height: 1.35; }
.feature-list i { font-size: 15px; font-style: normal; font-weight: 900; }

.feature-detail { margin: 0 18px 18px; padding: 16px; background: var(--yellow-soft); border: 1px solid #e8c866; border-radius: 15px; }
.feature-detail > span { color: #8d6910; }
.feature-detail h3 { margin: 7px 0 5px; font-size: 15px; }
.feature-detail p { margin: 0; color: #6f612e; font-size: 10px; font-weight: 700; line-height: 1.6; }

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #31403a;
}
.code-head span { color: var(--yellow); }
.code-head button { min-height: 40px; padding: 0 14px; color: #fff; background: var(--coral); border: 0; border-radius: 11px; font-size: 10px; font-weight: 900; cursor: pointer; }

.code-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 14px 18px 0; padding: 4px; background: #202b27; border: 1px solid #35443e; border-radius: 12px; }
.code-tabs button { min-height: 36px; color: #9da8a3; background: transparent; border: 0; border-radius: 9px; font-size: 10px; font-weight: 900; cursor: pointer; }
.code-tabs button[aria-pressed="true"] { color: var(--ink); background: #fff; }

.code-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(220px, .62fr); min-height: 278px; }
pre { min-width: 0; margin: 0; padding: 20px; overflow: auto; color: #f5faf7; background: #0a110e; font: 700 11px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; }
.code-note { align-self: stretch; margin: 14px 14px 14px 0; padding: 16px; background: #20263a; border: 1px solid #414b72; border-radius: 14px; }
.code-note span { color: #9eb3ff; font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.code-note strong { display: block; margin-top: 9px; font-size: 17px; line-height: 1.25; }
.code-note p { margin: 9px 0 0; color: #bdc4d8; font-size: 10px; font-weight: 700; line-height: 1.6; }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  padding: 12px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .2s ease, transform .25s var(--ease-out);
}
.toast[data-visible="true"] { opacity: 1; transform: translateY(0); }

@media (max-width: 1050px) {
  .hero { grid-template-columns: 1fr; }
  .hero-title { grid-column: auto; }
  .hero-actions { justify-content: flex-start; flex-wrap: wrap; }
  .studio { grid-template-columns: 1fr; }
  .control-card,
  .preview-card,
  .guide-card,
  .code-card { grid-column: 1; grid-row: auto; }
  .control-card { order: 1; }
  .preview-card { order: 2; }
  .guide-card { order: 3; }
  .code-card { order: 4; }
}

@media (max-width: 720px) {
  .page { width: min(100% - 20px, 620px); padding-top: 18px; }
  .hero { padding: 0 2px 18px; }
  h1 { font-size: clamp(42px, 13vw, 64px); }
  .lead { font-size: 15px; }
  .support-badge { width: 100%; justify-content: center; }
  .studio { gap: 12px; }
  .control-card,
  .preview-card,
  .guide-card,
  .code-card { border-radius: 19px; }
  .panel-head { min-height: 70px; padding: 13px 14px; }
  .panel-head h2,
  .code-head h2 { font-size: 17px; }
  .section-mark { width: 38px; height: 38px; }
  .native-badge { display: none; }
  .control-section { padding: 18px 14px; }
  .owner-map { margin: 16px 14px; }
  .rule-note { margin: 0 14px 16px; }
  .app-stage { padding: 10px 10px 0; }
  .browser-bar { grid-template-columns: 1fr 3fr 1fr; }
  .app-shell { min-height: 675px; }
  .app-body { grid-template-columns: 1fr; padding: 14px 14px 120px; }
  .form-column { padding: 16px; }
  .context-card { min-height: 190px; }
  .status-orb { width: 56px; height: 56px; margin: 12px 0 8px; }
  .external-actions { grid-template-columns: 1fr 1fr; }
  .external-actions > div { grid-column: 1 / -1; grid-row: 1; }
  .external-actions button { grid-row: 2; }
  .owner-connector { display: none; }
  .app-stage[data-layout="inside"] .app-shell { min-height: 590px; }
  .behavior-strip { grid-template-columns: repeat(2, 1fr); padding: 10px 10px 14px; }
  .code-head { padding: 14px; }
  .code-tabs { margin: 12px 12px 0; }
  .code-body { grid-template-columns: 1fr; }
  pre { min-height: 250px; padding: 16px; }
  .code-note { margin: 0 12px 12px; }
}

@media (max-width: 420px) {
  .utility-button { flex: 1; }
  .app-nav > span { display: none; }
  .browser-bar p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .feature-list { padding-inline: 12px; }
  .feature-detail { margin-inline: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
