:root,
:root[data-theme='light'] {
  --c-primary: #0f62fe;
  --c-primary-btn: #0f62fe;
  --c-primary-d: #0043ce;
  --c-primary-soft: rgba(15, 98, 254, 0.1);
  --c-nav-active: #0043ce;
  --c-focus: #0043ce;
  --c-text: #18202f;
  --c-muted: #525c6e;
  --c-border: rgba(24, 32, 47, 0.16);
  --c-control-border: rgba(24, 32, 47, 0.45);
  --c-bg: #f4f6fa;
  --c-card: #ffffff;
  --c-input-bg: #ffffff;
  --c-surface-subtle: rgba(24, 32, 47, 0.05);
  --c-swatch-border: rgba(15, 23, 42, 0.28);
  --c-err: #c62828;
  --c-err-bg: rgba(198, 40, 40, 0.08);
  --c-ok: #167938;
  --c-ok-bg: rgba(22, 121, 56, 0.08);
  --c-warn: #9a4406;
  --c-on-primary: #ffffff;
  --c-paper-bg: #ffffff;
  --c-paper-text: #18202f;
  --c-paper-muted: #525c6e;
  --c-code-bg: #0c111d;
  --c-code-text: #e6edf7;
  --shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.16), 0 2px 6px rgba(15, 23, 42, 0.08);
  --radius: 10px;
  --font: 'Noto Sans JP', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic UI', 'Yu Gothic', Meiryo, system-ui, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --c-primary: #78b0ff;
    --c-primary-btn: #0f62fe;
    --c-primary-d: #0043ce;
    --c-primary-soft: rgba(120, 176, 255, 0.16);
    --c-nav-active: #78b0ff;
    --c-focus: #78b0ff;
    --c-text: #e6edf7;
    --c-muted: #9aa6bc;
    --c-border: rgba(230, 237, 247, 0.16);
    --c-control-border: rgba(230, 237, 247, 0.38);
    --c-bg: #0c111d;
    --c-card: #151c2c;
    --c-input-bg: #0c111d;
    --c-surface-subtle: rgba(230, 237, 247, 0.07);
    --c-swatch-border: rgba(255, 255, 255, 0.32);
    --c-err: rgba(255, 123, 123, 1);
    --c-err-bg: rgba(239, 68, 68, 0.14);
    --c-ok: rgba(74, 222, 128, 1);
    --c-ok-bg: rgba(74, 222, 128, 0.14);
    --c-warn: rgba(251, 191, 36, 1);
    --shadow-pop: 0 16px 36px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --c-primary: #78b0ff;
  --c-primary-btn: #0f62fe;
  --c-primary-d: #0043ce;
  --c-primary-soft: rgba(120, 176, 255, 0.16);
  --c-nav-active: #78b0ff;
  --c-focus: #78b0ff;
  --c-text: #e6edf7;
  --c-muted: #9aa6bc;
  --c-border: rgba(230, 237, 247, 0.16);
  --c-control-border: rgba(230, 237, 247, 0.38);
  --c-bg: #0c111d;
  --c-card: #151c2c;
  --c-input-bg: #0c111d;
  --c-surface-subtle: rgba(230, 237, 247, 0.07);
  --c-swatch-border: rgba(255, 255, 255, 0.32);
  --c-err: rgba(255, 123, 123, 1);
  --c-err-bg: rgba(239, 68, 68, 0.14);
  --c-ok: rgba(74, 222, 128, 1);
  --c-ok-bg: rgba(74, 222, 128, 0.14);
  --c-warn: rgba(251, 191, 36, 1);
  --shadow-pop: 0 16px 36px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

[hidden] {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.75;
  font-size: 16px;
}

a {
  color: var(--c-primary);
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--c-primary-btn);
  color: var(--c-on-primary);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 0.12s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

/* header */
.site-header {
  background: var(--c-card);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 12px 16px;
  min-height: 56px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
  color: var(--c-primary);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand svg {
  flex-shrink: 0;
  display: block;
}
.brand span {
  color: var(--c-text);
}
.brand small {
  color: var(--c-muted);
  font-weight: 500;
}
.site-header nav {
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.site-header nav::-webkit-scrollbar {
  display: none;
}
.site-header nav[data-fade-right='true'] {
  mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) calc(100% - 28px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, rgba(0, 0, 0, 1) calc(100% - 28px), transparent 100%);
}
.site-header nav[data-fade-left='true']:not([data-fade-right='true']) {
  mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, 1) 28px);
  -webkit-mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, 1) 28px);
}
.site-header nav[data-fade-left='true'][data-fade-right='true'] {
  mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, 1) 24px, rgba(0, 0, 0, 1) calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, rgba(0, 0, 0, 1) 24px, rgba(0, 0, 0, 1) calc(100% - 24px), transparent 100%);
}
.site-header ul {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}
.site-header nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--c-text);
  text-decoration: none;
  font-size: 14px;
}
.site-header nav a:hover {
  background: var(--c-surface-subtle);
}
.site-header nav a[aria-current='page'],
.site-header nav a[data-active='true'] {
  background: var(--c-primary-soft);
  color: var(--c-nav-active);
  font-weight: 700;
}

