/* 白黒を基本に、ボタンなど小さな所だけピンク */
:root {
  --bg: #ffffff; --side: #f9f9f9; --panel: #ffffff; --field: #f4f4f4;
  --ink: #0d0d0d; --sub: #6b6b6b; --line: #ececec;
  --hover: rgba(0, 0, 0, .05); --active: rgba(0, 0, 0, .07);
  --pink: #e85a8e; --pink-ink: #ffffff; --pink-soft: #fbe9ef;
  --danger: #d4486f; --shadow: 0 8px 28px rgba(0, 0, 0, .12);
  --font: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #212121; --side: #181818; --panel: #2a2a2a; --field: #303030;
    --ink: #ececec; --sub: #a0a0a0; --line: #343434;
    --hover: rgba(255, 255, 255, .06); --active: rgba(255, 255, 255, .09);
    --pink: #f07aa3; --pink-ink: #2a0f1a; --pink-soft: #3a2430;
    --danger: #f07aa3; --shadow: 0 8px 28px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #212121; --side: #181818; --panel: #2a2a2a; --field: #303030;
  --ink: #ececec; --sub: #a0a0a0; --line: #343434;
  --hover: rgba(255, 255, 255, .06); --active: rgba(255, 255, 255, .09);
  --pink: #f07aa3; --pink-ink: #2a0f1a; --pink-soft: #3a2430;
  --danger: #f07aa3; --shadow: 0 8px 28px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 500 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
a { color: inherit; }
svg { display: block; }
.sym { font-family: -apple-system, "Segoe UI Symbol", system-ui, sans-serif; font-weight: 400; margin: 0 .1em; }

.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- 左のサイドバー ---------- */
.side {
  width: 280px; flex: none; display: flex; flex-direction: column; gap: 4px;
  background: var(--side); border-right: 1px solid var(--line);
  padding: 10px 8px; transition: width .2s ease; overflow: hidden;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 0 0 10px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; min-width: 0; height: 40px; padding: 0 8px; border-radius: 10px; }
.brand:hover { background: var(--hover); }
/* 左上：マーク（assets/mark.svg）をツール一覧のアイコンと同じタイルにのせ、名前は文字で */
.brand { gap: 12px; padding: 0 10px; }
.brand-mark { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 28%;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.brand-mark svg { width: 16px; height: 16px; }
.brand-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.1; white-space: nowrap; overflow: hidden; }
.brand-name small { font-size: 9px; letter-spacing: .14em; color: var(--sub); }   /* フリガナのように小さく上に */
.brand-name b { font-size: 17px; font-weight: 700; letter-spacing: .12em; }

.icon-btn {
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--sub);
  display: grid; place-items: center; cursor: pointer; flex: none; text-decoration: none;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px; }
.section-label { font-size: 12px; color: var(--sub); padding: 8px 10px 4px; white-space: nowrap; }
.side-bottom { display: flex; flex-direction: column; gap: 2px; padding-top: 6px; }

.item {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: 10px; background: transparent; text-decoration: none; cursor: pointer;
  text-align: left; width: 100%;
}
.item:hover { background: var(--hover); }
.item[aria-current="page"] { background: var(--active); }
.item .label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .mini { color: var(--sub); flex: none; }
.item .mini svg { width: 14px; height: 14px; }
.item .mini.open { color: var(--pink); }

/* アイコンは角丸の正方形のタイルにのせる（全体のルール：できるだけ正方形） */
.ic { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 28%;
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); }
.ic svg { width: 18px; height: 18px; }
.item[aria-current="page"] .ic { background: var(--ink); color: var(--bg); box-shadow: none; }

/* 言語：角丸の正方形の国旗 */
.flags { display: flex; gap: 6px; padding: 6px 4px; }
.flagbtn { width: 34px; height: 34px; border: 0; padding: 3px; border-radius: 28%; background: transparent; cursor: pointer; display: grid; place-items: center; }
.flagbtn svg { width: 28px; height: 28px; border-radius: 28%; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.flagbtn:hover { background: var(--hover); }
.flagbtn.on { box-shadow: inset 0 0 0 2px var(--pink); background: var(--pink-soft); }

/* 細くたたんだとき（パソコン） */
@media (min-width: 768px) {
  .app.collapsed .side { width: 64px; }
  .app.collapsed .side-top { flex-direction: column; }
  .app.collapsed .brand { padding: 0; width: 40px; justify-content: center; }
  /* たたむのはサイドバーの中だけ（右の「どのツール？」の一覧は名前を出したまま） */
  .app.collapsed .brand-name,
  .app.collapsed .side .label,
  .app.collapsed .side .mini,
  .app.collapsed .section-label { display: none; }
  .app.collapsed .side .item { justify-content: center; padding: 0; }
  .app.collapsed .flags { justify-content: center; }
  .app.collapsed .flagbtn:not(.on) { display: none; }
  .menu-btn { display: none; }
  .scrim { display: none; }
}

/* ---------- 右のワークスペース ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.bar { height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 16px; }
.bar.tool { border-bottom: 1px solid var(--line); }
.bar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; font-weight: 700; }
.bar-title span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


.stage { flex: 1; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; overflow: auto; }
#frames iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }

/* ---------- 何も選んでいないとき：プルダウンだけ ---------- */
.pick { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px 16px 18vh; }
.pick h1 { margin: 0; font-size: clamp(22px, 3.2vw, 28px); font-weight: 500; text-align: center; }
.dd { position: relative; width: min(420px, 100%); }
.dd-btn {
  width: 100%; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 18px 0 20px;
  border: 1px solid var(--line); border-radius: 28px; background: var(--panel); cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05); color: var(--sub); font-size: 16px;
}
.dd-btn:hover { border-color: var(--sub); }
.dd-btn .grow { flex: 1; text-align: left; }
.dd-btn .chev svg { width: 18px; height: 18px; transition: transform .2s; }
.dd-btn[aria-expanded="true"] .chev svg { transform: rotate(180deg); }
.dd-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 10; margin: 0; padding: 6px; list-style: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
}
.dd-list .item { min-height: 48px; }
.dd-list .item:focus-visible { outline: 2px solid var(--pink); outline-offset: -2px; }

