/* 口コミ分析ダッシュボードの画面。
   見た目の題材は、お客様の声(吹き出し)と、種類ごとの仕分け箱。
   文字の大きさ・行の高さ・ボタンの高さは、実在のレビュー欄と分析ツール11件を測った範囲に合わせている
   (口コミの本文13〜14px・行間1.43〜1.6、欄の見出し20〜24px、札と小ボタン32px、星の棒16〜20px、
    本文の幅630〜900px、白地)。色は、良い・不満の区別にだけ使う。 */
:root {
  --ink: #3d1e4f;
  --muted: #6f5a7a;
  --line: #e6dceb;
  --paper: #ffffff;
  --page: #faf7fb;
  --tint: #f3ebf6;
  --bad: #c2255c;        /* 不満 */
  --bad-pale: #fdebf1;
  --good: #0b7a75;       /* 良い */
  --good-pale: #e3f4f2;
  --mark: #ffe58a;       /* 当たった言葉に引く、蛍光ペン */
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.wrap { width: min(100% - 2rem, 62rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 題名:吹き出しの形 ---------- */
.voice-head { padding: 1.5rem 0 1rem; }
.voice-head .wrap { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.5rem 1rem; }
.voice-head h1 {
  padding: 0.5rem 1.1rem;
  background: var(--ink);
  color: #fff;
  font-size: 1.375rem;
  font-weight: 900;
  border-radius: 1.2rem 1.2rem 1.2rem 0.2rem;
}
.updated { font-size: 0.8125rem; color: var(--muted); }

main.wrap { padding-bottom: 3rem; }
.banner { margin-bottom: 1rem; padding: 0.5rem 0.9rem; border-left: 4px solid var(--ink); background: var(--tint); font-size: 0.8125rem; }
.banner-warn { border-left-color: var(--bad); background: var(--bad-pale); }

h2 { font-size: 1.375rem; font-weight: 900; line-height: 1.4; }
h3 { font-size: 0.9375rem; font-weight: 700; }
.section-note { margin-top: 0.2rem; max-width: 46rem; font-size: 0.8125rem; color: var(--muted); }
.hint { margin-top: 0.4rem; font-size: 0.75rem; color: var(--muted); }

/* ---------- 集計の対象 ---------- */
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.9rem; margin-bottom: 1rem; }
.pick { display: flex; align-items: center; gap: 0.4rem; font-size: 0.8125rem; white-space: nowrap; }
.pick select, .search input {
  height: 2.5rem;
  padding: 0 0.7rem;
  border: 1px solid var(--muted);
  border-radius: 0.3rem;
  background: #fff;
}
.period, .seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 0.3rem; overflow: hidden; }
.period button, .seg button {
  height: 2.5rem;
  padding: 0 0.9rem;
  border: 0;
  border-left: 1px solid var(--ink);
  background: #fff;
  font-size: 0.875rem;
  cursor: pointer;
}
.period button:first-child, .seg button:first-child { border-left: 0; }
.period button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.button-plain {
  display: inline-flex; align-items: center;
  height: 2.5rem; padding: 0 0.9rem; margin-left: auto;
  border: 1px solid var(--ink); border-radius: 0.3rem;
  background: #fff; color: var(--ink); font-size: 0.875rem; font-weight: 700; text-decoration: none;
}
.button-plain:hover { background: var(--tint); }

/* ---------- 全体のまとめ:数字と、星の内訳 ---------- */
.overview { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--paper); border: 1px solid var(--line); }
.overview > * { min-width: 0; padding: 1.25rem 1.5rem; }
.score { background: var(--ink); color: #fff; }
.score-label { font-size: 0.8125rem; }
.score-value { font-size: 3.5rem; font-weight: 900; line-height: 1.1; }
.score-value small { margin-left: 0.4rem; font-size: 1rem; font-weight: 500; }
.score-count { font-size: 0.8125rem; color: #dccfe4; }
.score-bad { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; margin-top: 0.9rem; padding-top: 0.8rem; border-top: 1px solid rgba(255, 255, 255, 0.25); }
.score-bad span { font-size: 0.8125rem; }
.score-bad b { font-size: 1.5rem; font-weight: 900; }
.score-bad small { font-size: 0.8125rem; color: #dccfe4; }

.stars ul { margin-top: 0.4rem; }
.star-bar {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) 3.6rem 2.8rem;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 2rem;
  padding: 0 0.3rem;
  border: 0;
  border-radius: 0.2rem;
  background: none;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}
.star-bar:hover { background: var(--tint); }
.star-bar[aria-pressed="true"] { background: var(--tint); box-shadow: inset 0 0 0 2px var(--ink); }
.star-name { font-weight: 700; }
.track { display: block; height: 1.1rem; background: var(--tint); }
.fill { display: block; height: 100%; background: var(--good); }
.star-bar.is-bad .fill { background: var(--bad); }
.star-count { text-align: right; }
.star-percent { text-align: right; color: var(--muted); font-size: 0.8125rem; }

.terms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; margin-top: 0.75rem; padding: 0.4rem 1rem; background: var(--tint); font-size: 0.8125rem; }
.terms div { display: flex; gap: 0.75rem; padding: 0.3rem 0; }
.terms dt { flex: none; width: 6.5rem; color: var(--muted); }

.digest { margin-top: 0.75rem; padding: 0.7rem 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 0.2rem 1rem 1rem 1rem; font-size: 0.875rem; }
.digest li { padding-left: 1.1em; text-indent: -1.1em; }
.digest li::before { content: "・"; }

/* ---------- 不満の種類:仕分け箱の表 ---------- */
.boxes, .trend, .voices, .try { margin-top: 2.5rem; }
.table-wrap { margin-top: 0.75rem; overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--ink); }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 0.45rem 0.7rem; border-bottom: 1px solid var(--ink); font-size: 0.75rem; font-weight: 500; color: var(--muted); text-align: left; white-space: nowrap; }
.cats td, .cats tbody th { padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; font-weight: 500; }
.cats tr:last-child td, .cats tr:last-child th { border-bottom: 0; }
.num { text-align: right !important; white-space: nowrap; }
.rank { width: 2.5rem; text-align: center !important; color: var(--muted); }
.cat-name {
  padding: 0.15rem 0.6rem;
  border: 1.5px solid var(--ink);
  border-radius: 0.9rem 0.9rem 0.9rem 0.15rem;
  background: #fff;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.cat-name:hover { background: var(--tint); }
.cat-name[aria-pressed="true"] { background: var(--ink); color: #fff; }
.cats tbody th small { display: block; margin-top: 0.15rem; font-size: 0.75rem; color: var(--muted); }
.cat.is-selected { background: var(--tint); }
.cat.is-other .cat-name { border-style: dashed; }
.cats .bad { font-weight: 700; color: var(--bad); }
.cats .good { color: var(--good); }
.bar-col { min-width: 9rem; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) 2.6rem; align-items: center; gap: 0.5rem; }
td.bar-col .fill { background: var(--bad); }
.share { text-align: right; font-size: 0.8125rem; color: var(--muted); }
.change .arrow { margin-right: 0.2rem; font-size: 0.75em; }
.is-up { color: var(--bad); font-weight: 700; }
.is-down { color: var(--good); font-weight: 700; }
.sample-col { min-width: 16rem; font-size: 0.8125rem; line-height: 1.5; color: var(--muted); }

mark { padding: 0 0.1em; background: linear-gradient(transparent 55%, var(--mark) 55%); color: inherit; font-weight: 700; }

/* ---------- 月ごとの推移 ---------- */
.chart-box { position: relative; height: 15rem; margin-top: 0.75rem; padding: 0.75rem; background: var(--paper); border: 1px solid var(--line); border-bottom: 0; }
.trend .table-wrap { margin-top: 0; border-top: 1px solid var(--line); }
.months th, .months td { padding: 0.4rem 0.7rem; border-bottom: 1px solid var(--line); font-size: 0.8125rem; font-weight: 500; white-space: nowrap; }
.months th[scope="row"] { text-align: left; color: var(--muted); }
.months tr:last-child th, .months tr:last-child td { border-bottom: 0; }
.months small { margin-left: 0.35rem; font-size: 0.75rem; }

/* ---------- 口コミの一覧 ---------- */
.voices-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; }
.voices-count { font-size: 0.875rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 0.75rem; }
.search { flex: 1 1 12rem; }
.search input { width: 100%; }
.star-chips, .cat-chips, .try-stars { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.cat-chips { margin-top: 0.6rem; }
.chip {
  min-height: 2rem;
  padding: 0 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8125rem;
  cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.chip-count { margin-left: 0.35rem; font-size: 0.75rem; opacity: 0.75; }

.voice-list { max-width: 46rem; margin-top: 1rem; display: grid; gap: 0.75rem; }
/* 口コミ1件は、吹き出しの形。左の線の色が、良いか不満か */
.voice {
  padding: 0.8rem 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 0.3rem solid var(--good);
  border-radius: 0.2rem 1rem 1rem 1rem;
}
.voice.is-bad { border-left-color: var(--bad); }
.voice-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.75rem; font-size: 0.75rem; color: var(--muted); }
.voice-stars { font-size: 0.875rem; letter-spacing: 0.05em; color: var(--ink); }
.voice-kind { padding: 0 0.45rem; border-radius: 0.2rem; font-weight: 700; }
.is-bad .voice-kind { background: var(--bad-pale); color: var(--bad); }
.is-good .voice-kind { background: var(--good-pale); color: var(--good); }
.voice-text { margin-top: 0.35rem; font-size: 0.875rem; line-height: 1.6; overflow-wrap: anywhere; }
.voice-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.tag { padding: 0 0.5rem; border: 1px solid var(--ink); border-radius: 0.7rem 0.7rem 0.7rem 0.1rem; font-size: 0.75rem; line-height: 1.7; white-space: nowrap; }
.tag-other { border-style: dashed; color: var(--muted); }
.link { padding: 0.2rem 0; border: 0; background: none; color: var(--ink); font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.empty { margin-top: 1rem; padding: 1.25rem; border: 1px dashed var(--muted); color: var(--muted); }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; max-width: 46rem; margin-top: 1rem; }
.pager-buttons { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.pager-buttons button { min-width: 2.5rem; height: 2.5rem; padding: 0 0.6rem; border: 1px solid var(--line); border-radius: 0.3rem; background: #fff; cursor: pointer; }
.pager-buttons button.is-current { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.pager-buttons button:disabled { color: #a99bb1; cursor: not-allowed; }

/* ---------- 分け方をためす ---------- */
.try-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: 0.75rem; }
.try-label { display: block; margin-bottom: 0.3rem; font-size: 0.8125rem; font-weight: 700; }
.try textarea { width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--muted); border-radius: 0.3rem; background: #fff; line-height: 1.6; resize: vertical; }
.try-stars { margin-top: 0.5rem; }
.try-result { padding: 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 0.2rem 1rem 1rem 1rem; }
.try-verdict { display: inline-block; padding: 0.1rem 0.6rem; border-radius: 0.2rem; font-weight: 700; }
.try-verdict.is-bad { background: var(--bad-pale); color: var(--bad); }
.try-verdict.is-good { background: var(--good-pale); color: var(--good); }
.try-marked { margin-top: 0.6rem; line-height: 1.8; overflow-wrap: anywhere; }
.try-cats { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.6rem; }
.try-cats .tag { font-size: 0.8125rem; }

.rules { margin-top: 1rem; border: 1px solid var(--line); background: var(--paper); }
.rules summary { padding: 0.7rem 1rem; font-weight: 700; cursor: pointer; }
.rules dl { padding: 0 1rem; }
.rules dl div { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 0.75rem; padding: 0.45rem 0; border-top: 1px solid var(--line); font-size: 0.8125rem; }
.rules dt { font-weight: 700; }
.rules .hint { padding: 0 1rem 0.9rem; }

.site-footer { padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--muted); }

/* ---------- 広い画面 ---------- */
@media (min-width: 48rem) {
  .overview { grid-template-columns: 17rem minmax(0, 1fr); }
  .try-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- 狭い画面 ---------- */
@media (max-width: 47.99rem) {
  h2 { font-size: 1.25rem; }
  .voice-head h1 { font-size: 1.1875rem; }
  .button-plain { margin-left: 0; }
  .overview > * { padding: 1rem; }
  .score-value { font-size: 2.75rem; }
  .terms { grid-template-columns: 1fr; }
  .terms dt { width: 5.5rem; }
  /* 種類の表は、1件ずつの形にする(横にはみ出させない) */
  .boxes .table-wrap { overflow: visible; border: 0; border-top: 3px solid var(--ink); background: none; }
  .cats thead { display: none; }
  .cats, .cats tbody { display: block; }
  .cats tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "name name bad" "bar bar bar" "good change change" "sample sample sample";
    gap: 0.25rem 0.75rem;
    padding: 0.7rem 0.2rem;
    border-bottom: 1px solid var(--line);
  }
  .cats td, .cats tbody th { display: block; padding: 0; border: 0; }
  .cats .rank { display: none; }
  .cats tbody th { grid-area: name; }
  .cats td.bad { grid-area: bad; align-self: center; }
  .cats td.bar-col { grid-area: bar; }
  .cats td.good { grid-area: good; text-align: left !important; font-size: 0.8125rem; }
  .cats td.good::before { content: "良い "; color: var(--muted); }
  .cats td.change { grid-area: change; font-size: 0.8125rem; }
  .cats td.sample-col { grid-area: sample; min-width: 0; }
  .filters .pick { flex: 1 1 100%; }
  .filters .pick select { flex: 1; min-width: 0; }
  .rules dl div { grid-template-columns: 1fr; gap: 0; }
}

/* スマートフォンでは、押す部品・入力欄の高さを44px以上にそろえる */
@media (max-width: 48rem) {
  button, select, a.button,
  input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]) { min-height: 2.75rem !important; }
}