.theme-toggle {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--c-control-border);
  background: var(--c-card);
  color: var(--c-text);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.theme-toggle:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-surface-subtle);
}
.theme-toggle .icon-sun {
  display: none;
}
.theme-toggle .icon-moon {
  display: block;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .icon-sun {
    display: block;
  }
  :root:not([data-theme='light']) .theme-toggle .icon-moon {
    display: none;
  }
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: block;
}
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}

@media (max-width: 720px) {
  .header-inner {
    gap: 4px 12px;
    padding-top: 6px;
    padding-bottom: 6px;
    min-height: 0;
  }
  .theme-toggle {
    margin-left: auto;
    width: 40px;
    height: 40px;
  }
  .site-header nav {
    order: 3;
    margin-left: 0;
    width: 100%;
    padding-bottom: 2px;
  }
  .site-header nav a {
    min-height: 38px;
    padding: 5px 10px;
  }
}

main {
  padding-top: 20px;
  padding-bottom: 40px;
}
main:focus {
  outline: none;
}

h1 {
  font-size: clamp(28px, 4vw, 36px);
  margin: 8px 0 4px;
  line-height: 1.3;
}
.lead {
  margin: 0 0 16px;
  color: var(--c-muted);
}
h2 {
  font-size: 22px;
  margin: 40px 0 12px;
  padding-left: 12px;
  border-left: 5px solid var(--c-primary);
  line-height: 1.4;
}
h3 {
  font-size: 18px;
  margin: 24px 0 8px;
}

.card {
  min-width: 0;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
}

/* tool layout */
.tool {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.tool .controls-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
@media (min-width: 861px) {
  .tool-reorder .controls-col > .controls-main {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: 0;
    padding-bottom: 4px;
  }
  .tool-reorder .controls-col > .controls-sub {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    padding-top: 8px;
  }
}
.tool .preview-col {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 16px;
}
@media (max-width: 860px) {
  .tool {
    grid-template-columns: minmax(0, 1fr);
  }
  .tool .preview-col {
    position: static;
  }
  .tool-reorder > .controls-col,
  .tool-reorder > .preview-col {
    display: contents;
  }
  .tool-reorder .controls-main {
    order: 1;
  }
  .tool-reorder .preview-card {
    order: 2;
  }
  .tool-reorder .controls-sub {
    order: 3;
  }
  .tool-reorder .output-card {
    order: 4;
  }
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}
.field > label,
.field > .label,
.label-row {
  font-weight: 700;
  font-size: 14px;
}
.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.label-row output {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-muted);
}
.hint {
  font-size: 13px;

  color: var(--c-muted);
  margin: 0;
}
.row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px 12px;
  align-items: end;
}
.controls .row:not(.color-row) {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}
.row > .field {
  align-content: end;
}

input[type='text'],
input[type='number'],
input[type='url'],
input[type='email'],
input[type='tel'],
input[type='datetime-local'],
input[type='search'],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid var(--c-control-border);
  border-radius: 8px;
  background: var(--c-input-bg);
  color: inherit;
}
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--c-surface-subtle);
}
input[type='range'] {
  width: 100%;
  min-height: 32px;
  accent-color: var(--c-primary-btn);
  cursor: pointer;
}
input[type='file'] {
  font: inherit;
  font-size: 14px;
  color: var(--c-text);
  max-width: 100%;
}
textarea {
  resize: vertical;
  min-height: 72px;
  font-family: var(--mono);
  font-size: 15px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible,
summary:focus-visible,
[role='tab']:focus-visible,
[role='slider']:focus-visible,
[role='application']:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

#drop {
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
#drop:hover {
  border-color: var(--c-primary) !important;
}
#drop:has(+ #file:focus-visible) {
  border-color: var(--c-focus) !important;
  background: var(--c-primary-soft);
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

input[type='color'] {
  width: 100%;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--c-control-border);
  border-radius: 8px;
  background: var(--c-input-bg);
}

