/* ツール置き場 共通デザイン */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&family=Zen+Maru+Gothic:wght@400;500;700&display=swap');
@import url('https://cdn.jsdelivr.net/npm/hack-font@3.3.0/build/web/hack.css');

:root {
  /* 主色・副色・強調 — palette.js が上書きするまでの既定値（宵闇） */
  --p1: #9184d9;
  --p2: #6b8fd9;
  --p3: #d9a05c;

  /* 無彩色ランプの既定値（宵闇相当、JS 無効時のフォールバック） */
  --bg: #18171f;
  --s1: #1f1d29;
  --s2: #131118;
  --s3: #232130;
  --s3h: #262433;
  --s4: #0e0d13;
  --rowalt: #1c1a26;
  --line: #3b3849;

  /* 文字色（パレットに依存しない） */
  --text: #e9e9ed;
  --text-2: #cfd3e5;
  --text-dim: #9397ab;
  --text-faint: #75798c;
  --text-faint2: #595d6c;
  --error: #ff8f6b;

  --font-base: 'HackGen35 Console NF', 'HackGen Console NF', 'HackGen35', 'HackGen', 'Hack', 'Zen Maru Gothic', 'Noto Sans JP', system-ui, sans-serif;
  --font-mono: 'HackGen35 Console NF', 'HackGen Console NF', 'HackGen', 'Hack', ui-monospace, Consolas, monospace;
}

* {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text-2);
  font-family: var(--font-base);
  line-height: 1.6;
}

::selection {
  background: color-mix(in srgb, var(--p1) 35%, transparent);
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--p1);
}

[hidden] {
  display: none !important;
}

/* フォーム部品は角丸なし・無彩色ランプの上で統一する */
input, textarea, select, button {
  font-family: inherit;
  border-radius: 0;
  color-scheme: dark;
}

input[type="number"], input[type="text"], select, textarea {
  background: var(--s1);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 6px 9px;
  font-size: 13px;
  outline: none;
}

input[type="number"] {
  font-family: var(--font-mono);
}

textarea {
  resize: none;
  word-break: break-all;
}

button {
  cursor: pointer;
  border: none;
  background: var(--s2);
  color: var(--text);
}

button:disabled {
  cursor: not-allowed;
  color: var(--text-faint2);
}

/* ============ ヘッダー / フッター ============ */

header.site-header,
footer.site-footer {
  display: flex;
  align-items: center;
  padding: 0 22px;
}

header.site-header {
  height: 68px;
  justify-content: space-between;
}

footer.site-footer {
  height: 40px;
  font-size: 12px;
  color: var(--text-faint);
}

footer.site-footer a {
  color: var(--text-dim);
}

.site-header__crumb {
  display: flex;
  align-items: baseline;
  gap: 11px;
  min-width: 0;
}

.site-header__home {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

a.site-header__home {
  font-size: 18px;
  font-weight: 400;
  color: var(--text-faint);
}

.site-header__sep {
  font-size: 18px;
  color: var(--line);
}

.site-header__title {
  font-size: 22px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ カラーパレットチップ ============ */

.palette-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--s2);
  padding: 6px 8px 6px 11px;
  font-size: 12px;
  color: var(--text-2);
  transition: background .16s;
}

.palette-chip:hover {
  background: var(--s3h);
}

.palette-chip__swatches {
  display: flex;
  gap: 3px;
}

.palette-chip__swatches .sw {
  width: 10px;
  height: 14px;
}

.palette-chip__swatches .sw--white { background: #eceef5; }
.palette-chip__swatches .sw--p1 { background: var(--p1); }
.palette-chip__swatches .sw--p2 { background: var(--p2); }
.palette-chip__swatches .sw--p3 { background: var(--p3); }
.palette-chip__swatches .sw--black { background: #16171d; }

/* ============ トップページ ============ */

main {
  flex: 1 1 auto;
  min-height: 0;
}

.whole-width-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.whole-width-list li {
  list-style: none;
}

.whole-width-list li a {
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--s1);
  padding: 20px 22px;
  text-decoration: none;
  color: var(--text);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.whole-width-list li a:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
  background: var(--s3h);
  color: var(--text);
}

.whole-width-list .tool-mark {
  flex: 0 0 auto;
  width: 3px;
  height: 38px;
}

.whole-width-list .tool-name {
  display: block;
  font-size: 19px;
  font-weight: 500;
}

.whole-width-list small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}