.about-link {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; margin-top: -8px;
  border: 0; border-radius: 18px; background: none; color: var(--sub); font: inherit; font-size: 14px; cursor: pointer;
}
.about-link:hover { background: var(--hover); color: var(--ink); }
.about-link svg { width: 15px; height: 15px; }

/* ---------- 合言葉（ポップアップ） ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .35); }
.modal-card {
  position: relative; width: 100%; max-width: 480px; padding: 32px 24px 20px; text-align: center;
  background: var(--panel); border-radius: 22px; box-shadow: var(--shadow); animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal-x { position: absolute; top: 10px; right: 10px; }
.lock-badge { position: relative; width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; border: 1.5px solid var(--line); }
.lock-badge > .ic { width: 32px; height: 32px; background: none; box-shadow: none; }
.lock-badge > .ic svg { width: 32px; height: 32px; }
.lock-badge .pin {
  position: absolute; right: -10px; bottom: -10px; width: 30px; height: 30px; border-radius: 28%;
  background: var(--pink); color: var(--pink-ink); display: grid; place-items: center;
}
.lock-badge .pin svg { width: 16px; height: 16px; }
.modal-card h2 { margin: 0 0 6px; font-size: 20px; }
.modal-card .lead { margin: 0 auto 20px; color: var(--sub); font-size: 14px; max-width: 380px; }

.about-mark {
  width: 64px; height: 64px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 28%;
  background: var(--panel); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink);
}
.about-mark svg { width: 34px; height: 34px; }
.about-card .lead { margin-bottom: 12px; text-align: left; }
.prompt-box { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--field); text-align: left; }
.prompt-box p { margin: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.7; user-select: all; -webkit-user-select: all; }

.steps { display: grid; gap: 10px; text-align: left; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.step-num {
  width: 30px; height: 30px; border-radius: 28%; flex: none; display: grid; place-items: center;
  background: var(--pink-soft); color: var(--pink); font-weight: 700;
}
.step-body { flex: 1; min-width: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.step-body > * { flex: 1 1 150px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 16px;
  border-radius: 12px; border: 0; background: var(--pink); color: var(--pink-ink);
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn svg { width: 19px; height: 19px; }
.btn.ghost { background: var(--panel); color: var(--sub); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); filter: none; }

.field {
  height: 44px; min-width: 0; border-radius: 12px; border: 1px solid var(--line); background: var(--field);
  color: var(--ink); padding: 0 14px; font: inherit;
}
.field:focus { outline: 2px solid var(--pink); outline-offset: 0; border-color: transparent; }
.hint { min-height: 1.4em; margin: 8px 0 0; font-size: 13px; color: var(--danger); text-align: center; }

.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700;
  transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- スマホ：サイドバーは引き出し ---------- */
@media (max-width: 767px) {
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(280px, 85vw);
    transform: translateX(-100%); transition: transform .25s ease;
    padding-top: max(10px, env(safe-area-inset-top));
  }
  .app.nav-open .side { transform: none; box-shadow: var(--shadow); }
  .collapse-btn { display: none; }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .bar { padding-left: 6px; }
}

/* 画像をツールに引っぱってきている間：サイト全体を少しグレーにして、まんなかに画像を足すアイコン（assets/app.js） */
.dropcover { position: fixed; inset: 0; z-index: 200; background: rgba(40, 40, 40, .32); display: grid; place-items: center; pointer-events: none; }
.dropcover[hidden] { display: none; }
.dropcover span { width: 132px; height: 132px; border-radius: 28%; background: var(--panel); color: var(--pink); display: grid; place-items: center; box-shadow: var(--shadow); border: 3px dashed var(--pink); }
.dropcover svg { width: 68px; height: 68px; }
