* { box-sizing: border-box; }

:root {
  --text: #222;
  --muted: #777;
  --border: #ddd;
  --panel: #fff;
  --bg: #f7f7f7;
  --accent: #222;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}

.container {
  width: min(1040px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 60px;
  display: flex;
  align-items: center;
}

.logo {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.hero {
  padding: 52px 0 30px;
  text-align: center;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.3;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

.tool {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.editor {
  display: grid;
  grid-template-columns: 42% 58%;
  border-bottom: 1px solid var(--border);
}

.settings {
  padding: 28px;
  border-right: 1px solid var(--border);
}

.setting-group {
  padding: 0 0 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid #eee;
}

.setting-group:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.setting-group h2,
.preview-panel h2,
.code-heading h2 {
  margin: 0 0 14px;
  font-size: 16px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

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

.direction-option {
  position: relative;
  display: flex;
  min-height: 74px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.direction-option:hover {
  border-color: #999;
}

.direction-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.direction-option:has(input:checked) {
  border-color: #222;
  background: #f1f1f1;
}

.direction-option span {
  font-size: 26px;
  line-height: 1;
}

.direction-option small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.angle-row {
  display: grid;
  grid-template-columns: 1fr 76px 18px;
  gap: 10px;
  align-items: center;
}

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

.number-input,
.input-unit input,
.color-row input[type="text"] {
  width: 100%;
  height: 42px;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.size-grid label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.input-unit {
  position: relative;
}

.input-unit input {
  padding-right: 38px;
}

.input-unit b {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.color-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
}

.color-row input[type="color"] {
  width: 48px;
  height: 42px;
  padding: 3px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.preview-panel {
  padding: 28px;
}

.preview {
  min-height: 390px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.triangle {
  width: 0;
  height: 0;
  transform-origin: 50% 50%;
}

.code-wrap {
  padding: 26px 28px 28px;
}

.code-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

#copyButton {
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
}

#copyButton:hover {
  opacity: .8;
}

pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  border-radius: 5px;
  background: #f1f1f1;
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.7;
}

.copy-message {
  min-height: 1.6em;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer {
  margin-top: 52px;
  padding: 24px 0;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 13px;
}

@media (max-width: 760px) {
  .container {
    width: min(100% - 24px, 1040px);
  }

  .hero {
    padding: 40px 0 24px;
  }

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

  .settings {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .preview {
    min-height: 280px;
  }
}

@media (max-width: 480px) {
  .settings,
  .preview-panel,
  .code-wrap {
    padding: 20px 16px;
  }

  .direction-grid {
    gap: 6px;
  }

  .direction-option {
    min-height: 64px;
  }

  .direction-option span {
    font-size: 22px;
  }

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

  .code-heading {
    align-items: stretch;
    flex-direction: column;
  }

  #copyButton {
    width: 100%;
  }
}
