:root {
  --main: #2e5e4e;        /* 深い緑 */
  --main-2: #22473b;
  --main-soft: #e6efe9;
  --gold: #b8692f;
  --gold-soft: #f8ece0;
  --ink: #2d2c35;
  --ink-2: #6a6875;
  --paper: #f6f5ef;
  --card: #ffffff;
  --line: #e1e0d6;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Yu Gothic', 'Meiryo', sans-serif;
  font-size: 17px;
  line-height: 1.75;
}
main { max-width: 640px; margin: 0 auto; padding: 0 16px 48px; }
[hidden] { display: none !important; }

.hero { text-align: center; padding: 40px 0 24px; }
.eyebrow { margin: 0; color: var(--gold); font-weight: 700; font-size: 15px; letter-spacing: .08em; }
h1 { margin: 6px 0 10px; font-size: 34px; letter-spacing: .06em; color: var(--main); }
.lead { margin: 0; color: var(--ink-2); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
h2 { margin: 0 0 8px; font-size: 20px; color: var(--main); }
h3 { margin: 16px 0 4px; font-size: 17px; color: var(--main); }
p { margin: 0 0 10px; }
.note { color: var(--ink-2); font-size: 15px; }
.small { font-size: 14px; }
.err { color: #a44c3c; background: #fbeee9; border-radius: 10px; padding: 8px 12px; font-size: 15px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 15px; font-weight: 700; margin-bottom: 4px; }
input[type='date'], input[type='text'] {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}
input:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.btn {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn.primary { background: var(--main); color: #fff; margin-bottom: 10px; }
.btn.ghost { background: var(--main-soft); color: var(--main); }
.btn.line { background: #06c755; color: #fff; margin-top: 10px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; position: sticky; top: 0; background: var(--paper); padding: 8px 0; z-index: 2; }
.tab {
  min-height: 46px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.tab.on { background: var(--main); border-color: var(--main); color: #fff; }

.hero-link { margin: 12px 0 0; font-size: 15px; }
.hero-link a, .link { color: var(--main); font-weight: 700; }
select { font: inherit; }
.opt summary { cursor: pointer; font-size: 15px; color: var(--main); font-weight: 700; min-height: 44px; padding: 8px 0; }
.radios label { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; padding: 6px 0; cursor: pointer; }
.radios input { margin-top: 6px; flex: none; width: 18px; height: 18px; accent-color: var(--main); }

/* 紋章のしるし（色と字） */
.mark {
  flex: none;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  border: 2px solid transparent;
}
.mark.small-m { width: 44px; height: 44px; font-size: 21px; }
.c-red { background: #c4553e; color: #fff; }
.c-white { background: #f3f0e7; color: #4a463d; border-color: #cfc9b8; }
.c-blue { background: #3c6ea6; color: #fff; }
.c-yellow { background: #e6b53c; color: #3b2f12; }

/* 銀河の音（マヤの数字：点が1、棒が5） */
.tone-dots { display: inline-flex; flex-direction: column-reverse; align-items: center; gap: 3px; vertical-align: middle; }
.tone-dots .dots { display: flex; gap: 4px; }
.tone-dots i { display: block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tone-dots b { display: block; width: 34px; height: 6px; border-radius: 3px; background: currentColor; }

.kin-card { text-align: center; }
.kin-card .mark { width: 92px; height: 92px; font-size: 44px; margin: 4px auto 10px; }
.kin-no { margin: 0; font-size: 15px; color: var(--ink-2); font-weight: 700; letter-spacing: .06em; }
.kin-no b { font-size: 30px; color: var(--main); }
.kin-name { margin: 2px 0 6px; font-size: 24px; font-weight: 700; color: var(--main); line-height: 1.4; }
.kin-sub { margin: 0; color: var(--ink-2); font-size: 15px; }
.kin-tone { color: var(--main); margin: 8px 0 2px; }
.black-note { background: #2f2c28; color: #f3efe6; border-radius: 12px; padding: 10px 14px; font-size: 15px; text-align: left; margin-top: 12px; }

.h-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h-row h2, .h-row h3 { margin-bottom: 4px; }
.q {
  flex: none;
  min-width: 44px;
  min-height: 34px;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: #fff;
  color: var(--main);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.keyword { display: inline-block; background: var(--main-soft); color: var(--main); font-size: 14px; font-weight: 700; padding: 0 10px; border-radius: 99px; margin-bottom: 8px; }
dl { margin: 8px 0 0; }
dt { font-weight: 700; color: var(--main); font-size: 15px; margin-top: 10px; }
dd { margin: 0; }
.step { background: var(--gold-soft); border-radius: 10px; padding: 8px 12px; margin-top: 12px; }

.mini { display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding: 12px 0 4px; }
.mini:first-of-type { border-top: 0; }
.mini-body { min-width: 0; }
.mini-role { margin: 0; font-size: 13px; color: var(--accent, var(--gold)); font-weight: 700; }
.mini-name { margin: 0; font-weight: 700; color: var(--main); line-height: 1.5; }
.mini-text { margin: 2px 0 0; font-size: 15px; color: var(--ink-2); }

.today-role { background: var(--gold-soft); border-radius: 10px; padding: 8px 12px; margin-top: 8px; font-size: 15px; }

.years { width: 100%; border-collapse: collapse; font-size: 14px; }
.years th, .years td { border-bottom: 1px solid var(--line); padding: 8px 4px; text-align: left; vertical-align: top; }
.years th { font-size: 13px; color: var(--ink-2); }
.years tr.now td { background: var(--gold-soft); font-weight: 700; }
.years td.k, .years td:first-child { white-space: nowrap; }

.howto { margin: 0; padding-left: 1.4em; }
.howto li { margin-bottom: 4px; }
.term { border-top: 1px solid var(--line); }
.term summary { cursor: pointer; font-weight: 700; color: var(--main); padding: 10px 0; min-height: 44px; }
.term p { margin: 0 0 12px; }
.term.flash { background: var(--gold-soft); border-radius: 8px; }
.about summary { cursor: pointer; font-weight: 700; color: var(--main); padding: 8px 0; min-height: 44px; }
.rule { border-top: 1px solid var(--line); padding: 10px 0 2px; }
.rule h3 { margin-top: 0; }
.credit { text-align: center; }

/* 260日の表 */
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 8px; }
.lg::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.lg.me::before { background: var(--gold); }
.lg.today::before { box-shadow: inset 0 0 0 2px var(--main); background: #fff; }
.lg.black::before { background: #3a3631; }
.grid { display: grid; grid-template-columns: 26px repeat(13, minmax(0, 1fr)); gap: 2px; }
.grid .row-h { display: grid; place-items: center; font-size: 12px; font-weight: 700; border-radius: 4px; height: 22px; }
.cell {
  height: 22px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: #ece9df;
  color: #6c675c;
  font: inherit;
  font-size: 9px;
  line-height: 22px;
  cursor: pointer;
  overflow: hidden;
}
.cell.black { background: #3a3631; color: #d9d3c6; }
.cell.me { background: var(--gold); color: #fff; font-weight: 700; }
.cell.today { box-shadow: inset 0 0 0 2px var(--main); }
.cell.sel { outline: 2px solid var(--main-2); outline-offset: 1px; }
.grid-info { margin: 10px 0 0; font-size: 15px; background: var(--main-soft); border-radius: 10px; padding: 8px 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--main-2);
  color: #fff;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 15px;
  z-index: 10;
  max-width: calc(100vw - 32px);
}
.kin-card .step, .kin-card .today-role { text-align: left; }
