:root {
  color: #2a2118;
  background: #d5e2d8;
  font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(255, 255, 255, 0.55), transparent 60%),
    #d5e2d8;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible { outline: 3px solid #0f6b4c; outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 20px 48px; }

.top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 18px; }

.brand-mark {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 2px solid #9d3422;
  border-radius: 50%;
  color: #9d3422;
  background: #fffaf2;
  font-family: "Yu Mincho", "Noto Serif JP", "Yu Gothic", serif;
  font-size: 28px;
}

.eyebrow { margin: 0; color: #5e5346; letter-spacing: 0.08em; font-size: 13px; }

h1, h2, legend { font-family: "Yu Mincho", "Noto Serif JP", "Yu Gothic", serif; font-weight: 600; }

h1 { margin: 0; font-size: 34px; letter-spacing: 0.06em; line-height: 1.2; }

h2 { margin: 0 0 8px; font-size: 22px; }

.lead { margin: 8px 0 0; max-width: 68ch; }

.banner, .note {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: #fff4d8;
  border: 1px solid #e2c98a;
  border-radius: 8px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel, .preview-panel {
  background: #fffaf2;
  border: 1px solid #eadfce;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(60, 40, 20, 0.06);
}

.panel { padding: 16px; }

.preview-panel { position: sticky; top: 16px; padding: 16px; }

fieldset {
  border: 1px solid #eadfce;
  border-radius: 12px;
  margin: 0 0 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.55);
}

legend { padding: 0 6px; }

.grid-2, .grid-3 { display: grid; gap: 10px; }

.grid-2 { grid-template-columns: 1fr 1fr; }

.grid-3 { grid-template-columns: 1.3fr 1fr 0.8fr; }

.field { display: grid; gap: 4px; margin-top: 10px; font-size: 14px; color: #5e5346; }

.field input, .field select, .field textarea, .inline input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e0d3c3;
  border-radius: 8px;
  background: #fff;
  color: #2a2118;
}

.field textarea { resize: vertical; min-height: 6em; }

.hint { margin: 8px 0 0; color: #5e5346; font-size: 14px; }

.hint.is-error, .status.is-error { color: #9d3422; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.tabs button {
  border: 1px solid #e0d3c3;
  background: transparent;
  border-radius: 999px;
  padding: 8px 16px;
}

.tabs button[aria-selected="true"] {
  background: #9d3422;
  color: #fff;
  border-color: #9d3422;
}

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

#certLooks, #cardFrames {
  max-height: 320px;
  overflow-y: scroll;
  align-content: start;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.texts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  max-height: 280px;
  overflow-y: scroll;
  align-content: start;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.texts button {
  text-align: left;
  border: 1px solid #e0d3c3;
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
}

.texts button.is-selected {
  border-color: #9d3422;
  background: #fff4ee;
}

.texts .text-name { display: block; font-weight: 600; font-size: 14px; color: #2a2118; }

.texts .text-sample {
  display: block;
  color: #5e5346;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #c8b8a4;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}

.image-preview {
  width: 84px;
  height: 84px;
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0d3c3;
  background: #fff;
}

.image-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.look {
  display: grid;
  grid-template-columns: 36px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e0d3c3;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  position: relative;
}

.look input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.look.is-selected { border-color: #9d3422; box-shadow: inset 0 0 0 1px #9d3422; }

.look:focus-within { outline: 3px solid #0f6b4c; outline-offset: 2px; }

.swatch { width: 36px; height: 36px; border-radius: 6px; grid-row: span 2; border: 1px solid rgba(0, 0, 0, 0.08); }

.look-name { font-size: 15px; color: #2a2118; }

.look-note { font-size: 12px; color: #5e5346; }

.swatch-classic { background: #fbf6ea; box-shadow: inset 0 0 0 3px #8a6232; }
.swatch-navy { background: #1e3a5f; }
.swatch-soft { background: #ffe1dc; }
.swatch-clean { background: #fff; border-color: #2a2118; }
.swatch-sakura { background: #f8d5de; }
.swatch-green { background: #d5ebdf; }
.swatch-ume { background: #f3c1c6; box-shadow: inset 0 0 0 3px #8e1d2c; }
.swatch-wave { background: #d5e4f5; box-shadow: inset 0 0 0 3px #1d4e89; }
.swatch-asanoha { background: #f3e6d4; box-shadow: inset 0 0 0 3px #6b4a2b; }
.swatch-shippo { background: #e5f0ec; box-shadow: inset 0 0 0 3px #3d6b62; }
.swatch-star { background: #ffe7b3; box-shadow: inset 0 0 0 3px #c4552a; }
.swatch-book { background: #efe6d4; box-shadow: inset 0 0 0 3px #3a3f55; }
.swatch-sun { background: #ffe8a3; box-shadow: inset 0 0 0 3px #e0a100; }
.swatch-lattice {
  background:
    repeating-linear-gradient(90deg, #faf8f5 0 4px, #4a4038 4px 5px),
    repeating-linear-gradient(#faf8f5 0 4px, #4a4038 4px 5px);
}
.swatch-ribbon { background: #f8d5df; box-shadow: inset 0 0 0 3px #7a2e4a; }
.swatch-momiji { background: #f6c7b0; box-shadow: inset 0 0 0 3px #c24520; }
.swatch-snow { background: #e7f1f8; box-shadow: inset 0 0 0 3px #6d8eae; }
.swatch-houou { background: #fbf6ea;box-shadow:inset 0 0 0 3px #b8893b; }
.swatch-hououred { background: #fffaf0;box-shadow:inset 0 0 0 3px #8e1d2c; }
.swatch-tsuru { background: #fbfaf6;box-shadow:inset 0 0 0 3px #c9a463; }
.swatch-kiku { background: #fdf3c4;box-shadow:inset 0 0 0 3px #a47a36; }
.swatch-karakusa { background: #dfe7f5;box-shadow:inset 0 0 0 3px #1e3a6b; }
.swatch-guillochegreen { background: #e3f1e8;box-shadow:inset 0 0 0 3px #2f6b4f; }
.swatch-guillocheblue { background: #e3eef8;box-shadow:inset 0 0 0 3px #1d4e89; }
.swatch-laurel { background: #fbf6ea;box-shadow:inset 0 0 0 3px #d9b45a; }
.swatch-baroque { background: #fdf8f2;box-shadow:inset 0 0 0 3px #6e1a2c; }
.swatch-kinnijuu { background: #fbf6ea; box-shadow: inset 0 0 0 3px #b8893b; }
.swatch-kinkonkaku { background: #fbf6ea; box-shadow: inset 0 0 0 3px #b8893b; }
.swatch-kinkado { background: #fbf6ea; box-shadow: inset 0 0 0 3px #b8893b; }
.swatch-kinmaru { background: #fbf6ea; box-shadow: inset 0 0 0 3px #b8893b; }
.swatch-kinkarakusa { background: #fbf6ea; box-shadow: inset 0 0 0 3px #b8893b; }
.swatch-kinhishi { background: #fbf6ea; box-shadow: inset 0 0 0 3px #b8893b; }
.swatch-konnijuu { background: #fbfcfe; box-shadow: inset 0 0 0 3px #1e3a6b; }
.swatch-shunijuu { background: #fffaf6; box-shadow: inset 0 0 0 3px #9a1c2c; }
.swatch-kazarikin { background: #fbf6ea; box-shadow: inset 0 0 0 3px #c9a463; }
.swatch-saimonkon { background: #fbfcfe; box-shadow: inset 0 0 0 3px #2f5290; }
.swatch-saimonaka { background: #fffaf6; box-shadow: inset 0 0 0 3px #9a3248; }
.swatch-saimonkin { background: #fdf8ec; box-shadow: inset 0 0 0 3px #b8893b; }
.swatch-hououmark { background: #fbf6ea; box-shadow: inset 0 0 0 3px #c99a43; }
.swatch-sumi { background: #f6f4f0; box-shadow: inset 0 0 0 3px #1c1c1c; }
.swatch-frame-plain { background: #fff; box-shadow: inset 0 0 0 2px #2a2118; }
.swatch-frame-round { background: #f6d2c4; border-radius: 10px; }
.swatch-frame-circle { background: #f6d2c4; border-radius: 50%; box-shadow: inset 0 0 0 3px #c6a15b; }
.swatch-frame-gold { background: linear-gradient(145deg, #f8e7c0, #8a6232); }
.swatch-frame-silver { background: linear-gradient(145deg, #fff, #6d7680); }
.swatch-frame-wood { background: repeating-linear-gradient(90deg, #8a5a32 0 3px, #c48955 3px 6px, #6e4524 6px 8px); }
.swatch-frame-washi { background: #fbf6ea; box-shadow: inset 0 0 0 3px #b6402c, inset 0 0 0 6px #fbf6ea, inset 0 0 0 8px #e2c9a0; }
.swatch-frame-navy { background: #1e3a5f; box-shadow: inset 0 0 0 3px #c6a15b; }
.swatch-frame-sakura { background: #fff; box-shadow: inset 0 0 0 3px #d4637a; }
.swatch-frame-green { background: #f5faf6; box-shadow: inset 0 0 0 3px #2f6b4f; }
.swatch-frame-polaroid { background: linear-gradient(#ddd 0 70%, #fff 70%); }
.swatch-frame-stamp { background: #fffef8; border: 2px dashed #c4552a; }
.swatch-frame-film { background: #1c1c1c; box-shadow: inset 6px 0 #f4f4f4, inset -6px 0 #f4f4f4; }
.swatch-frame-arch { background: #f8e7c0; border-radius: 18px 18px 4px 4px; box-shadow: inset 0 0 0 3px #8a6232; }
.swatch-frame-heart { background: #e07a8a; clip-path: polygon(50% 86%, 16% 54%, 8% 32%, 24% 12%, 50% 28%, 76% 12%, 92% 32%, 84% 54%); border: 0; }
.swatch-frame-seal { background: radial-gradient(circle, #fff8e8 52%, #c6a15b 54% 70%, #8a6232 72% 86%, transparent 88%); border-radius: 50%; }
.swatch-frame-ribbon { background: #fff; box-shadow: inset 0 0 0 3px #b6405c, inset 0 0 0 6px #fff, inset 0 0 0 8px #f4d27a; }
.swatch-frame-ticket { background: #1e3a5f; clip-path: polygon(8% 0, 92% 0, 100% 12%, 100% 38%, 92% 50%, 100% 62%, 100% 88%, 92% 100%, 8% 100%, 0 88%, 0 62%, 8% 50%, 0 38%, 0 12%); }
.swatch-frame-snow { background: #f7fbff; box-shadow: inset 0 0 0 3px #6d8eae; }
.swatch-frame-sun { border-radius: 50%; background: conic-gradient(#f0b429 0 10%, #fff6d8 0 18%, #e09000 0 28%, #fff6d8 0 36%, #f0b429 0 46%, #fff6d8 0 54%, #e09000 0 64%, #fff6d8 0 72%, #f0b429 0 82%, #fff6d8 0 90%, #e09000 0 100%); }
.swatch-washi { background: linear-gradient(transparent 38%, #d97b8b 38% 62%, transparent 62%) center / 70% 100% no-repeat, #fff8f3; box-shadow: inset 0 0 0 3px #e3a3ad; }
.swatch-balloon { background: linear-gradient(transparent 38%, #ec8b78 38% 62%, transparent 62%) center / 70% 100% no-repeat, #fffaf4; box-shadow: inset 0 0 0 3px #f0b6a6; }
.swatch-sky { background: linear-gradient(transparent 38%, #5d9bd1 38% 62%, transparent 62%) center / 70% 100% no-repeat, #f4f9fe; box-shadow: inset 0 0 0 3px #9cc3e2; }
.swatch-flower { background: linear-gradient(transparent 38%, #c97f98 38% 62%, transparent 62%) center / 70% 100% no-repeat, #fffaf8; box-shadow: inset 0 0 0 3px #d9a3b5; }
.swatch-bow { background: linear-gradient(transparent 38%, #e07d93 38% 62%, transparent 62%) center / 70% 100% no-repeat, #fff7f7; box-shadow: inset 0 0 0 3px #eab0bd; }
.swatch-clover { background: linear-gradient(transparent 38%, #6fa660 38% 62%, transparent 62%) center / 70% 100% no-repeat, #f6fbf2; box-shadow: inset 0 0 0 3px #a9c99a; }
.swatch-board-plain { background: #fff; box-shadow: inset 0 0 0 3px #2a5d8f; }
.swatch-board-navy { background: #163a66; box-shadow: inset 0 0 0 3px #e6c36a; }
.swatch-board-green { background: #1c5a42; box-shadow: inset 0 0 0 3px #f0d48a; }
.swatch-board-chalk { background: #243f38; box-shadow: inset 0 0 0 3px #f3e27a; }
.swatch-board-pop { background: #fff6ea; box-shadow: inset 0 0 0 3px #e07a3d; }
.swatch-board-sakura { background: #fff3f5; box-shadow: inset 0 0 0 3px #d4637a; }
.swatch-board-sky { background: #eef6fc; box-shadow: inset 0 0 0 3px #3a87c8; }
.swatch-board-lemon { background: #fffbe0; box-shadow: inset 0 0 0 3px #e0a400; }
.swatch-board-custom { background: conic-gradient(#e07a3d, #e0a400, #2f8f5b, #3a87c8, #7a5cc8, #d4637a, #e07a3d); box-shadow: inset 0 0 0 3px #fff; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 8px; }
.color-row input[type="color"] { width: 44px; height: 30px; padding: 0 2px; border-radius: 6px; cursor: pointer; }
#boardGrid input { width: 4.5em; }
#boardTimeWrap .table-wrap { overflow-x: auto; }

.checks { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }

.inline { display: inline-flex; gap: 6px; align-items: center; }

.inline input[type="number"] { width: 4.2em; }

.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.row-actions button, .backup button, .text-btn {
  background: #fff;
  border: 1px solid #c8b8a4;
  border-radius: 8px;
  padding: 7px 10px;
}

.table-wrap { overflow-x: auto; margin-top: 8px; }

.roster { width: 100%; border-collapse: collapse; }

.roster th { text-align: left; font-size: 13px; color: #5e5346; font-weight: 600; padding: 4px; }

.roster td { padding: 3px 4px; vertical-align: middle; }

.roster input[type="text"], .roster input:not([type="checkbox"]) {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #e0d3c3;
  border-radius: 6px;
  background: #fff;
}

.roster .mo, .roster .dy { width: 3.4em; }

.roster input[type="checkbox"] { width: 18px; height: 18px; }

.del { background: transparent; border: 0; color: #9d3422; padding: 6px; }

.backup { padding-top: 4px; }

#previewHolder {
  overflow: auto;
  max-height: calc(100vh - 280px);
  min-height: 220px;
  margin: 10px 0;
  padding: 12px 8px;
  background: #c5d4c8;
  border-radius: 12px;
  display: flex;
  justify-content: center;
}

#preview {
  border: 0;
  display: block;
  background: transparent;
}

.pdf-btn {
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 4px;
  background: #9d3422;
  color: #fff;
  font-size: 18px;
  letter-spacing: 0.08em;
}

.pdf-btn:disabled { background: #c8b8ae; cursor: not-allowed; }

.status { min-height: 1.5em; margin: 10px 0 0; word-break: break-all; }

.status.is-ok { color: #0f6b4c; }

@media (max-width: 960px) {
  .layout, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .panel, .preview-panel, #previewHolder { min-width: 0; max-width: 100%; }
  .preview-panel { position: static; }
  h1 { font-size: 28px; }
}
.swatch-star { background: radial-gradient(circle at 30% 35%, #e9c46a 0 2px, transparent 3px), radial-gradient(circle at 70% 65%, #e9c46a 0 2px, transparent 3px), linear-gradient(transparent 38%, #3f6db3 38% 62%, transparent 62%) center / 70% 100% no-repeat, #fbfaf4; box-shadow: inset 0 0 0 3px #e9c46a; }
.swatch-wa { background: radial-gradient(circle at 50% 100%, #7f9fc2 0 30%, #fff 30% 42%, #7f9fc2 42% 54%, transparent 54%) 0 0 / 12px 6px, linear-gradient(transparent 38%, #c0504d 38% 62%, transparent 62%) center / 70% 100% no-repeat, #fbf8f1; box-shadow: inset 0 0 0 3px #7f9fc2; }
.swatch-candy { background: repeating-linear-gradient(135deg, #fbd5df 0 4px, #fffdf9 4px 8px, #cdeee2 8px 12px, #fffdf9 12px 16px); box-shadow: inset 0 0 0 3px #f2b3c3; }

.seatgrid td { padding: 2px; position: relative; min-width: 64px; }
.seatgrid td small { position: absolute; left: 4px; top: 1px; font-size: 10px; color: #7a6a5a; pointer-events: none; }
.seatgrid td input { width: 100%; padding-top: 12px; text-align: center; font-size: 13px; }
.seatgrid td.picked { outline: 3px solid #0f6b4c; }
.swatch-ocean { background: linear-gradient(transparent 60%,#b9e1f0 60%),#e3f4fb;box-shadow:inset 0 0 0 3px #3f9bc4; }
.swatch-forest { background: #e1f0d8;box-shadow:inset 0 0 0 3px #5f9e57; }
.swatch-rainbow { background: linear-gradient(90deg,#ef6f6c,#f5a45b,#f6d65e,#7fc47f,#6aa9e0,#9b86d6);box-shadow:inset 0 0 0 3px #fff; }
.swatch-space { background: radial-gradient(circle at 30% 30%,#fff 0 1px,transparent 2px),#1d2347;box-shadow:inset 0 0 0 3px #f6d56a; }
.swatch-animal { background: #fde9d2;box-shadow:inset 0 0 0 3px #e5b88f; }
.swatch-gold { background: #fdf8ec;box-shadow:inset 0 0 0 2px #b8893b,inset 0 0 0 4px #fdf8ec,inset 0 0 0 5px #c9a463; }
.swatch-chalk { background: #27463c;box-shadow:inset 0 0 0 3px #cfd9d2; }
.swatch-dots { background: radial-gradient(circle,#f9d1dc 0 2px,transparent 2.5px) 0 0/8px 8px,#fff;box-shadow:inset 0 0 0 3px #f2a7b8; }
.swatch-sports { background: #d9ecce;box-shadow:inset 0 0 0 3px #4c9a5a; }
.swatch-music { background: repeating-linear-gradient(transparent 0 4px,#cfc4ec 4px 5px),#faf7ff;box-shadow:inset 0 0 0 3px #b8a8e0; }
.swatch-gingham { background: repeating-linear-gradient(90deg,rgba(233,160,168,.5) 0 4px,transparent 4px 8px),repeating-linear-gradient(rgba(233,160,168,.5) 0 4px,transparent 4px 8px),#fff;box-shadow:inset 0 0 0 3px #e9a0a8; }
.swatch-nordic { background: #fbf7ee;box-shadow:inset 0 0 0 3px #e8a898; }
.swatch-th-none { background: #fff;box-shadow:inset 0 0 0 2px #cfc6b8; }
.swatch-th-spring { background: radial-gradient(circle at 20% 25%,#f2a5b8 0 3px,transparent 4px),radial-gradient(circle at 80% 75%,#f2a5b8 0 3px,transparent 4px),#fff5f7;box-shadow:inset 0 0 0 2px #e07b95; }
.swatch-th-summer { background: radial-gradient(circle at 25% 28%,#f6c445 0 4px,transparent 5px),radial-gradient(circle at 78% 72%,#f6c445 0 4px,transparent 5px),#fffbe6;box-shadow:inset 0 0 0 2px #e8a000; }
.swatch-th-autumn { background: radial-gradient(circle at 25% 28%,#d2552a 0 4px,transparent 5px),radial-gradient(circle at 78% 72%,#e8a53c 0 4px,transparent 5px),#fff6ea;box-shadow:inset 0 0 0 2px #d2552a; }
.swatch-th-winter { background: radial-gradient(circle at 25% 28%,#fff 0 4px,transparent 5px),radial-gradient(circle at 78% 72%,#fff 0 4px,transparent 5px),#cfe2f4;box-shadow:inset 0 0 0 2px #5d97cf; }
.swatch-th-sea { background: repeating-radial-gradient(circle at 50% 120%,#b9e1f0 0 4px,#e3f4fb 4px 6px);box-shadow:inset 0 0 0 2px #2f95c4; }
.swatch-th-forest { background: linear-gradient(#f3faee 60%,#a9d79e 60%);box-shadow:inset 0 0 0 2px #5f9e57; }
.swatch-th-space { background: radial-gradient(circle at 30% 30%,#fff 0 1px,transparent 2px),radial-gradient(circle at 70% 70%,#f6d56a 0 2px,transparent 3px),#1d2347;box-shadow:inset 0 0 0 2px #f6d56a; }
.swatch-th-rainbow { background: linear-gradient(90deg,#ef6f6c,#f5a45b,#f6d65e,#7fc47f,#6aa9e0,#9b86d6); }
.swatch-th-animal { background: radial-gradient(circle at 50% 60%,#c98a5e 0 6px,transparent 7px),#fff8ef;box-shadow:inset 0 0 0 2px #d99062; }
.swatch-th-sports { background: radial-gradient(circle at 50% 50%,#fff 0 7px,#2f6fb5 8px 9px,transparent 10px),#d9ecce;box-shadow:inset 0 0 0 2px #2f6fb5; }
.swatch-th-music { background: repeating-linear-gradient(transparent 0 5px,#b8a8e0 5px 6px),#faf7ff;box-shadow:inset 0 0 0 2px #7a64c0; }
.swatch-th-wa { background: repeating-radial-gradient(circle at 50% 120%,#7f9fc2 0 3px,#fff 3px 5px),#fbf8f1;box-shadow:inset 0 0 0 2px #c0504d; }
.swatch-th-chalk { background: #27463c;box-shadow:inset 0 0 0 3px #8a6238; }
.swatch-th-note { background: repeating-linear-gradient(transparent 0 5px,#9db7e0 5px 6px),#fffef5;box-shadow:inset 0 0 0 2px #d9534f; }
.swatch-th-grid { background: repeating-linear-gradient(90deg,#a9d3b3 0 1px,transparent 1px 6px),repeating-linear-gradient(#a9d3b3 0 1px,transparent 1px 6px),#f4fbf6;box-shadow:inset 0 0 0 2px #4c9a5a; }
.swatch-th-dots { background: radial-gradient(circle,#f9d1dc 0 2px,transparent 2.5px) 0 0/8px 8px,#fff;box-shadow:inset 0 0 0 2px #ee8aa4; }
.swatch-th-gingham { background: repeating-linear-gradient(90deg,rgba(224,112,126,.5) 0 4px,transparent 4px 8px),repeating-linear-gradient(rgba(224,112,126,.5) 0 4px,transparent 4px 8px),#fff;box-shadow:inset 0 0 0 2px #e0707e; }
.swatch-th-candy { background: repeating-linear-gradient(135deg,#fbd5df 0 4px,#fffdf9 4px 8px,#cdeee2 8px 12px,#fffdf9 12px 16px); }
.swatch-th-gold { background: #fdf8ec;box-shadow:inset 0 0 0 2px #b8893b,inset 0 0 0 4px #fdf8ec,inset 0 0 0 5px #c9a463; }
.swatch-th-nordic { background: radial-gradient(circle at 50% 50%,#e8806a 0 6px,#f6d56a 6px 8px,transparent 9px),#fbf7ee;box-shadow:inset 0 0 0 2px #4f8f78; }
.swatch-th-party { background: radial-gradient(circle at 30% 40%,#ec8b78 0 5px,transparent 6px),radial-gradient(circle at 65% 40%,#7eb6d9 0 5px,transparent 6px),#fffaf4;box-shadow:inset 0 0 0 2px #ec8b78; }
.swatch-th-clover { background: radial-gradient(circle at 30% 50%,#6fa660 0 5px,transparent 6px),radial-gradient(circle at 65% 50%,#a9c99a 0 5px,transparent 6px),#f6fbf2;box-shadow:inset 0 0 0 2px #6fa660; }
.steps { margin: 6px 0 0; padding-left: 1.4em; font-size: 14px; color: #5e5346; line-height: 1.7; max-width: 62em; }
.layout > * { min-width: 0; }
.table-wrap { overflow-x: auto; max-width: 100%; }

/* ===================== 新しい画面（ページ全体は動かさない。メニューは項目ごとに切りかえる） ===================== */
html, body { height: 100%; }
body { margin: 0; min-height: 0; overflow: hidden; background: #e9eee9; }

.app { height: 100vh; display: flex; flex-direction: column; min-height: 0; }

.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 14px;
  background: #fffaf2;
  border-bottom: 1px solid #e3d8c6;
}

.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand .brand-mark { width: 36px; height: 36px; font-size: 19px; border-width: 2px; }
.brand h1 { margin: 0; font-size: 19px; letter-spacing: 0.05em; white-space: nowrap; }

.school-info { flex: 1; min-width: 0; display: flex; gap: 8px; }
.mini { display: grid; gap: 1px; font-size: 11px; color: #6a5e50; min-width: 0; }
.mini:nth-child(1) { flex: 1.5; }
.mini:nth-child(2) { flex: 1; }
.mini:nth-child(3) { flex: 1.1; }
.mini:nth-child(4) { flex: 1.2; }
.mini input, .mini select {
  width: 100%;
  min-width: 0;
  padding: 4px 8px;
  border: 1px solid #e0d3c3;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}

.top-actions { display: flex; gap: 8px; flex: none; }
.menu { position: relative; }
.menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 14px;
  border: 1px solid #d9ccb8;
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  user-select: none;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: #f4ead8; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(430px, 92vw);
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e0d3c3;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(40, 30, 10, 0.2);
  z-index: 40;
  font-size: 14px;
}
.menu-pop p { margin: 0 0 8px; }
.menu-pop ol { margin: 0 0 8px; padding-left: 1.4em; }
.menu-pop .small { font-size: 12px; color: #6a5e50; }
.menu-pop .backup { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; padding: 0; }

.banner { flex: none; margin: 0; border-radius: 0; }

.body { flex: 1; min-height: 0; display: grid; grid-template-columns: 88px minmax(380px, 470px) minmax(0, 1fr); }

.rail {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 8px;
  margin: 0;
  background: #f4ead8;
  border-right: 1px solid #e3d8c6;
  overflow-y: auto;
}
.rail button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 2px 8px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: #5a4a3a;
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
}
.rail button:hover { background: rgba(255, 255, 255, 0.6); }
.rail .ico {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid #c8b8a4;
  border-radius: 50%;
  background: #fff;
  color: #8a6a4a;
  font-family: "Yu Mincho", "Noto Serif JP", serif;
  font-size: 18px;
}
.rail button[aria-selected="true"] { background: #9d3422; color: #fff; border-color: #9d3422; }
.rail button[aria-selected="true"] .ico { border-color: #fff; color: #9d3422; }

.settings { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: #fffaf2; border-right: 1px solid #e3d8c6; }

.secbar { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px 9px; border-bottom: 1px solid #eadfce; background: #fffdf8; }
.secbar button { padding: 6px 14px; border: 1px solid #d9ccb8; border-radius: 999px; background: #fff; font-size: 14px; }
.secbar button[aria-selected="true"] { background: #2a2118; border-color: #2a2118; color: #fff; }

.secbody { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px 18px; }
.secbody fieldset { margin: 0; padding: 0; border: 0; background: none; min-width: 0; }
.secbody legend { padding: 0; margin: 4px 0 2px; font-size: 17px; }
.secbody fieldset.sec-off { display: none; }
.secbody .field { margin-top: 8px; }
.secbody .hint { margin-top: 6px; font-size: 13px; }
.secbody .hint.tight { margin-top: 2px; }

details.more { margin-top: 8px; font-size: 13px; color: #5e5346; }
details.more summary { cursor: pointer; color: #0f6b4c; width: fit-content; }
.grid-3b { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid-2 > *, .grid-3b > * { min-width: 0; }
.row-actions.bottom { margin-top: 0; align-self: end; }

/* 選ぶ見本（絵柄・デザイン・枠）は、せまい欄に3列でならべる */
.secbody .looks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.secbody #certLooks, .secbody #cardFrames { max-height: none; overflow: visible; padding-right: 0; scrollbar-gutter: auto; }
.secbody .look { grid-template-columns: 26px minmax(0, 1fr); grid-template-rows: auto auto; padding: 5px 6px; column-gap: 6px; border-radius: 8px; }
.secbody .swatch { width: 26px; height: 26px; border-radius: 5px; }
.secbody .look-name { font-size: 12.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secbody .look-note { font-size: 10.5px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secbody .texts { max-height: 190px; }
.secbody .table-wrap.tall { max-height: 52vh; overflow: auto; }

/* 掲示の種類：グループごとのボタン */
.kindgroup { margin-top: 10px; }
.kindgroup h3 { margin: 0 0 6px; font-size: 13px; color: #6a5e50; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 7px 12px; border: 1px solid #d9ccb8; border-radius: 10px; background: #fff; font-size: 14px; line-height: 1.2; }
.chip:hover { background: #fff7ee; }
.chip[aria-pressed="true"] { border-color: #9d3422; background: #fff0ea; box-shadow: inset 0 0 0 1px #9d3422; font-weight: 600; }
.chips.mini .chip { padding: 4px 9px; font-size: 13px; border-radius: 999px; }

/* プレビュー */
.stage { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 10px 16px 12px; background: #e4ece6; }
.stage-head { flex: none; display: flex; align-items: baseline; gap: 12px; }
.stage-head h2 { margin: 0; font-size: 17px; }
.stage .meta { margin: 0; font-size: 13px; color: #5e5346; }
.stage .note { flex: none; margin: 6px 0 0; padding: 6px 10px; font-size: 13px; }
#previewHolder {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin: 8px 0;
  padding: 10px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #c5d4c8;
  border-radius: 12px;
}
.stage-foot { flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stage-foot .pdf-btn { width: auto; min-width: 250px; margin: 0; }
.stage-foot .status { margin: 0; flex: 1; min-height: 0; font-size: 13px; }
.stage-foot .hint { margin: 0; }

/* 狭い画面：ふつうに上から下へ並べる */
@media (max-width: 1180px) {
  .body { grid-template-columns: 76px minmax(340px, 400px) minmax(0, 1fr); }
  .brand h1 { font-size: 17px; }
  .school-info .mini:nth-child(3) { flex: 1.3; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100vh; }
  .topbar { flex-wrap: wrap; }
  .school-info { flex-basis: 100%; order: 3; flex-wrap: wrap; }
  .school-info .mini { flex: 1 1 40%; }
  .body { display: block; }
  .rail { flex-direction: row; justify-content: space-around; border-right: 0; border-bottom: 1px solid #e3d8c6; padding: 8px; overflow: visible; }
  .rail button { flex: 1; padding: 6px 2px; }
  .rail .ico { width: 30px; height: 30px; font-size: 15px; }
  .settings { border-right: 0; }
  .secbody { overflow: visible; }
  .stage { padding: 10px; }
  #previewHolder { min-height: 260px; }
  .grid-3b { grid-template-columns: 1fr 1fr; }
}

.body.wide { grid-template-columns: 88px minmax(0, 1fr); }
.body.wide .secbody { padding-left: 24px; padding-right: 24px; }

/* 詰め */
.secbody .looks { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.secbody .look { padding: 4px 5px; grid-template-columns: 22px minmax(0, 1fr); column-gap: 5px; }
.secbody .swatch { width: 22px; height: 22px; grid-row: span 1; }
.secbody .look-note { display: none; }
.secbody .look-name { font-size: 12px; }
.secbody .table-wrap.tall { max-height: 40vh; }
.secbody .field { margin-top: 6px; }
.secbody .row-actions { margin-top: 8px; }
.secbody .table-wrap { margin-top: 6px; }
.secbody .seatgrid td input { padding-top: 10px; font-size: 12px; }
.secbody .seatgrid td { min-width: 52px; }
.swatch-mizuhaku { background: radial-gradient(circle at 50% 50%, #d8323c 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #d8323c; }
.swatch-mizukin { background: radial-gradient(circle at 50% 50%, #e8c25a 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #e8c25a; }
.swatch-mizuaka { background: radial-gradient(circle at 50% 50%, #d8323c 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #d8323c; }
.swatch-mizukon { background: radial-gradient(circle at 50% 50%, #2f4f8c 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #2f4f8c; }
.swatch-mizuwa { background: radial-gradient(circle at 50% 50%, #d8323c 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #d8323c; }
.swatch-mizugold { background: radial-gradient(circle at 50% 50%, #ecc65e 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #ecc65e; }
.swatch-mizumidori { background: radial-gradient(circle at 50% 50%, #3f8f66 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #3f8f66; }
.swatch-mizumurasaki { background: radial-gradient(circle at 50% 50%, #7a56b0 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #7a56b0; }
.swatch-mizusakura { background: radial-gradient(circle at 50% 50%, #ef8fa6 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #ef8fa6; }
.swatch-mizuhana { background: radial-gradient(circle at 50% 50%, #d8323c 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #d8323c; }
.swatch-mizutaiketsu { background: radial-gradient(circle at 50% 50%, #d8323c 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #d8323c; }
.swatch-mizukinketsu { background: radial-gradient(circle at 50% 50%, #ecc65e 0 3px, transparent 4px), #fbf6ea; box-shadow: inset 0 0 0 3px #ecc65e; }

.secbody .look-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 11.5px; line-height: 1.2; }
.secbody .look { align-items: center; min-height: 36px; }
.secbody #certLooks { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* さらに詰める（小さなノートPCでも、スクロールなしで使えるように） */
.secbody legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.secbody { padding-top: 6px; }
.secbody #certLooks { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.secbody .field { margin-top: 5px; }
.secbody .seatgrid td input { padding-top: 8px; }
.secbody .seatgrid td { padding: 1px; }
.swatch-kinhoka { background: linear-gradient(135deg, #8a5f12, #f3d675 35%, #fff1b0 50%, #c89226 70%, #8a5f12), #fdf8e8; box-shadow: inset 0 0 0 3px #fdf8e8, inset 0 0 0 5px #b8861c; }
.swatch-kinwaku { background: linear-gradient(135deg, #8a5f12, #f3d675 35%, #fff1b0 50%, #c89226 70%, #8a5f12), #fdf8e8; box-shadow: inset 0 0 0 3px #fdf8e8, inset 0 0 0 5px #b8861c; }
.swatch-kinrace { background: linear-gradient(135deg, #8a5f12, #f3d675 35%, #fff1b0 50%, #c89226 70%, #8a5f12), #fdf8e8; box-shadow: inset 0 0 0 3px #fdf8e8, inset 0 0 0 5px #b8861c; }
.swatch-kinhoh { background: linear-gradient(135deg, #8a5f12, #f3d675 35%, #fff1b0 50%, #c89226 70%, #8a5f12), #fdf8e8; box-shadow: inset 0 0 0 3px #fdf8e8, inset 0 0 0 5px #b8861c; }
.swatch-kinkoki { background: linear-gradient(135deg, #8a5f12, #f3d675 35%, #fff1b0 50%, #c89226 70%, #8a5f12), #fdf8e8; box-shadow: inset 0 0 0 3px #fdf8e8, inset 0 0 0 5px #b8861c; }

/* サーバー版：サイトのトップへもどるボタン（「使い方」「バックアップ」と同じ丸いボタン） */
.sitehome {
  display: inline-flex; align-items: center; padding: 6px 14px; border: 1px solid #d9ccb8; border-radius: 999px;
  background: #fff; color: inherit; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.sitehome:hover { background: #f4ead8; }
.sitehome:focus-visible { outline: 3px solid #0f6b4c; outline-offset: 2px; }