.row.color-row {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px 10px;
}
.color-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 46px;
  padding: 0 7px;
  border: 1px solid var(--c-control-border);
  border-radius: 8px;
  background: var(--c-input-bg);
  transition: border-color 0.12s ease;
}
.color-picker:hover:not(.is-disabled) {
  border-color: var(--c-primary);
}
.color-picker:focus-within,
.color-picker.is-open {
  border-color: var(--c-focus);
  outline: 2px solid var(--c-focus);
  outline-offset: 1px;
}
.color-picker.is-invalid {
  border-color: var(--c-err);
  outline-color: var(--c-err);
}
.color-picker.is-disabled,
.color-picker:has(.color-native:disabled) {
  opacity: 0.5;
  pointer-events: none;
  background: var(--c-surface-subtle);
}
.color-swatch {
  position: relative;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--c-swatch-border);
  border-radius: 6px;
  background: var(--swatch, var(--c-paper-text));
  cursor: pointer;
  display: block;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.color-swatch::after {
  content: '';
  position: absolute;
  inset: -7px;
}
.color-swatch:hover {
  transform: scale(1.06);
}
.color-swatch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--c-card), 0 0 0 4px var(--c-focus);
}
.color-swatch-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  background: var(--swatch, var(--c-paper-text));
}
.color-picker input.color-hex {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--c-text);
  outline: none;
}
@media (max-width: 600px) {
  .color-picker input.color-hex {
    font-size: 16px;
  }
}

.color-popover {
  position: fixed;
  z-index: 1000;
  width: 264px;
  max-width: calc(100vw - 20px);

  max-height: calc(100dvh - 20px);
  overflow-y: auto;
  padding: 12px;
  background: var(--c-card);
  color: var(--c-text);
  border: 1px solid var(--c-control-border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  user-select: none;
}
.cp-sv {
  position: relative;
  width: 100%;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2);
}
.cp-sv-white {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0));
}
.cp-sv-black {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
}
.cp-sv-thumb {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--c-on-primary);
  box-shadow: 0 0 0 1.5px rgba(15, 23, 42, 0.55), 0 2px 4px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.cp-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.cp-hue {
  position: relative;
  flex: 1;
  height: 16px;
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
  background: linear-gradient(to right, rgba(255, 0, 0, 1) 0%, rgba(255, 255, 0, 1) 17%, rgba(0, 255, 0, 1) 33%, rgba(0, 255, 255, 1) 50%, rgba(0, 0, 255, 1) 67%, rgba(255, 0, 255, 1) 83%, rgba(255, 0, 0, 1) 100%);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2);
}
.cp-hue-thumb {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--c-on-primary);
  box-shadow: 0 0 0 1.5px rgba(15, 23, 42, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.cp-icon-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--c-control-border);
  background: var(--c-input-bg);
  color: var(--c-muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}