.whole-width-list .tool-slug {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-faint2);
}

/* ============ 404 ============ */

.notfound {
  flex: 1 1 auto;
  padding: 45px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.notfound__code {
  font-size: 56px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--p3);
  line-height: 1;
}

.notfound__message {
  font-size: 15px;
  margin-top: 17px;
  color: var(--text);
}

.notfound__back {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ============ ツール共通部品 ============ */

.subhead {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-dim);
}

.field-label {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}

.panel {
  background: var(--s1);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

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

.checkbox-row__box {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  background: var(--s1);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkbox-row__box .check {
  font-size: 11px;
  line-height: 1;
  color: var(--bg);
  opacity: 0;
}

.checkbox-native:checked + .checkbox-row__box {
  background: var(--p1);
  border-color: var(--p1);
}

.checkbox-native:checked + .checkbox-row__box .check {
  opacity: 1;
}

.checkbox-native:focus-visible + .checkbox-row__box {
  outline: 2px solid var(--p1);
  outline-offset: 2px;
}

/* ============ ツールシェル（1 画面完結レイアウト） ============ */

.page-pad {
  padding: 34px 45px;
}

.tool-main {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 452px;
  gap: 26px;
  padding: 8px 22px 22px;
}

.tool-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tool-field {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 0 8px;
}

.tool-field .label {
  font-size: 14px;
  letter-spacing: 0.08em;
}

.tool-field .label--p1 { color: var(--p1); }
.tool-field .label--p2 { color: var(--p2); }

.tool-field .count {
  font-size: 11px;
  color: var(--text-faint);
}

.tool-io {
  flex: 1 1 0;
  min-height: 0;
  width: 100%;
  background: var(--s1);
  color: var(--text);
  border: none;
  padding: 18px 22px;
  font-size: 17px;
  line-height: 1.8;
  resize: none;
  outline: none;
  word-break: break-all;
}

.tool-io--out {
  color: var(--p2);
  overflow: auto;
  white-space: pre-wrap;
}

.tool-note {
  flex: 0 0 auto;
  min-height: 18px;
  padding: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
}

.tool-note .warn { color: var(--p3); }
.tool-note .error { color: var(--error); }

.tool-settings {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 4px 0 18px;
}

.tool-settings .row2 {
  display: flex;
  gap: 14px;
}

.tool-settings .row2 > label {
  flex: 1 1 0;
  min-width: 0;
}

.tool-settings input[type="number"] {
  width: 100%;
  font-size: 15px;
}

.tool-settings select {
  width: 100%;
}

.tool-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.tool-btn-row button,
.tool-inline-row button.link-btn {
  padding: 7px 9px;
  font-size: 12px;
}

.btn-accent1 {
  background: color-mix(in oklab, var(--p1) 40%, var(--s2));
  color: var(--text);
}

.btn-accent1:hover:not(:disabled) {
  background: color-mix(in oklab, var(--p1) 56%, var(--s2));
}

.btn-accent2 {
  background: color-mix(in oklab, var(--p2) 40%, var(--s2));
  color: var(--text);
}

.btn-accent2:hover:not(:disabled) {
  background: color-mix(in oklab, var(--p2) 56%, var(--s2));
}

.btn-accent1:disabled,
.btn-accent2:disabled {
  background: var(--s2);
  color: var(--text-faint2);
}

.tool-inline-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.link-btn {
  background: transparent;
  color: var(--text-dim);
  border: none;
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.tool-textarea-sm {
  width: 100%;
  display: block;
  background: var(--s1);
  color: var(--text-2);
  border: 1px solid var(--line);
  padding: 9px 11px;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  word-break: break-all;
}
