/* 和紙のような余白と、墨・藍・朱・松葉の五色を基調にした静かな画面。
   レイアウトと重ね表示だけを担い、挙動やチューニング値は持たない。 */
:root {
  --paper: #efeae0;   /* 和紙（背景） */
  --sumi: #1a1a1f;    /* 墨 */
  --ai: #16407a;      /* 藍 */
  --shu: #c8372d;     /* 朱 */
  --matsuba: #2e6e52; /* 松葉 */
  --line: rgba(26, 26, 31, 0.18); /* 罫・境界の淡い線 */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--paper);
}

body {
  font-family: "Shippori Mincho", "Yu Mincho", "Hiragino Mincho ProN", serif;
  color: var(--sumi);
}

/* 墨を流す全画面キャンバス。ブラウザの既定ジェスチャは無効化する */
canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  touch-action: none;
}

/* ── 縦書きタイトル ───────────────────── */
.title {
  position: fixed;
  top: 28px;
  left: 26px;
  z-index: 5;
  pointer-events: none;
  writing-mode: vertical-rl;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.title h1 {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 700;
  letter-spacing: 0.42em;
  color: var(--sumi);
}
.title .sub {
  font-size: 11px;
  letter-spacing: 0.34em;
  color: rgba(26, 26, 31, 0.55);
  padding-top: 6px;
}
/* タイトル脇に一本の淡い罫を落とす */
.title::after {
  content: "";
  display: block;
  width: 1px;
  align-self: stretch;
  background: linear-gradient(to bottom, var(--line), transparent);
  margin-right: 2px;
}

/* ── 操作ヒント ──────────────────────── */
.hint {
  position: fixed;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  z-index: 5;
  pointer-events: none;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.46em;
  text-indent: 0.46em;
  color: rgba(26, 26, 31, 0.5);
  transition: opacity 1.6s ease;
}
.hint.gone {
  opacity: 0;
}

/* ── 下部コントロール（墨色・自動演出・洗い流す）───── */
.dock {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 12px 22px;
  background: rgba(239, 234, 224, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.inks {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* 墨だまり風の丸ボタン。選択中は外周にリングが灯る */
.ink {
  appearance: none;
  border: none;
  cursor: pointer;
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 1px 3px rgba(26, 26, 31, 0.25);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.ink:hover {
  transform: scale(1.18);
}
.ink::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.ink[aria-pressed="true"]::after {
  border-color: rgba(26, 26, 31, 0.55);
}
/* 墨色名のラベル。ホバー／選択時だけ浮かぶ */
.ink .lbl {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: rgba(26, 26, 31, 0.6);
  opacity: 0;
  transition: opacity 0.2s;
  white-space: nowrap;
  font-family: inherit;
}
.ink:hover .lbl,
.ink[aria-pressed="true"] .lbl {
  opacity: 1;
}
.ink-cycle {
  background: conic-gradient(var(--sumi), var(--ai), var(--matsuba), var(--shu), var(--sumi));
}
.ink-sumi {
  background: radial-gradient(circle at 35% 30%, #3a3a42, var(--sumi));
}
.ink-ai {
  background: radial-gradient(circle at 35% 30%, #2c62ab, var(--ai));
}
.ink-shu {
  background: radial-gradient(circle at 35% 30%, #e25a4c, var(--shu));
}
.ink-matsuba {
  background: radial-gradient(circle at 35% 30%, #4c9374, var(--matsuba));
}

.sep {
  width: 1px;
  height: 22px;
  background: var(--line);
}

/* 文字ボタン（自動演出・洗い流す）。下線が中央から伸びる */
.act {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: rgba(26, 26, 31, 0.78);
  padding: 4px 2px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.act::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -2px;
  height: 1px;
  background: var(--sumi);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.3s ease;
}
.act:hover::after {
  transform: scaleX(1);
}
.act[aria-pressed="false"] {
  color: rgba(26, 26, 31, 0.38);
}
/* 自動演出の状態灯。ONで藍色に灯る */
.act .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--ai);
  box-shadow: 0 0 6px rgba(22, 64, 122, 0.5);
  transition: background 0.3s, box-shadow 0.3s;
}
.act[aria-pressed="false"] .dot {
  background: transparent;
  box-shadow: none;
  border: 1px solid rgba(26, 26, 31, 0.35);
}

.pp-link {
  position: fixed;
  right: 22px;
  bottom: 24px;
  z-index: 5;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: rgba(26, 26, 31, 0.4);
  text-decoration: none;
  font-family: inherit;
  transition: color 0.25s ease;
}
.pp-link:hover {
  color: rgba(26, 26, 31, 0.75);
}

/* ── 和のしつらえ（装飾レイヤ。操作は妨げない）───────── */
/* 装飾は墨(canvas)の上・UI(z5,6)の下に敷く */
.paper-grain,
.vignette,
.frame {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* 和紙の地合い（ごく薄いノイズを乗算で重ねて“紙の目”を出す） */
.paper-grain {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: multiply;
}

/* 周辺減光。中央を澄ませ、四隅をわずかに沈める */
.vignette {
  background: radial-gradient(
    ellipse at center,
    transparent 52%,
    rgba(58, 48, 33, 0.12) 100%
  );
}

/* 掛軸／色紙の見立て。細い二重の枠で紙面を締める */
.frame {
  margin: 14px;
  border: 1px solid rgba(26, 26, 31, 0.16);
  border-radius: 2px;
  box-shadow: inset 0 0 0 5px rgba(239, 234, 224, 0.6),
    inset 0 0 0 6px rgba(26, 26, 31, 0.08);
}

/* 落款（朱の角印）。手押し風にわずかに傾ける */
.seal {
  position: fixed;
  left: 30px;
  bottom: 28px;
  z-index: 5;
  width: 38px;
  height: 38px;
  border-radius: 5px;
  background: var(--shu);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  transform: rotate(-3deg);
  box-shadow: 0 1px 4px rgba(26, 26, 31, 0.25), inset 0 0 0 1px rgba(239, 234, 224, 0.35);
  opacity: 0.92;
  pointer-events: none;
}

@media (max-width: 640px) {
  .frame {
    margin: 9px;
  }
  .seal {
    left: 16px;
    bottom: 20px;
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .title {
    top: 20px;
    left: 16px;
  }
  .pp-link {
    display: none;
  }
  .dock {
    gap: 12px;
    padding: 10px 14px;
  }
  .act {
    font-size: 11px;
    letter-spacing: 0.12em;
  }
  .inks {
    gap: 11px;
  }
}