.cp-icon-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.cp-icon-btn.is-copied {
  border-color: var(--c-ok);
  color: var(--c-ok);
  background: var(--c-ok-bg);
}
.cp-inputs {
  display: grid;
  grid-template-columns: 1.85fr 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.cp-in-col {
  display: grid;
  gap: 2px;
  text-align: center;
}
.cp-in-col > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-muted);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.cp-inputs input[type='text'],
.cp-inputs input[type='number'] {
  width: 100%;
  padding: 5px 5px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--c-control-border);
  border-radius: 6px;
  background: var(--c-surface-subtle);
  color: var(--c-text);
  appearance: textfield;
  -moz-appearance: textfield;
}
.cp-inputs input::-webkit-outer-spin-button,
.cp-inputs input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cp-presets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--c-muted);
}
.cp-sync-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--c-control-border);
  background: var(--c-surface-subtle);
  color: var(--c-primary);
  cursor: pointer;
}
.cp-sync-btn:hover {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
}
.cp-presets {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.cp-preset {
  width: 100%;
  aspect-ratio: 1;
  min-height: 32px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--c-swatch-border);
  background: var(--p);
  cursor: pointer;
  transition: transform 0.1s ease;
}
.cp-preset:hover {
  transform: scale(1.08);
}
.cp-preset[aria-current='true'] {
  box-shadow: 0 0 0 2px var(--c-card), 0 0 0 4px var(--c-focus);
}
.cp-contrast {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--c-border);
  font-size: 12px;
  line-height: 1.35;
}
.cp-contrast.is-ok .cp-contrast-text {
  color: var(--c-ok);
  font-weight: 600;
}
.cp-contrast.is-warn .cp-contrast-text {
  color: var(--c-warn);
  font-weight: 600;
}
.cp-contrast-sample {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--c-swatch-border);
  display: grid;
  place-items: center;
}
.cp-contrast-sample > span {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;

  min-height: 34px;
  font-size: 14px;
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--c-primary-btn);
  flex-shrink: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--c-control-border);
  background: var(--c-card);
  color: var(--c-text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) {
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.btn.primary,
.btn[aria-pressed='true'] {
  background: var(--c-primary-btn);
  border-color: var(--c-primary-btn);
  color: var(--c-on-primary);
}
.btn.primary:hover:not(:disabled),
.btn[aria-pressed='true']:hover:not(:disabled) {
  background: var(--c-primary-d);
  border-color: var(--c-primary-d);
  color: var(--c-on-primary);
}
.btn.danger-confirm,
.btn.danger-confirm:hover:not(:disabled) {
  border-color: var(--c-err);
  color: var(--c-err);
  background: var(--c-err-bg);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chips.sym-chips {
  margin: 4px 0 2px;
}
.sym-note {
  display: flex;
  align-items: center;
  min-height: 58px;
  margin: 2px 0 0;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--c-surface-subtle);
  border: 1px solid var(--c-border);
  line-height: 1.55;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  font: inherit;
  font-size: 13px;
  padding: 5px 11px;

  border-radius: 999px;
  border: 1px solid var(--c-control-border);
  background: var(--c-card);
  cursor: pointer;
  color: var(--c-text);
  text-decoration: none;
}
.chip:hover:not(:disabled):not([aria-pressed='true']) {
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.chip[aria-pressed='true'] {
  background: var(--c-primary-btn);
  border-color: var(--c-primary-btn);
  color: var(--c-on-primary);
}
.chip[aria-pressed='true']:hover:not(:disabled) {
  background: var(--c-primary-d);
  border-color: var(--c-primary-d);
  color: var(--c-on-primary);
}

/* スキャナー読み取り性を保つため、ダークモードでもプレビュー背景は明るい市松模様を維持 */
.preview {
  min-height: 248px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
  background-color: var(--c-paper-bg);
  background-image: linear-gradient(45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%), linear-gradient(-45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%), linear-gradient(-45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  color: var(--c-paper-muted);
  overflow: auto;
}
.preview .hint {
  color: var(--c-paper-muted);
}
#qr .preview {
  min-height: 332px;
}
@media (max-width: 380px) {
  #qr .preview {
    min-height: 260px;
  }
}
.preview svg,
.preview canvas,
.preview img {
  max-width: 100%;
  height: auto;
  display: block;
}
.preview img {
  cursor: pointer;
}
.preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.preview-foot .meta {
  margin: 0;
  flex: 1;
  min-width: 0;
}
.preview-copy-btn {
  flex-shrink: 0;
  min-width: 10.2em;
  text-align: center;
  line-height: 1.4;
  padding: 4px 10px;
}
.preview-copy-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.preview-copy-btn.copied,
.preview-copy-btn.copied:hover:not(:disabled) {
  border-color: var(--c-ok);
  color: var(--c-ok);
  background: var(--c-ok-bg);
}
.preview-opt {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--c-muted);
  white-space: nowrap;
  user-select: none;
}
.preview-opt input {
  width: 16px;
  height: 16px;
  margin: 0;
}
.grid-preview[data-hide-num='true'] .grid-num {
  display: none;
}
.meta {
  font-size: 13px;
  color: var(--c-muted);
  margin: 8px 0 0;
  min-height: 1.75em;
}
.status-line {
  min-height: 1.75em;
}
.status-gap {
  margin-top: 6px;
}
.error {
  color: var(--c-err);
  font-size: 14px;
  margin: 8px 0 0;
  white-space: pre-wrap;
}
.error:empty {
  margin: 0;
}
.err-text {
  color: var(--c-err);
}
.ok {
  color: var(--c-ok);
}

details.adv {
  border-top: 1px solid var(--c-border);
  padding-top: 6px;
  margin-top: 4px;
}
details.adv summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 2px;
  margin-bottom: 6px;
  border-radius: 6px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--c-border);
  margin: -4px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tabs button {
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  min-height: 40px;
  border: 0;
  background: none;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  color: var(--c-muted);
  white-space: nowrap;
}
.tabs button:hover {
  color: var(--c-text);
}
.tabs button[aria-selected='true'] {
  color: var(--c-primary);
  border-bottom-color: var(--c-primary);
}
[role='tabpanel'][hidden] {
  display: none;
}

pre.code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--c-code-bg);
  color: var(--c-code-text);
  border: 1px solid var(--c-border);
  padding: 12px;
  border-radius: 8px;
  min-height: 96px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 8px 0 0;
}

