/* 命式帳
 * 見た目の参考：UMIUMA（生成りの紙の地・白い角丸のパネル・1色の濃い文字・太いゴシックと広い字間・
 * 吊り下がる旗のボタン・点線の区切り・縦書きのコピー）。ロゴ・画像・文章は使っていない。
 */
:root {
  --paper: #F7ECD4;     /* 生成り */
  --paper-2: #FDF6E6;
  --panel: #FFFDF8;
  --ink: #1F3E70;       /* 藍。文字はすべてこの色 */
  --ink-2: #2D5799;     /* ボタンを押したとき */
  --asagi: #2B7299;     /* 浅葱。小さな見出し・印（白地で 5.3：1） */
  --line: #A9CBDD;
  --seal: #C1302A;      /* 朱。日主の印だけ */
  --wood: #2E6A43;
  --fire: #C1302A;
  --earth: #8A6416;
  --metal: #5C6470;
  --water: #1F3E70;
  --sans: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  --num: "Montserrat", "Noto Sans JP", sans-serif;
  --gut: 16px;
  --r: 22px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink);
  font-family: var(--sans); font-weight: 500; font-size: 16px; line-height: 1.85;
  font-feature-settings: "palt"; letter-spacing: .04em;
  background-color: var(--paper);
  /* 紙のざらつき（自前の SVG ノイズ） */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .36 0 0 0 0 .2 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--asagi); outline-offset: 2px; }

