:root {
  --ink: #222834;
  --muted: #58616d;
  --line: #d8dde1;
  --accent: #373fa2;
}
body {
  color: var(--ink);
  background: #fafaf7;
  font-family: system-ui, "Yu Gothic", Meiryo, sans-serif;
  & button, & summary { cursor: pointer; font: inherit; }
  & button { color: inherit; }
  & a:focus-visible, & button:focus-visible, & summary:focus-visible { outline: 3px solid #246fc2; outline-offset: 3px; }
}
.mast, .sec_intro, .sec_catalog, .credit {
  padding: 0 40px;
  & > .wrap { margin: 0 auto; max-width: 1264px; }
  @media (max-width: 800px) { padding: 0 24px; }
  @media (max-width: 480px) { padding: 0 14px; }
}
.mast {
  background: white;
  border-bottom: 1px solid var(--line);
  & .wrap { min-height: 56px; display: flex; align-items: center; gap: 18px; }
  & .brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-size: 19px; font-weight: 800; }
  & .division { padding-left: 18px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; }
  & .templates { margin-left: auto; color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 4px; }
  @media (max-width: 440px) { & .wrap { gap: 10px; } & .division { padding-left: 10px; } & .templates { font-size: 11px; } }
}
.sec_intro {
  & .wrap { padding: 48px 0 28px; }
  & h1 { color: #1c2431; font-size: 44px; font-weight: 820; line-height: 1.22em; letter-spacing: -.045em; }
  & h1 span { margin-left: .15em; color: var(--accent); }
  & p { margin-top: 13px; max-width: 760px; color: var(--muted); font-size: 15px; line-height: 1.8em; }
  @media (max-width: 780px) { & .wrap { padding: 34px 0 22px; } & h1 { font-size: 40px; } }
  @media (max-width: 530px) { & h1 { font-size: 36px; } & p { font-size: 14px; } }
  @media (max-width: 400px) { & h1 { font-size: 32px; } }
}
.sec_catalog {
  & .toolbar { padding: 14px 0 18px; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); }
  & .filters { display: flex; flex-wrap: wrap; gap: 6px; }
  & .filters button { padding: 8px 13px; border: 1px solid var(--line); border-radius: 20px; background: white; font-size: 13px; line-height: 1.3em; }
  & .filters [aria-pressed="true"] { color: white; border-color: var(--ink); background: var(--ink); }
  & .total { margin-left: auto; color: var(--muted); font-size: 13px; }
  & .total strong { color: var(--ink); font: 700 16px/1.4em Consolas, monospace; }
  & .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  @media (max-width: 930px) { & .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; } }
  @media (max-width: 600px) { & .grid { grid-template-columns: minmax(0, 1fr); } & .filters button { padding: 8px 10px; } }
}
.card {
  min-width: 0; scroll-margin: 14px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 10px; background: white;
  &[data-group="大型"] {
    grid-column: span 2;
    & .stage { min-height: 198px; padding-inline: 24px; }
    @media (max-width: 600px) { grid-column: auto; & .stage { padding-inline: 14px; } }
  }
  &[data-group="飛び出す選択肢"] .stage {
    min-height: 198px;
    align-items: flex-start;
    padding-top: 50px;
    padding-bottom: 17px;
  }
  &:target { outline: 3px solid #535db0; outline-offset: 2px; }
  &[hidden] { display: none; }
  & .stage {
    position: relative; padding: 45px 16px 32px; min-height: 152px;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle, #1b294914 .7px, transparent 1px) 0 0 / 12px 12px, var(--paper);
  }
  & .part_no { position: absolute; top: 11px; left: 13px; color: #37404c; font: 600 12px/1.4em Consolas, monospace; letter-spacing: .065em; }
  & .caption { padding: 17px 18px 10px; }
  & h2 { font-size: 18px; font-weight: 740; line-height: 1.45em; }
  & p { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.6em; }
  & .actions { margin-top: 13px; padding-top: 5px; display: flex; align-items: center; justify-content: space-between; gap: 6px; border-top: 1px solid #e8eaec; }
  & .actions button { padding: 8px 0; border: 0; background: none; color: var(--accent); font-size: 13px; font-weight: 670; }
  & .actions [data-share] { color: var(--muted); font-size: 12px; font-weight: 500; }
}
.credit {
  margin-top: 36px; border-top: 1px solid var(--line); color: var(--muted);
  & .wrap { padding: 23px 0 36px; font-size: 13px; line-height: 1.7em; }
  & a { color: var(--accent); text-decoration: underline; }
}
#code-dialog {
  margin: auto; padding: 0; width: min(620px, calc(100% - 24px)); max-height: 84dvh;
  border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #fff;
  font-family: inherit; box-shadow: 0 18px 60px #111b3433;
  &::backdrop { background: #14203777; }
  & .dialog_head { padding: 20px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--line); }
  & #dialog-number { color: var(--accent); font: 700 13px/1.5em Consolas, monospace; }
  & h2 { margin-top: 3px; font-weight: 750; font-size: 20px; line-height: 1.45em; }
  & .dialog_body { padding: 18px 20px 22px; font-size: 14px; line-height: 1.65em; }
  & .tools { margin: 16px 0; display: flex; flex-wrap: wrap; gap: 7px; }
  & button, & .tools a { padding: 9px 12px; display: inline-block; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); font: 600 13px/1.4em system-ui,sans-serif; }
  & #copy-all { background: var(--accent); border-color: var(--accent); color: white; }
  & details { padding: 8px 0; border-top: 1px solid var(--line); }
  & summary { padding: 4px 0; font-weight: 680; }
  & details button { margin: 7px 0; }
  & pre { margin: 0; padding: 12px; max-height: 245px; overflow: auto; background: #f1f3f6; color: #27334b; font: 12px/1.6em Consolas, monospace; white-space: pre; tab-size: 2; }
  & .dialog_result { color: #304771; }
}
.toast {
  position: fixed; bottom: 18px; left: 50%; z-index: 2; transform: translateX(-50%);
  padding: 9px 14px; max-width: 90%; border-radius: 6px; background: #222b39; color: white; font-size: 13px; line-height: 1.5em;
  &:empty { display: none; }
}