/* content */
.content {
  max-width: 860px;
}
.content p,
.content li {
  font-size: 16px;
}
.content table,
table.list {
  width: 100%;
  border-collapse: collapse;
  background: var(--c-card);
  font-size: 14px;
}
.content th,
.content td,
table.list th,
table.list td {
  border: 1px solid var(--c-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.content th,
table.list th {
  background: var(--c-surface-subtle);
  color: var(--c-text);
}
.table-scroll {
  overflow-x: auto;
}
.steps {
  counter-reset: s;
  list-style: none;
  padding: 0;
}
.steps li {
  counter-increment: s;
  position: relative;
  padding-left: 40px;
  margin-bottom: 10px;
}
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-primary-btn);
  color: var(--c-on-primary);
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
}
.features li {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px;
}
.features strong {
  display: block;
  margin-bottom: 4px;
}
.faq dt {
  font-weight: 700;
  margin-top: 16px;
}
.faq dt::before {
  content: 'Q. ';
  color: var(--c-primary);
}
.faq dd {
  margin: 4px 0 0;
}
.faq dd::before {
  content: 'A. ';
  font-weight: 700;
  color: var(--c-err);
}

.site-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-card);
  padding: 24px 0;
  font-size: 14px;
  color: var(--c-muted);
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
.small {
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* sheet preview（物理用紙プレビューのため常に白紙・黒文字を維持） */
.sheet-preview {
  background: var(--c-paper-bg);
  color: var(--c-paper-text);
  border: 1px solid var(--c-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}
.sheet-preview .cell {
  position: absolute;
  outline: 1px dashed var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sheet-preview .cell svg {
  max-width: 100%;
  max-height: 100%;
}

/* print */

#print-root {
  display: none;
}
@media print {
  :root,
  :root[data-theme='dark'] {
    color-scheme: light !important;
  }
  body > *:not(#print-root) {
    display: none !important;
  }
  body {
    background: var(--c-paper-bg) !important;
    color: black !important;
    margin: 0;
  }
  #print-root {
    display: block;
    background: var(--c-paper-bg);

    color: black;
  }
  .print-page {
    position: relative;
    overflow: hidden;
    background: var(--c-paper-bg);
    color: black;
    page-break-after: always;
    break-after: page;
  }
  .print-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  .print-cell {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
}

/* mode toggle */
#gen[data-mode='single'] .only-batch,
#gen[data-mode='batch'] .only-single {
  display: none !important;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--c-control-border);
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}
.seg button {
  flex: 1;
  min-height: 40px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
  border: 0;
  background: var(--c-card);
  color: var(--c-muted);
  cursor: pointer;
}
.seg button + button {
  border-left: 1px solid var(--c-control-border);
}
.seg button[aria-pressed='true'] {
  background: var(--c-primary-btn);
  color: var(--c-on-primary);
}

/* batch grid */
.grid-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  min-height: 248px;
  max-height: 520px;
  overflow: auto;
  padding: 2px;
}
.grid-preview figure {
  margin: 0;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 4px;
  justify-items: center;
  align-content: start;
  min-width: 0;
}
.grid-preview figure.bad {
  border-color: var(--c-err);
  background: var(--c-err-bg);
}
.grid-preview svg {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 110px;
  padding: 4px;
  border-radius: 4px;
  background-color: var(--c-paper-bg);
  background-image: linear-gradient(45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%), linear-gradient(-45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%), linear-gradient(-45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.grid-preview figcaption {
  font-size: 12px;
  color: var(--c-muted);
  font-family: var(--mono);
  word-break: break-all;
  text-align: center;
  max-width: 100%;
}
.grid-preview .more {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 13px;
  color: var(--c-muted);
}

.breadcrumb {
  font-size: 13px;
  color: var(--c-muted);
}
.link-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.link-list a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--c-control-border);
  border-radius: 999px;
  background: var(--c-card);
  text-decoration: none;
  font-size: 14px;
}
.link-list a:hover {
  border-color: var(--c-primary);
}

/* scanner */
.scan-results {
  min-height: 180px;
  max-height: 420px;
  overflow-y: auto;
}
@media (max-width: 860px) {
  .scan-results {
    max-height: 320px;
  }
}
.scan-meta-badge {
  display: inline-block;
  margin-top: 2px;
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--c-surface-subtle);
  border: 1px solid var(--c-border);
  font-size: 12px;
  color: var(--c-text);
}
.scan-img-preview img {
  display: block;
  height: 160px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: var(--c-surface-subtle);
}

/* カスタムセレクト＆クイック選択バブルの作成例プレビュー */
.select-picker {
  position: relative;
  width: 100%;
  min-width: 0;
}
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid var(--c-control-border);
  border-radius: 8px;
  background: var(--c-input-bg);
  color: var(--c-text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease;
}
.select-trigger:hover:not(:disabled) {
  border-color: var(--c-primary);
}
.select-picker.is-open .select-trigger {
  border-color: var(--c-focus);
  outline: 2px solid var(--c-focus);
  outline-offset: 1px;
}
.select-trigger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: var(--c-surface-subtle);
}
.select-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.select-trigger-icon {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  color: var(--c-muted);
  transition: transform 0.14s ease, color 0.14s ease;
}
.select-picker.is-open .select-trigger-icon {
  transform: rotate(180deg);
  color: var(--c-primary);
}