/* 見出しの帯と、吊り下がる短冊 */
.mast {
  position: relative; max-width: 1160px; margin: 0 auto;
  padding: 22px var(--gut) 0; min-height: 112px;
}
.logo {
  display: inline-flex; flex-direction: column; align-items: center;
  font-weight: 900; font-size: 30px; letter-spacing: .32em; line-height: 1.2;
  text-decoration: none; padding-left: .32em;
}
.logo small { font-size: 11px; font-weight: 700; letter-spacing: .5em; margin-top: 2px; }
.tabs { position: absolute; top: 0; right: var(--gut); display: flex; gap: 12px; }
.tab {
  display: flex; align-items: flex-start; justify-content: center;
  width: 92px; height: 120px; padding-top: 30px;
  background: var(--ink); color: var(--paper-2); text-decoration: none; text-align: center;
  font-weight: 900; font-size: 14px; letter-spacing: .14em; line-height: 1.5;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 84%, 0 100%);
  transition: height .2s ease;
  position: relative;
}
.tab::before { content: ""; position: absolute; inset: 5px 5px 0; border: 1.5px solid currentColor; border-bottom: 0; opacity: .7; pointer-events: none; }
.tab--light { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.tab:hover { height: 128px; }

main { max-width: 1160px; margin: 0 auto; padding: 0 var(--gut); }

/* 入口 */
.hero {
  display: grid; grid-template-columns: 96px minmax(0, .95fr) minmax(0, 1.1fr);
  gap: 28px; padding: 36px 0 48px; align-items: start;
}
.hero__copy {
  writing-mode: vertical-rl; margin: 8px 0 0; justify-self: center;
  font-weight: 900; font-size: 38px; line-height: 1.5; letter-spacing: .22em;
}

.panel { background: var(--panel); border-radius: var(--r); padding: 36px 36px 40px; }

.intake__title { font-weight: 900; font-size: 24px; line-height: 1.6; letter-spacing: .1em; margin: 0 0 12px; }
.intake__lead { font-size: 14px; margin: 0 0 24px; }

.form__group { border: 0; padding: 0; margin: 0 0 22px; }
.form__group legend { font-weight: 900; font-size: 15px; letter-spacing: .12em; padding: 0; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.form__group legend::before, .block__h::before, .sec__h::before, .about__h::before {
  content: ""; display: inline-block; width: 12px; height: 16px; background: var(--ink); flex: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}
.form__opt { font-weight: 700; font-size: 12px; color: var(--asagi); border: 1.5px solid var(--asagi); border-radius: 99px; padding: 0 10px; letter-spacing: .1em; }
.form__row { display: flex; flex-wrap: wrap; gap: 10px 12px; }
.sel { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.sel select {
  font-family: var(--num); font-weight: 600; font-size: 18px; color: var(--ink); letter-spacing: .04em;
  background-color: var(--paper-2); border: 2px solid var(--ink); border-radius: 12px;
  padding: 8px 32px 8px 14px; min-height: 48px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 12px) 52%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
#by { min-width: 6.6em; }
.form__hint { font-size: 12px; margin: 8px 0 0; }
.form__error { color: var(--seal); font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.form__error:empty { display: none; }

/* 大きなボタン：濃い面に、内側の点線 */
.btn {
  display: block; width: 100%; padding: 6px; border: 0; cursor: pointer;
  background: var(--ink); color: var(--paper-2); border-radius: 14px;
  font-family: var(--sans); font-weight: 900; font-size: 19px; letter-spacing: .3em;
}
.btn span { display: block; padding: 14px 0; border: 1.5px dashed rgba(253, 246, 230, .75); border-radius: 10px; }
.btn:hover { background: var(--ink-2); }

/* 命式の表 */
.board { margin: 0; padding: 28px 24px 24px; }
.board__grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 36px;
  border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--panel);
}
.cell {
  display: flex; align-items: center; justify-content: center; text-align: center;
  border-bottom: 1.5px dashed var(--line); border-left: 1.5px dashed var(--line);
  padding: 6px 4px; min-height: 40px; font-size: 13px; font-weight: 700; letter-spacing: .06em;
}
.cell.c0 { border-left: 0; }
.cell.r6, .cell--head:last-child { border-bottom: 0; }
.cell.is-day { background: var(--paper-2); }
.cell--label { font-weight: 900; font-size: 14px; letter-spacing: .14em; min-height: 46px; background: var(--ink); color: var(--paper-2); border-bottom: 0; border-left-color: rgba(253, 246, 230, .35); border-left-style: solid; }
.cell--label.is-day { background: var(--ink); }
.cell--big { flex-direction: column; min-height: 108px; gap: 4px; }
.cell--big .ch { font-weight: 900; font-size: 54px; line-height: 1; }
.cell--big .yomi { font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.cell--zokan .ch { font-weight: 900; font-size: 22px; }
.cell--head { border-left: 2px solid var(--ink); font-size: 11px; font-weight: 900; writing-mode: vertical-rl; letter-spacing: .2em; padding: 6px 0; }
.cell--head.cell--label { background: var(--ink); }
.ch--empty { color: var(--line); }

.self-mark { display: inline-block; background: var(--seal); color: #fff; padding: 0 8px; border-radius: 99px; font-weight: 900; font-size: 12px; letter-spacing: .14em; line-height: 1.8; }

.el-wood { color: var(--wood); } .el-fire { color: var(--fire); } .el-earth { color: var(--earth); }
.el-metal { color: var(--metal); } .el-water { color: var(--water); }

.board__cap { font-size: 12px; margin-top: 12px; }

@media (prefers-reduced-motion: no-preference) {
  .board.is-new .cell:not(.cell--head) .ch { animation: ink .5s ease-out both; }
  .board.is-new .c3 .ch { animation-delay: 0s; }
  .board.is-new .c2 .ch { animation-delay: .15s; }
  .board.is-new .c1 .ch { animation-delay: .3s; }
  .board.is-new .c0 .ch { animation-delay: .45s; }
  @keyframes ink { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) { .tab { transition: none; } }

/* 結果 */
.result { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 48px; margin-bottom: 32px; }
.result[hidden] { display: none; }
.result__self { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 4px 24px; align-content: start; }
.self__char {
  grid-row: span 3; align-self: start; font-weight: 900; font-size: 104px; line-height: 1;
  background: var(--seal); color: var(--paper-2); border-radius: 18px; padding: 16px 18px 20px; margin-top: 4px;
}
.self__kicker { font-size: 13px; font-weight: 900; letter-spacing: .2em; color: var(--asagi); margin: 0; }
.self__name { font-weight: 900; font-size: 26px; margin: 0; line-height: 1.5; letter-spacing: .1em; }
.self__sub { display: block; font-size: 15px; font-weight: 700; letter-spacing: .12em; }
.self__text { margin: 10px 0 0; font-size: 15px; max-width: 28em; }
.result__side { display: grid; gap: 28px; }
.block__h { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 18px; letter-spacing: .14em; margin: 0 0 10px; }
.block__note { font-size: 12px; margin: 0 0 10px; }
.block--wide { grid-column: 1 / -1; margin-top: 32px; padding-top: 24px; border-top: 1.5px dashed var(--line); }

.gogyo { list-style: none; margin: 0; padding: 0; }
.gogyo li { display: grid; grid-template-columns: 2em minmax(0, 1fr) 3.2em; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1.5px dashed var(--line); }
.gogyo__name { font-weight: 900; font-size: 20px; line-height: 1; }
.gogyo__bar { display: flex; gap: 4px; }
.gogyo__bar i { display: block; width: 18px; height: 18px; border: 2px solid currentColor; border-radius: 5px; }
.gogyo__bar i.on { background: currentColor; }
.gogyo__n { text-align: right; font-family: var(--num); font-weight: 800; font-size: 15px; color: var(--ink); }

.kubo__pair { font-weight: 900; font-size: 30px; letter-spacing: .2em; margin: 0; line-height: 1.4; }
.kubo__text { margin: 4px 0 0; font-size: 14px; }

.rules { margin: 0; padding-left: 1.2em; font-size: 13px; }
.rules li { margin-bottom: 4px; }
.rules .warn { color: var(--seal); font-weight: 700; }

/* 言葉の意味・このサイトについて */
.sec__h { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 22px; letter-spacing: .16em; margin: 0 0 16px; }
.sec__h::before { width: 15px; height: 20px; }
.words, .about { margin-bottom: 32px; }
.dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.dl > div { padding: 14px 0; border-bottom: 1.5px dashed var(--line); }
.dl dt { font-weight: 900; letter-spacing: .1em; margin-bottom: 2px; }
.dl dd { margin: 0; font-size: 14px; }

.about__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.about__h { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 900; letter-spacing: .12em; margin: 0 0 8px; }
.about__h::before { width: 10px; height: 13px; }
.about__list { margin: 0 0 16px; padding-left: 1.2em; font-size: 13px; }
.about__list li { margin-bottom: 6px; }
.about__src { font-size: 12px; }

.foot { text-align: center; padding: 24px var(--gut) 48px; }
.foot__logo { margin: 0; font-weight: 900; font-size: 18px; letter-spacing: .32em; }

/* タブレット・スマホ */
@media (max-width: 960px) {
  .hero { grid-template-columns: 72px minmax(0, 1fr); }
  .hero__copy { grid-row: span 2; font-size: 30px; }
  .result { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .block--wide { margin-top: 0; }
}
@media (max-width: 640px) {
  .mast { min-height: 104px; padding-top: 18px; }
  .logo { font-size: 24px; }
  .tab { width: 72px; height: 100px; padding-top: 24px; font-size: 12px; }
  .tab:hover { height: 104px; }
  .tabs { gap: 8px; }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .hero__copy { writing-mode: horizontal-tb; grid-row: auto; justify-self: start; font-size: 24px; letter-spacing: .14em; margin: 0; }
  .panel { padding: 24px 18px 28px; border-radius: 18px; }
  .board { padding: 18px 10px 16px; }
  .board__grid { grid-template-columns: repeat(4, minmax(0, 1fr)) 28px; border-radius: 12px; }
  .cell { font-size: 11px; padding: 6px 2px; letter-spacing: 0; }
  .cell--label { font-size: 12px; letter-spacing: .06em; }
  .cell--big { min-height: 90px; }
  .cell--big .ch { font-size: 40px; }
  .cell--big .yomi { font-size: 9px; letter-spacing: 0; }
  .cell--zokan .ch { font-size: 18px; }
  .intake__title { font-size: 20px; }
  .self__char { font-size: 64px; padding: 10px 12px 14px; border-radius: 14px; }
  .result__self { gap: 4px 16px; }
  .self__name { font-size: 21px; }
  .dl, .about__cols { grid-template-columns: minmax(0, 1fr); }
}
