:root {
  color-scheme: light;
  font-family:
    Inter,
    "Noto Sans JP",
    "Yu Gothic UI",
    system-ui,
    -apple-system,
    sans-serif;
  color: #202126;
  background: #e9e8e2;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #17191f;
  --muted: #6b6d73;
  --line: rgb(23 25 31 / 12%);
  --surface: #f8f7f3;
  --accent: #a9ff68;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(rgb(255 255 255 / 28%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 28%) 1px, transparent 1px), #e9e8e2;
  background-size: 2rem 2rem;
}

button,
input,
textarea {
  font: inherit;
}

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

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 20;
  inset: 0 auto auto 0;
  padding: 0.75rem 1rem;
  color: white;
  background: var(--ink);
  transform: translateY(-110%);
}

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

.site-header,
footer,
main {
  width: min(92rem, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 4rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.site-header nav,
footer nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-header nav a,
footer a {
  color: #55585f;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.88rem;
  font-weight: 850;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  place-items: center;
  color: var(--ink);
  background: var(--accent);
  border-radius: 0.55rem;
  font-size: 0.8rem;
  font-weight: 900;
  transform: rotate(-4deg);
}

.studio {
  padding-block: 2.5rem 5rem;
}

.studio-heading {
  display: flex;
  margin-bottom: 1.5rem;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.studio-heading h1,
.prose h1,
.prose h2 {
  margin: 0;
  letter-spacing: -0.045em;
}

.studio-heading h1 {
  font-size: clamp(1.45rem, 2.2vw, 1.9rem);
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: #707279;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.15em;
}

.local-note {
  display: inline-flex;
  margin: 0;
  padding: 0.65rem 0.85rem;
  align-items: center;
  gap: 0.5rem;
  color: #565960;
  background: rgb(255 255 255 / 55%);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.local-note span {
  color: #42a56c;
  font-size: 0.6rem;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(22rem, 27rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.editor-panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  box-shadow: 0 1rem 3rem rgb(25 27 34 / 7%);
}

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

.section-title {
  display: flex;
  margin-bottom: 1rem;
  align-items: center;
  gap: 0.65rem;
}

.section-title > span {
  color: #91939a;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.65rem;
}

.section-title h2 {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 850;
}

.template-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.template-option {
  display: grid;
  padding: 0.38rem 0.38rem 0.55rem;
  gap: 0.45rem;
  color: #76787e;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 800;
  text-align: left;
}

.template-option:hover,
.template-option.selected {
  color: var(--ink);
  background: white;
  border-color: rgb(23 25 31 / 16%);
}

.template-option.selected {
  box-shadow: 0 0 0 2px var(--accent);
}

.template-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.38rem;
}

.template-thumb i {
  position: absolute;
  display: block;
  border-radius: 999px;
}

.template-thumb.aurora {
  background: linear-gradient(130deg, #131721, #27303e);
}

.template-thumb.aurora i:first-child {
  inset: 12% auto 12% 8%;
  width: 52%;
  background: linear-gradient(145deg, #6457a4, #203f56);
  border-radius: 0.35rem;
}

.template-thumb.aurora i:nth-child(2) {
  inset: 20% 9% auto auto;
  width: 27%;
  height: 8%;
  background: var(--accent);
}

.template-thumb.aurora i:last-child {
  inset: 38% 12% auto auto;
  width: 23%;
  height: 5%;
  background: rgb(255 255 255 / 55%);
}

.template-thumb.paper {
  background:
    linear-gradient(rgb(23 25 31 / 8%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 25 31 / 8%) 1px, transparent 1px), #efede6;
  background-size: 0.65rem 0.65rem;
}

.template-thumb.paper i:first-child {
  inset: 12% 8% 12% auto;
  width: 50%;
  background: linear-gradient(145deg, #6f7799, #d9a1b1);
  border: 4px solid white;
  border-radius: 0;
  transform: rotate(2deg);
}

.template-thumb.paper i:nth-child(2) {
  inset: 18% auto auto 8%;
  width: 28%;
  height: 8%;
  background: #202126;
}

.template-thumb.paper i:last-child {
  inset: 36% auto auto 8%;
  width: 22%;
  height: 6%;
  background: var(--accent);
}

.template-thumb.signal {
  background: linear-gradient(150deg, #594b7a, #12151d 68%);
}

.template-thumb.signal::after {
  position: absolute;
  inset: 45% 0 0;
  background: linear-gradient(transparent, rgb(3 4 7 / 85%));
  content: "";
}

.template-thumb.signal i:first-child {
  z-index: 1;
  inset: auto auto 18% 8%;
  width: 43%;
  height: 8%;
  background: white;
}

.template-thumb.signal i:nth-child(2) {
  z-index: 1;
  inset: auto auto 8% 8%;
  width: 30%;
  height: 5%;
  background: rgb(255 255 255 / 48%);
}

.template-thumb.signal i:last-child {
  inset: 12% 7% auto auto;
  width: 18%;
  height: 12%;
  background: var(--accent);
}

.upload-grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr;
  gap: 0.55rem;
}

.upload-slot {
  display: grid;
  min-width: 0;
  padding: 0.55rem;
  gap: 0.55rem;
  align-items: center;
  color: #6f7178;
  background: white;
  border: 1px dashed rgb(23 25 31 / 22%);
  border-radius: 0.72rem;
  cursor: pointer;
  grid-template-columns: 2.3rem 1fr;
}

.upload-slot:hover,
.upload-slot:focus-within {
  border-color: #6b8f50;
  box-shadow: 0 0 0 3px rgb(169 255 104 / 22%);
}

.upload-slot input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-preview {
  display: grid;
  width: 2.3rem;
  aspect-ratio: 1;
  place-items: center;
  color: #6c6e75;
  background-color: #ecece7;
  background-position: center;
  background-size: cover;
  border-radius: 0.52rem;
  font-size: 1.05rem;
}

.upload-slot.filled {
  color: var(--ink);
  border-style: solid;
}

.upload-slot strong,
.upload-slot small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-slot strong {
  font-size: 0.72rem;
}

.upload-slot small {
  margin-top: 0.12rem;
  color: #989aa0;
  font-size: 0.55rem;
}

.image-adjust {
  margin-top: 0.75rem;
  color: #777980;
  font-size: 0.7rem;
}

.image-adjust summary {
  cursor: pointer;
  font-weight: 750;
}

.range-grid {
  display: grid;
  margin-top: 0.75rem;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.range-grid label {
  display: grid;
  gap: 0.25rem;
}

.range-grid span {
  color: #85878d;
  font-size: 0.62rem;
}

input[type="range"] {
  width: 100%;
  accent-color: #638a46;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field.wide {
  grid-column: 1 / -1;
}

.field > span,
.compact-controls legend {
  color: #6d6f76;
  font-size: 0.65rem;
  font-weight: 750;
}

.field input,
.field textarea {
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.58rem;
  outline: none;
}

.field input {
  min-height: 2.65rem;
  padding-inline: 0.75rem;
}

.field textarea {
  padding: 0.7rem 0.75rem;
  line-height: 1.55;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  border-color: #6c8f53;
  box-shadow: 0 0 0 3px rgb(169 255 104 / 20%);
}

.field small {
  justify-self: end;
  color: #a0a2a7;
  font-size: 0.58rem;
}

.compact-controls {
  display: grid;
  gap: 1rem;
}

.compact-controls fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.compact-controls legend {
  margin-bottom: 0.5rem;
}

.chip-picker,
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-picker label,
.color-picker label {
  cursor: pointer;
}

.chip-picker input,
.color-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.chip-picker span {
  display: inline-flex;
  min-height: 2rem;
  padding-inline: 0.7rem;
  align-items: center;
  color: #676970;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 750;
}

.chip-picker input:checked + span {
  color: var(--ink);
  background: var(--accent);
  border-color: rgb(23 25 31 / 25%);
}

.chip-picker input:focus-visible + span,
.color-picker input:focus-visible + span {
  outline: 3px solid rgb(82 122 54 / 40%);
  outline-offset: 2px;
}

.color-picker span {
  display: block;
  width: 1.85rem;
  height: 1.85rem;
  background: var(--swatch);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

.color-picker input:checked + span {
  box-shadow:
    0 0 0 2px var(--ink),
    0 0 0 4px white;
}

.friend-toggle {
  display: flex;
  padding: 0.75rem;
  align-items: center;
  justify-content: space-between;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
}

.friend-toggle span {
  display: grid;
  gap: 0.12rem;
}

.friend-toggle strong {
  font-size: 0.72rem;
}

.friend-toggle small {
  color: #96989e;
  font-size: 0.58rem;
}

.friend-toggle input {
  position: absolute;
  opacity: 0;
}

.friend-toggle i {
  position: relative;
  display: block;
  width: 2.65rem;
  height: 1.45rem;
  background: #d4d5d2;
  border-radius: 999px;
  transition: 150ms ease;
}

.friend-toggle i::after {
  position: absolute;
  top: 0.18rem;
  left: 0.18rem;
  width: 1.09rem;
  height: 1.09rem;
  background: white;
  border-radius: 50%;
  box-shadow: 0 0.12rem 0.3rem rgb(0 0 0 / 18%);
  content: "";
  transition: 150ms ease;
}

.friend-toggle input:checked + i {
  background: #739f53;
}

.friend-toggle input:checked + i::after {
  transform: translateX(1.2rem);
}

.friend-toggle input:focus-visible + i {
  outline: 3px solid rgb(82 122 54 / 40%);
  outline-offset: 2px;
}

.editor-actions {
  display: grid;
  padding: 1.25rem 1.25rem 0;
  grid-template-columns: 1.3fr 1fr;
  gap: 0.55rem;
}

.button,
.text-button {
  min-height: 2.85rem;
  border-radius: 0.65rem;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 850;
}

.button {
  display: inline-flex;
  padding-inline: 0.8rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid var(--ink);
}

.button.primary {
  color: white;
  background: var(--ink);
}

.button.primary span {
  color: var(--accent);
  font-size: 1rem;
}

.button.secondary {
  color: var(--ink);
  background: white;
}

.button.share-button {
  color: var(--ink);
  background: var(--accent);
  grid-column: 1 / -1;
}

.button[hidden] {
  display: none;
}

.button:disabled {
  color: #909198;
  background: #e4e4e0;
  border-color: transparent;
  cursor: not-allowed;
}

.text-button {
  min-height: 2rem;
  color: #777980;
  background: transparent;
  border: 0;
  grid-column: 1 / -1;
}

.button:not(:disabled):hover,
.text-button:hover {
  transform: translateY(-1px);
}

.action-status {
  min-height: 2.3rem;
  margin: 0;
  padding: 0.6rem 1.25rem 1rem;
  color: #676970;
  font-size: 0.65rem;
  line-height: 1.5;
  text-align: center;
}

.action-status[data-kind="error"] {
  color: #b23a48;
}

.action-status[data-kind="success"] {
  color: #477d34;
}

.preview-panel {
  position: sticky;
  top: 1rem;
  overflow: hidden;
  min-width: 0;
  padding: 0.85rem;
  color: white;
  background: #17191f;
  border-radius: 1.2rem;
  box-shadow: 0 1.5rem 4rem rgb(25 27 34 / 18%);
}

.preview-toolbar,
.preview-hints {
  display: flex;
  min-height: 2.6rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  color: rgb(255 255 255 / 48%);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

.preview-toolbar {
  padding: 0 0.45rem 0.55rem;
}

.preview-toolbar span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: rgb(255 255 255 / 74%);
}

.preview-toolbar i {
  width: 0.42rem;
  height: 0.42rem;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0.75rem var(--accent);
}

.canvas-wrap {
  overflow: hidden;
  background: #0c0e12;
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: 0.65rem;
}

#profile-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

.preview-hints {
  min-height: 3rem;
  padding: 0.55rem 0.45rem 0;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  letter-spacing: 0;
}

.preview-hints span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.preview-hints i {
  display: grid;
  width: 1rem;
  height: 1rem;
  place-items: center;
  color: var(--accent);
  background: rgb(169 255 104 / 10%);
  border-radius: 50%;
  font-family: inherit;
  font-size: 0.55rem;
  font-style: normal;
}

.prose {
  width: min(54rem, 100%);
  margin: 3rem auto 6rem;
  padding: clamp(1.5rem, 5vw, 3.5rem);
  background: rgb(248 247 243 / 94%);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  box-shadow: 0 1rem 3rem rgb(25 27 34 / 7%);
}

.prose h1 {
  margin-bottom: 2rem;
  font-size: clamp(1.65rem, 3vw, 2.1rem);
  line-height: 1.2;
}

.prose h2 {
  margin-block: 2.4rem 0.6rem;
  font-size: 1rem;
}

.prose p {
  margin-block: 0;
  color: #575a60;
  font-size: 0.9rem;
  line-height: 1.9;
}

.prose a {
  color: #38672d;
}

.privacy-diagram {
  display: grid;
  margin-block: 1rem 2.5rem;
  padding: 1rem;
  align-items: center;
  color: #6c6e74;
  background: white;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  grid-template-columns: 1fr auto 1.4fr auto 1fr;
  gap: 0.7rem;
  font-size: 0.75rem;
  text-align: center;
}

.privacy-diagram strong {
  padding: 0.8rem;
  color: var(--ink);
  background: var(--accent);
  border-radius: 0.6rem;
}

.privacy-diagram i {
  color: #aaa;
  font-style: normal;
}

footer {
  display: flex;
  min-height: 5rem;
  align-items: center;
  justify-content: space-between;
  color: #777980;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #6c9a4d;
  outline-offset: 3px;
}

@media (max-width: 68rem) {
  .studio-layout {
    grid-template-columns: minmax(20rem, 24rem) minmax(0, 1fr);
  }

  .preview-hints span:nth-child(2) {
    display: none;
  }
}

@media (max-width: 52rem) {
  .studio {
    padding-block: 1.5rem 4rem;
  }

  .studio-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.85rem;
  }

  .studio-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: relative;
    top: auto;
    order: -1;
  }

  .editor-panel {
    border-radius: 1rem;
  }
}

@media (max-width: 34rem) {
  .site-header,
  footer,
  main {
    width: min(100% - 1rem, 92rem);
  }

  .site-header nav a:first-child {
    display: none;
  }

  .studio-heading {
    padding-inline: 0.25rem;
  }

  .local-note {
    width: 100%;
    justify-content: center;
  }

  .preview-panel {
    padding: 0.55rem;
  }

  .preview-toolbar {
    min-height: 2.2rem;
  }

  .preview-hints {
    min-height: 2.5rem;
    justify-content: center;
    gap: 0.75rem;
  }

  .template-picker {
    gap: 0.35rem;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .upload-slot {
    grid-template-columns: 2.5rem 1fr;
  }

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

  .field {
    grid-column: 1 / -1;
  }

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

  .text-button {
    grid-column: 1;
  }

  .privacy-diagram {
    grid-template-columns: 1fr;
  }

  .privacy-diagram i {
    transform: rotate(90deg);
  }

  footer {
    min-height: 6rem;
    padding-block: 1rem;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