.select-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(15, 23, 42, 0.46);
}
.select-popover {
  position: fixed;
  z-index: 1050;
  background: var(--c-card);
  color: var(--c-text);
  border: 1px solid var(--c-control-border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  max-width: calc(100vw - 20px);
  overflow: hidden;
}
.sp-body {
  display: flex;
  align-items: stretch;
  max-height: var(--sp-max-h, 380px);
}
.select-popover.is-preview-left .sp-body {
  flex-direction: row-reverse;
}
.sp-list-pane {
  display: flex;
  flex-direction: column;
  min-width: 240px;
  max-width: 350px;
  max-height: inherit;
  border-right: 1px solid var(--c-border);
}
.select-popover.is-preview-left .sp-list-pane {
  border-right: 0;
  border-left: 1px solid var(--c-border);
}
.sp-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.sp-search {
  width: 100%;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--c-control-border);
  background: var(--c-input-bg);
  color: var(--c-text);
}
.sp-listbox {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 5px;
  outline: none;
  overscroll-behavior: contain;
}
.sp-group-label {
  padding: 8px 10px 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--c-muted);
  line-height: 1.35;
}

.sp-group-label:not(:first-child) {
  margin-top: 4px;
  border-top: 1px solid var(--c-border);
}
.sp-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  -webkit-touch-callout: none;
}
.sp-option.is-active {
  background: var(--c-primary-soft);
  color: var(--c-nav-active);
}
.sp-option.is-selected {
  font-weight: 700;
}
.sp-option.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.sp-check {
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  font-weight: 700;
  color: var(--c-primary);
  font-size: 13px;
}
.sp-opt-label {
  flex: 1;
  min-width: 0;
}
.sp-peek-btn {
  flex-shrink: 0;
  min-width: 40px;
  min-height: 30px;
  padding: 3px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  border: 1px solid var(--c-control-border);
  background: var(--c-surface-subtle);
  color: var(--c-primary);
  cursor: pointer;
}
.sp-option.is-active .sp-peek-btn {
  background: var(--c-primary-btn);
  border-color: var(--c-primary-btn);
  color: var(--c-on-primary);
}
.sp-empty {
  margin: 0;
  padding: 16px 12px;
  font-size: 13px;
  color: var(--c-muted);
  text-align: center;
}
.sp-preview-pane {
  width: 280px;
  flex-shrink: 0;
  padding: 12px;
  background: var(--c-surface-subtle);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* モバイル用ボトムシート表示 */
.select-popover.is-sheet {
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100%;
  max-width: 100%;
  max-height: min(86dvh, 680px);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  display: flex;
  flex-direction: column;
}
.sp-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.sp-sheet-title {
  font-size: 15px;
  font-weight: 700;
}
.sp-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-subtle);
  color: var(--c-text);
  font-size: 15px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.select-popover.is-sheet .sp-body {
  display: grid;

  grid-template-rows: auto minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}
.select-popover.is-sheet .sp-preview-pane {
  grid-row: 1;
  width: 100%;
  max-height: 310px;
  padding: 10px 14px;
  gap: 6px;
  border-bottom: 1px solid var(--c-border);
}
.select-popover.is-sheet .sp-list-pane {
  grid-row: 2;
  width: 100% !important;
  max-width: none;
  min-height: 0;
  border: 0;
}

/* クイック選択バブル用ツールチップ／モバイルプレビューカード */
.example-tooltip {
  position: fixed;
  z-index: 1060;
  width: 288px;
  max-width: calc(100vw - 24px);
  padding: 12px;
  background: var(--c-card);
  color: var(--c-text);
  border: 1px solid var(--c-control-border);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
}
.example-tooltip.is-mobile-card {
  width: min(320px, calc(100vw - 24px));
  pointer-events: auto;
}
.ex-mobile-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-subtle);
  color: var(--c-muted);
  font-size: 13px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.ex-mobile-close::after {
  content: '';
  position: absolute;
  inset: -7px;
}
.example-tooltip.is-mobile-card .ex-head {
  min-height: 30px;
  padding-right: 36px;
}

