:root {
  color-scheme: light;
  --ink: #152720;
  --muted: #55685e;
  --accent: #146c56;
  --accent-hover: #0d5543;
  --accent-light: #e6f4ec;
  --border: #d9e4dc;
  --panel: #fff;
  --page: #f2f6f2;
  --code: #172a24;
  font-family: Inter, "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, label[for], select { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: default; opacity: .55; pointer-events: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #317e65; outline-offset: 3px; }
.symbol-sheet { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.masthead { border-bottom: 1px solid var(--border); background: #fcfdfb; }
.masthead-inner { max-width: 1400px; margin: auto; padding: 16px 40px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; color: var(--ink); gap: 10px; align-items: center; text-decoration: none; font-size: 24px; letter-spacing: -.07em; font-weight: 500; white-space: nowrap; }
.brand strong { font-weight: 800; }
.privacy { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 7px; }
.privacy .icon { width: 17px; height: 17px; color: var(--accent); }

.layout { max-width: 1400px; padding: 36px 40px 54px; margin: auto; display: grid; grid-template-columns: 204px minmax(0, 1fr); gap: 42px; }
.tool-nav { align-self: start; position: sticky; top: 24px; }
.tool-nav-group + .tool-nav-group { margin-top: 32px; }
.nav-label { margin: 0 0 10px; padding-left: 14px; color: var(--muted); font-size: 12px; font-weight: 700; }
.tool-nav a { display: flex; gap: 10px; align-items: center; padding: 11px 13px; min-height: 44px; margin-bottom: 4px; color: #40564a; border: 1px solid transparent; border-radius: 10px; text-decoration: none; white-space: nowrap; font-size: 14px; font-weight: 650; }
.tool-nav a .icon { width: 18px; height: 18px; }
.tool-nav a:hover { background: #eaf1eb; }
.tool-nav [aria-current="page"] { color: #105a47; background: #e0efe5; border-color: #cce4d5; }
.tool-nav [aria-current="page"] .icon { color: var(--accent); }

.tool-heading { margin: 6px 0 27px; }
.tool-heading h1 { margin: 0; font-size: clamp(26px, 2.65vw, 40px); letter-spacing: -.049em; line-height: 1.26; font-weight: 800; }
.tool-heading p { margin: 9px 0 0; color: var(--muted); font-size: 14px; }
.editor-grid, .preview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(244px, 298px); gap: 20px; align-items: start; }
.preview-grid { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); }
.card { min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 17px; box-shadow: 0 2px 3px #142f2310; overflow: hidden; }
.card-bar { min-height: 61px; padding: 13px 17px; border-bottom: 1px solid #edf1ed; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-bar h2 { margin: 0; font-size: 15px; font-weight: 750; letter-spacing: .005em; }
.card-bar .text-button { white-space: nowrap; }
.editor-meta { min-height: 18px; color: var(--muted); margin: 0; padding: 12px 17px; min-width: 0; overflow-wrap: anywhere; font-size: 12px; }

.image-viewport { margin: 16px; min-height: 375px; padding: 18px; background: #f8faf7; border: 1px dashed #9ab5a8; border-radius: 12px; display: grid; place-items: center; }
.image-viewport:has(canvas:not([hidden])) { min-height: 360px; border-style: solid; border-color: #e2ebe4; padding: 10px; background: #edf2ed; }
.image-viewport canvas { display: block; max-width: 100%; max-height: 520px; object-fit: contain; touch-action: none; border-radius: 5px; }
.image-viewport:is(.dragging, .drag-over, [data-dragging="true"]) { outline: 2px solid var(--accent); background: var(--accent-light); }
.image-work:not(:has(canvas:not([hidden]))) .replace-image { visibility: hidden; }
.image-work:not(:has(canvas:not([hidden]))) .editor-meta { display: none; }
.image-viewport.has-source .upload-empty { display: none; }
.upload-empty { text-align: center; padding: 28px 12px; }
.upload-mark { display: inline-grid; place-items: center; width: 52px; height: 52px; background: #e4f1e9; color: var(--accent); border-radius: 14px; margin: 0 0 9px; }
.upload-mark .icon { width: 25px; height: 25px; }
.upload-empty h3 { margin: 0; line-height: 1.3; font-size: 22px; font-weight: 800; letter-spacing: -.038em; }
.upload-empty p { margin: 7px 0 18px; font-size: 12px; color: var(--muted); }
.sample { display: block; margin: 11px auto 0; }
.file-input { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
.image-work:has(.file-input:focus-visible) label[for="image-file"],
.preview-code:has(.file-input:focus-visible) label[for] { outline: 2px solid var(--accent); outline-offset: 3px; }

.settings-body, .code-body { padding: 16px; }
.output-fields { border-top: 1px solid #e8efea; padding-top: 14px; margin-top: 15px; }
.output-fields:first-child, [data-image-mode-panel][hidden] + .output-fields { margin-top: 0; }
.image-tools:has([data-image-mode-panel="crop"][hidden]):has([data-image-mode-panel="resize"][hidden]) .output-fields { border-top: 0; padding-top: 0; }
.field { display: grid; gap: 6px; min-width: 0; color: #365045; font-size: 12px; font-weight: 680; margin: 0 0 12px; }
.field input, .field select, .compact-field select { width: 100%; min-width: 0; min-height: 40px; border: 1px solid #cfded4; border-radius: 8px; padding: 7px 10px; color: var(--ink); background: #fbfdfb; font-size: 14px; }
.field input:disabled { opacity: .6; }
.fields-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.hint { margin: -3px 0 16px; color: var(--muted); font-size: 11px; }
.button { min-height: 40px; padding: 8px 13px; border: 1px solid transparent; border-radius: 8px; font-weight: 740; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; line-height: 1.25; text-decoration: none; white-space: nowrap; }
.button .icon { width: 16px; height: 16px; }
.primary { color: #fff; background: var(--accent); }
.primary:hover { background: var(--accent-hover); }
.secondary { color: var(--accent); border-color: #d2e2d9; background: #f6fbf7; }
.secondary:hover, .secondary[aria-pressed="true"] { background: #dfefe5; border-color: #adcbb9; }
.full { width: 100%; }
.text-button { display: inline-block; padding: 2px; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 700; }
.text-button:hover { text-decoration: underline; }
.status { color: #475c50; margin: 10px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.status:empty { display: none; }
.status:is(.error, [data-state="error"], [data-kind="error"]) { color: #a92b39; }
.result { margin-top: 20px; }
.result:not(:has(.result-image:not([hidden]))) { display: none; }
.result-image { max-width: calc(100% - 32px); max-height: 470px; display: block; margin: 16px auto 0; object-fit: contain; }

.preview-code textarea {
  width: 100%;
  min-height: 350px;
  padding: 13px 12px;
  resize: vertical;
  color: #eefbf3;
  background: var(--code);
  border: 1px solid #28463b;
  border-radius: 8px;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.65;
  tab-size: 2;
  display: block;
}
.preview-code textarea::placeholder { color: #aaC1b5; }
.code-body .text-button { margin-top: 10px; }
.html-code textarea { min-height: 148px; }
.html-code .field:first-child textarea { min-height: 215px; }
.html-code .text-button { margin-top: 0; }
.preview-options { display: flex; padding: 12px 15px; gap: 10px; border-bottom: 1px solid #eaf0eb; align-items: center; flex-wrap: wrap; }
.compact-field { display: flex; color: #365045; font-size: 12px; align-items: center; gap: 5px; white-space: nowrap; }
.compact-field select { min-height: 33px; min-width: 62px; padding: 4px 6px; }
.compact-field input { accent-color: var(--accent); max-width: 90px; }
.compact-field output { min-width: 34px; text-align: right; }
.svg-viewport, .html-viewport { margin: 14px; min-height: 340px; height: 360px; border: 1px solid var(--border); border-radius: 9px; overflow: auto; }
.svg-viewport { display: flex; background: white; }
.svg-viewport img { max-width: none; flex: none; margin: auto; display: block; }
.svg-viewport[data-background="dark"] { background: #172720; }
.svg-viewport[data-background="checker"] {
  background-color: #f8fbf8;
  background-image: conic-gradient(#e6eee8 25%, transparent 0 50%, #e6eee8 0 75%, transparent 0);
  background-size: 22px 22px;
}
.html-viewport { padding: 0; background: #e9f0ea; height: 434px; }
.html-viewport iframe { display: block; width: 100%; max-width: none; min-height: 100%; height: 100%; border: 0; background: white; }
.viewport-options .button { font-size: 12px; min-height: 32px; padding: 5px 8px; }

@media (max-width: 1070px) {
  .masthead-inner { padding-inline: 24px; }
  .layout { padding-inline: 24px; grid-template-columns: 168px minmax(0, 1fr); gap: 25px; }
  .editor-grid { grid-template-columns: minmax(0, 1fr) minmax(215px, 250px); gap: 14px; }
}
@media (max-width: 820px) {
  .layout { display: block; padding-top: 0; }
  .tool-nav { position: static; display: flex; gap: 5px; margin: 11px -24px 21px; padding: 0 24px 5px; overflow-x: auto; scrollbar-width: thin; }
  .tool-nav-group { display: contents; }
  .nav-label { display: none; }
  .tool-nav a { padding: 8px 11px; flex: none; font-size: 13px; min-height: 40px; }
  .tool-heading { margin-bottom: 19px; }
}
@media (max-width: 590px) {
  :root { font-size: 14px; }
  .masthead-inner { padding: 12px 15px; }
  .brand { font-size: 21px; }
  .brand img { width: 31px; height: 31px; }
  .privacy { font-size: 10px; gap: 4px; }
  .privacy .icon { width: 14px; height: 14px; }
  .layout { padding: 0 14px 30px; }
  .tool-nav { margin-inline: -14px; padding-inline: 14px; }
  .tool-heading h1 { font-size: 26px; }
  .tool-heading p { font-size: 13px; }
  .editor-grid, .preview-grid { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .card-bar { min-height: 52px; }
  .image-viewport, .image-viewport:has(canvas:not([hidden])) { min-height: 240px; margin: 11px; }
  .image-viewport canvas { max-height: 340px; }
  .preview-code textarea { min-height: 180px; }
  .html-code .field:first-child textarea { min-height: 155px; }
  .html-code textarea { min-height: 100px; }
  .svg-viewport { min-height: 240px; height: 260px; }
  .html-viewport { min-height: 300px; height: 340px; }
}