.ex-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ex-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.ex-title {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--c-text);
}
.ex-visual {
  min-height: 92px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  background-color: var(--c-paper-bg);
  background-image: linear-gradient(45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%), linear-gradient(-45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%), linear-gradient(-45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.select-popover.is-sheet .ex-visual {
  min-height: 76px;
  padding: 6px 8px;
}
.ex-visual svg {
  display: block;
  max-width: 100%;
  max-height: 88px;
  width: auto;
  height: auto;
}
.select-popover.is-sheet .ex-visual svg {
  max-height: 70px;
}
.ex-loading {
  font-size: 12px;
  color: var(--c-paper-muted);
}
.ex-sample {
  display: grid;
  gap: 3px;
}
.ex-sample-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--c-muted);
  letter-spacing: 0.03em;
}
.ex-inline-code {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  color: var(--c-text);
  word-break: break-all;
}
.example-tooltip .ex-inline-code {
  background: var(--c-surface-subtle);
}
.ex-code {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--c-code-bg);
  color: var(--c-code-text);
  border: 1px solid var(--c-border);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 100px;
  overflow-y: auto;
}
.ex-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--c-muted);
}
.ex-actions {
  margin-top: 2px;
  display: flex;
}
.ex-actions .btn {
  width: 100%;
  min-height: 38px;
  font-size: 13px;
  padding: 6px 12px;
}

[data-preview-bubble='true'] {
  -webkit-touch-callout: none;
  user-select: none;
}
.touch-preview-hint {
  display: none;
}

/* かんたんモード（Simple Mode） / 詳細モード切替 */
[data-ui='simple'] .only-ui-adv,
[data-ui='advanced'] .only-ui-simple {
  display: none !important;
}
.ui-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--c-border);
  flex-wrap: wrap;
}
.ui-mode-label {

  font-size: 12.5px;
  font-weight: 700;
  color: var(--c-muted);
}
.ui-mode-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--c-surface-subtle);
  border: 1px solid var(--c-border);
}
.ui-mode-seg button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  min-height: 30px;
  padding: 4px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.ui-mode-seg button:hover:not([aria-pressed='true']) {
  color: var(--c-text);
}
.ui-mode-seg button[aria-pressed='true'] {
  background: var(--c-primary-btn);
  color: var(--c-on-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
}

.adv-sym-label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.simple-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}
.simple-type-btn {
  appearance: none;
  -webkit-appearance: none;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 5px 8px;
  align-items: center;
  padding: 8px 9px;
  border-radius: 10px;
  border: 1px solid var(--c-control-border);
  background: var(--c-card);
  color: var(--c-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.simple-type-btn:hover:not([aria-pressed='true']) {
  border-color: var(--c-primary);
  background: var(--c-surface-subtle);
}
.simple-type-btn[aria-pressed='true'] {
  border-color: var(--c-primary-btn);
  background: var(--c-primary-soft);
  box-shadow: inset 0 0 0 1px var(--c-primary-btn);
}
.st-body {
  display: contents;
}
.st-thumb {
  grid-column: 1;
  grid-row: 1;
  width: 50px;
  height: 34px;
  padding: 2px 3px;
  border-radius: 6px;
  background: var(--c-paper-bg);
  border: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.st-thumb.st-thumb-qr {
  width: 40px;
  height: 36px;
}
#qr .simple-type-btn {
  grid-template-columns: 40px minmax(0, 1fr);
}
.st-thumb svg {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.st-head {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.st-name {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.simple-type-btn[aria-pressed='true'] .st-name {
  color: var(--c-nav-active);
}
.st-tag {
  font-size: 12px;
  line-height: 1.25;
  color: var(--c-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-sample {
  grid-column: 1 / -1;
  grid-row: 2;
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--c-surface-subtle);
  color: var(--c-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.simple-type-btn[aria-pressed='true'] .st-sample {
  background: var(--c-card);
  color: var(--c-text);
}
.simple-other-active {
  margin: 4px 0 2px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--c-primary-soft);
  border: 1px solid var(--c-primary);
  font-size: 12.5px;
  color: var(--c-text);
}
.link-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--c-primary);
  background: none;
  border: 0;
  padding: 4px 2px;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover {
  color: var(--c-primary-d);
}
@media (max-width: 340px) {
  .simple-type-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* タッチ端末（coarse pointer）でのタップ領域確保（>= 44px） */
@media (pointer: coarse) {
  .btn,
  .seg button,
  .tabs button,
  .select-trigger {
    min-height: 44px;
  }
  .chip,
  .link-list a {
    min-height: 44px;
    padding: 8px 14px;
  }
  .check {
    min-height: 44px;
  }
  details.adv summary {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .cp-icon-btn,
  .sp-close-btn {
    width: 44px;
    height: 44px;
  }
  .sp-option {
    min-height: 44px;
  }
  .sp-peek-btn {
    min-height: 36px;
    min-width: 44px;

  .ui-mode-seg button {
    min-height: 38px;
    padding: 6px 14px;
  }
  .link-btn {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
  }
  .touch-preview-hint {
    display: block;
    margin: -6px 0 8px;
    font-size: 12px;
    color: var(--c-muted);
  }
  .chips.sym-chips + .touch-preview-hint {
    margin: 2px 0 4px;
  }
}

/* 視差・アニメーション軽減 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Windows ハイコントラスト（強制カラー）対応 */
@media (forced-colors: active) {
  .chip[aria-pressed='true'],
  .seg button[aria-pressed='true'],
  .ui-mode-seg button[aria-pressed='true'],
  .simple-type-btn[aria-pressed='true'],
  .btn.primary,
  .btn[aria-pressed='true'],
  .site-header nav a[aria-current='page'],
  .sp-option.is-active {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }
  .tabs button[aria-selected='true'] {
    border-bottom-color: Highlight;
  }
  .color-swatch,
  .cp-preset {
    forced-color-adjust: none;
  }
}

#gen:not([data-show-popular='true']) .sym-chips {
  display: none;
}

@media (max-width: 640px) {
  .wrap {
    padding: 0 14px;
  }
  .site-header nav a {
    font-size: 13.5px;
  }
  .tool,
  .card {
    max-width: 100%;
  }
  .btns .btn {
    flex: 1 1 auto;
  }
}

/* blog section */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
  margin: 20px 0 32px;
}
.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.blog-card:hover {
  border-color: var(--c-primary);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}
.blog-card-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 128px;
  padding: 16px;
  border-bottom: 1px solid var(--c-border);
  background-color: var(--c-paper-bg);
  background-image: linear-gradient(45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%), linear-gradient(-45deg, rgba(24, 32, 47, 0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%), linear-gradient(-45deg, transparent 75%, rgba(24, 32, 47, 0.06) 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0;
  text-decoration: none;
}
.blog-card-visual svg {
  display: block;
  max-width: 100%;
  max-height: 76px;
  width: auto;
  height: auto;
}
.blog-card-visual-cap {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--c-paper-muted);
}
.blog-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 16px;
  gap: 10px;
}
.blog-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--c-muted);
}
.blog-cat {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--c-primary-soft);
  color: var(--c-nav-active);
  font-weight: 700;
  font-size: 12.5px;
}
.blog-card-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.45;
}
.blog-card-title a {
  color: var(--c-text);
  text-decoration: none;
}
.blog-card-title a:hover {
  color: var(--c-primary);
  text-decoration: underline;
}
.blog-card-desc {
  margin: 0;
  font-size: 14.5px;
  color: var(--c-muted);
  line-height: 1.65;
  flex: 1;
}
.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 2px 0 0;
}
.blog-tags li {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--c-surface-subtle);
  border: 1px solid var(--c-border);
  color: var(--c-muted);
}
.blog-card-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-primary);
  text-decoration: none;
  margin-top: 2px;
}
.blog-card-more:hover {
  text-decoration: underline;
}

/* blog article page */
.blog-article-head {
  max-width: 860px;
  margin-bottom: 20px;
}
.blog-article-head .blog-meta {
  margin-top: 8px;
  margin-bottom: 6px;
}
.blog-toc {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0 28px;
}
.blog-toc-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 8px;
  color: var(--c-text);
}
.blog-toc ol {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 5px;
  font-size: 14.5px;
}
.blog-toc a {
  text-decoration: none;
}
.blog-toc a:hover {
  text-decoration: underline;
}

.blog-fig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}
.blog-fig {
  margin: 0;
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.blog-fig-canvas {
  min-height: 112px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-paper-bg);
  color: var(--c-paper-text);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.blog-fig-canvas svg {
  display: block;
  max-width: 100%;
  max-height: 92px;
  width: auto;
  height: auto;
}
.blog-fig figcaption {
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.5;
}
.blog-fig figcaption strong {
  color: var(--c-text);
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.blog-note {
  background: var(--c-surface-subtle);
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-primary);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 16px 0;
  font-size: 15px;
}
.blog-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--c-text);
}
.blog-note p {
  margin: 0;
  font-size: 14.5px !important;
}

.blog-tools-box {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 28px 0;
}
.blog-tools-box h3 {
  margin: 0 0 10px;
  font-size: 17px;
}
.blog-tools-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.blog-tools-list li a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-subtle);
  text-decoration: none;
  color: var(--c-text);
  height: 100%;
  transition: border-color 0.12s ease;
}
.blog-tools-list li a:hover {
  border-color: var(--c-primary);
}
.blog-tools-list li strong {
  display: block;
  color: var(--c-primary);
  font-size: 14.5px;
  margin-bottom: 2px;
}
.blog-tools-list li span {
  display: block;
  font-size: 13px;
  color: var(--c-muted);
  line-height: 1.45;
}