:root {
  --color-bg: #f5f3ee;
  --color-surface: #ffffff;
  --color-text: #2a241c;
  --color-text-muted: #756b5c;
  --color-primary: #a8452f;
  --color-primary-dark: #8a3623;
  --color-self: #2f6b4f;
  --color-self-bg: #e6f1ea;
  --color-opponent: #a8452f;
  --color-opponent-bg: #f6e8e3;
  --color-missing: #6b6458;
  --color-missing-bg: #ece9e2;
  --color-border: #ded7c9;
  --radius: 10px;
  --tap-min: 48px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.app-header__logo {
  display: flex;
  align-items: center;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.app-header__logo-img {
  display: block;
  height: 56px;
  width: auto;
  margin: 0;
}

.app-header__user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.app-header__username {
  font-weight: 600;
  color: var(--color-text);
}

.app-header__logout {
  color: var(--color-text-muted);
  text-decoration: underline;
}

.app-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-nav {
  position: relative;
}

.app-nav__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--color-text);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  list-style: none;
}

.app-nav__btn::-webkit-details-marker {
  display: none;
}

.app-nav__btn:hover,
.app-nav[open] .app-nav__btn {
  background: var(--color-border);
}

.app-nav__panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 20;
}

.app-nav__panel a {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 16px;
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border);
}

.app-nav__panel a:last-child {
  border-bottom: none;
}

.app-nav__panel a.is-current {
  color: var(--color-primary);
  background: var(--color-opponent-bg);
}

.app-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 32px;
}

/* PC幅ではもう少し広く使いたいページ用（例: 札取抄）。スマホ幅では.app-mainと同じ。 */
@media (min-width: 700px) {
  .app-main--wide {
    max-width: 760px;
  }
}

.page-title {
  font-size: 1.3rem;
  margin: 4px 0 4px;
}

.page-lede {
  color: var(--color-text-muted);
  margin: 0 0 18px;
  font-size: 0.95rem;
}

.card-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-panel--center {
  text-align: center;
}

/* ---------- buttons ---------- */

.btn {
  display: block;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  min-height: var(--tap-min);
  line-height: 1.2;
  cursor: pointer;
}

.btn--block {
  width: 100%;
}

.btn--large {
  min-height: 56px;
  font-size: 1.05rem;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}

.btn--primary:active {
  background: var(--color-primary-dark);
}

.btn--secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

/* ---------- demo mode ---------- */

.demo-cta {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 4px 0;
  text-align: center;
}

.demo-cta__title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 0.92rem;
}

.demo-cta__desc {
  margin: 0 0 10px;
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.demo-banner {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  line-height: 1.6;
}

.demo-banner__title {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--color-primary);
}

.demo-banner__desc {
  margin: 0 0 8px;
  color: var(--color-text-muted);
}

.demo-banner__cta {
  color: var(--color-primary);
  font-weight: 700;
  text-decoration: none;
}

/* ---------- 更新履歴の未読お知らせポップアップ ---------- */

dialog.changelog-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 20px;
  max-width: 420px;
  width: calc(100% - 32px);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

dialog.changelog-dialog::backdrop {
  background: rgba(42, 36, 28, 0.55);
}

.changelog-dialog__title {
  font-size: 1.1rem;
  margin: 0 0 12px;
}

.changelog-dialog__date {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin: 14px 0 4px;
}

.changelog-dialog__date:first-of-type {
  margin-top: 0;
}

.changelog-dialog__list {
  margin: 0;
  padding-left: 1.3em;
}

.changelog-dialog__list li {
  margin-bottom: 4px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.changelog-dialog__list a {
  color: var(--color-primary);
  font-weight: 600;
}

.changelog-dialog .btn {
  margin-top: 18px;
}

/* ---------- auth (Firebase login) ---------- */

.auth-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 32px 24px;
  margin: 24px auto;
}

.auth-card__head {
  text-align: center;
  margin-bottom: 4px;
}

.auth-card__mark {
  height: 72px;
  width: auto;
  margin-bottom: 8px;
}

.home-hero {
  text-align: center;
  margin: 0;
}

.home-hero .page-title {
  margin: 0 0 4px;
}

.brand-sub {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0 0 14px;
}

.auth-card__head .page-title {
  margin: 0 0 6px;
}

.auth-card__head .page-lede {
  margin: 0;
}

.form-field__label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}

.form-field__label-row .form-field__label {
  margin-bottom: 0;
}

.form-field__aux-link {
  font-size: 0.8rem;
  color: var(--color-primary);
  font-weight: 600;
  white-space: nowrap;
}

.btn--google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #3c4043;
  border: 1px solid var(--color-border);
}

.btn--google__icon {
  flex: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 4px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.auth-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 4px 0 0;
  text-align: center;
}

.auth-links a {
  color: var(--color-primary);
  font-weight: 700;
}

.legacy-login {
  margin-top: 18px;
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}

.legacy-login > summary {
  list-style: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.legacy-login > summary::-webkit-details-marker {
  display: none;
}

.legacy-login form {
  margin-top: 12px;
}

/* ---------- top page resume box ---------- */

.resume-box {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 6px;
}

.resume-box__label {
  margin: 0 0 4px;
  font-weight: 700;
  color: var(--color-primary);
}

.resume-box__meta {
  margin: 0 0 2px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.resume-box__progress {
  margin: 0 0 10px;
  font-weight: 700;
}

/* ---------- form ---------- */

.form-field {
  display: block;
  margin-bottom: 12px;
}

.form-field__label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: var(--tap-min);
  padding: 8px 12px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
}

.form-field textarea {
  min-height: 140px;
  resize: vertical;
}

.form-error {
  color: var(--color-opponent);
  font-size: 0.9rem;
}

.form-success {
  color: var(--color-self);
  font-size: 0.95rem;
  background: var(--color-self-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.feedback-note {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  line-height: 1.6;
  margin-top: 4px;
}

.feedback-back {
  margin-top: 4px;
}

.hp-field {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* ---------- long-form text pages (about/terms/privacy) ---------- */

.prose {
  line-height: 1.8;
  font-size: 0.95rem;
}

.prose h2 {
  font-size: 1.1rem;
  margin: 28px 0 10px;
}

.prose h3 {
  font-size: 0.98rem;
  margin: 18px 0 6px;
  color: var(--color-text-muted);
}

.prose p {
  margin: 0 0 14px;
}

.prose ul {
  margin: 0 0 14px;
  padding-left: 1.4em;
}

.prose li {
  margin-bottom: 4px;
}

.prose a {
  color: var(--color-primary);
  font-weight: 600;
}

.prose hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 28px 0 14px;
}

.prose__meta {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* ---------- footer ---------- */

.app-footer {
  max-width: 480px;
  margin: 32px auto 0;
  padding: 22px 20px 32px;
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.app-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 12px;
}

.app-footer__nav a {
  display: inline-block;
  color: var(--color-text-muted);
  font-size: 0.82rem;
  text-decoration: none;
  padding: 4px 8px;
}

.app-footer__nav a:not(:last-child)::after {
  content: "\00b7";
  margin-left: 16px;
  color: var(--color-border);
}

.app-footer__nav a:hover {
  color: var(--color-primary);
}

.app-footer__copyright {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  margin: 0;
}

.result-toggle {
  display: flex;
  gap: 10px;
}

.result-toggle__btn {
  flex: 1;
  min-height: var(--tap-min);
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 700;
  font-size: 1rem;
  transition: background-color 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}

.result-toggle__btn:active {
  transform: scale(0.98);
}

/* 勝ち・負けとも選択時は朱色で統一する（緑系は対戦帳の画面だけ） */
.result-toggle__btn--win.is-selected,
.result-toggle__btn--lose.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

/* ---------- summary / list / detail tables ---------- */

.summary-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 20px;
}

.summary-table th, .summary-table td {
  text-align: left;
  padding: 8px 4px;
  border-bottom: 1px solid var(--color-border);
}

.summary-table td {
  text-align: right;
  font-weight: 700;
}

.match-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.match-list__item {
  position: relative;
}

.match-list__link {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 44px 12px 14px;
  text-decoration: none;
  color: var(--color-text);
}

.match-list__menu {
  position: absolute;
  top: 6px;
  right: 6px;
}

.match-list__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  list-style: none;
}

.match-list__menu-btn::-webkit-details-marker {
  display: none;
}

.match-list__menu-btn:hover,
.match-list__menu[open] .match-list__menu-btn {
  background: var(--color-border);
}

.match-list__menu-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 10;
}

.match-list__menu-edit {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 18px;
  background: var(--color-surface);
  border: none;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: left;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.match-list__menu-delete {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 18px;
  background: var(--color-surface);
  border: none;
  color: var(--color-opponent);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap;
  text-align: left;
}

.match-list__date {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.match-list__result {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}

.match-list__result--win {
  background: var(--color-self-bg);
  color: var(--color-self);
}

.match-list__result--lose {
  background: var(--color-opponent-bg);
  color: var(--color-opponent);
}

.match-list__players {
  font-weight: 700;
  margin: 2px 0;
}

.match-list__stats {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.match-list__badge--sample {
  background: var(--color-missing-bg);
  color: var(--color-missing);
}

.match-list__badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.8rem;
  background: var(--color-opponent-bg);
  color: var(--color-opponent);
  padding: 2px 8px;
  border-radius: 999px;
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: 16px;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.detail-table th, .detail-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
}

.detail-table th {
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ---------- play screen: progress ---------- */

.play {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 448px;
  margin: 0 auto;
  background: #2a241c;
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-align: center;
  z-index: 50;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress__bar {
  flex: 1;
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.15s ease-out;
}

.progress__label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 4.5em;
  text-align: right;
}

/* ---------- play screen: kimariji + result ---------- */

.kimariji-display {
  text-align: center;
  padding: 18px 0 6px;
}

.kimariji-display--small {
  padding: 6px 0;
}

.kimariji-display__main {
  font-size: 3.2rem;
  font-weight: 700;
  line-height: 1.1;
}

.kimariji-display--small .kimariji-display__main {
  font-size: 1.6rem;
}

.kimariji-display__sub {
  margin-top: 6px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-btn {
  position: relative;
  min-height: 64px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 10px 20px 10px 44px;
  text-align: left;
}

.result-btn__check {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid currentColor;
}

.result-btn.is-selected .result-btn__check::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: currentColor;
}

.result-btn--self {
  background: var(--color-self-bg);
  color: var(--color-self);
}

.result-btn--opponent {
  background: var(--color-opponent-bg);
  color: var(--color-opponent);
}

.result-btn--missing {
  background: var(--color-missing-bg);
  color: var(--color-missing);
  font-size: 0.95rem;
  min-height: 52px;
}

.result-btn.is-selected {
  border-color: currentColor;
}

.result-btn:disabled,
.board button:disabled {
  opacity: 0.55;
}

.nav-back {
  display: inline-block;
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 10px 4px;
  min-height: var(--tap-min);
}

/* ---------- send/receive flags (optional, does not advance) ---------- */

.send-flags {
  display: flex;
  gap: 12px;
  margin: 6px 0 2px;
}

.send-flag-btn {
  position: relative;
  flex: 1;
  min-height: 56px;
  border-radius: var(--radius);
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 700;
  padding: 10px 14px 10px 42px;
  text-align: left;
  transition: background-color 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}

.send-flag-btn:active {
  transform: scale(0.98);
}

.send-flag-btn__check {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid currentColor;
}

.send-flag-btn.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.send-flag-btn.is-selected .send-flag-btn__check::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 3px;
  background: #fff;
}

.send-flag-btn:disabled {
  opacity: 0.55;
}

/* ---------- play screen: position board ---------- */

.board {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board__side-label {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.board__court-btn {
  min-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 700;
  font-size: 0.95rem;
}

.board__court-btn.is-selected {
  border-color: var(--color-primary);
  background: #fbeee9;
  color: var(--color-primary);
}

.board__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.board__quadrant {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}

.board__quadrant-head {
  border: none;
  background: #efe9dc;
  color: var(--color-text);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 8px 4px;
  min-height: 40px;
}

.board__quadrant-head.is-selected {
  background: var(--color-primary);
  color: #fff;
}

.board__rows {
  display: flex;
  flex-direction: column;
}

.board__rows button {
  border: none;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  min-height: 40px;
  font-size: 0.95rem;
}

.board__rows button.is-selected {
  background: var(--color-primary);
  color: #fff;
}

@media (min-width: 400px) {
  .kimariji-display__main {
    font-size: 3.6rem;
  }
}

/* ---------- card selection: method choice ---------- */

.method-btn {
  display: block;
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  text-align: left;
  color: var(--color-text);
  min-height: 64px;
  cursor: pointer;
}

.method-btn__title {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 2px;
}

.method-btn__desc {
  display: block;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* ---------- card selection: digit grid ---------- */

.digit-counter {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 4px 0;
}

.digit-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.digit-btn {
  min-height: 56px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 1.3rem;
  font-weight: 700;
}

.digit-btn.is-selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ---------- card selection: exclude 1 of 51 ---------- */

.exclude-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 90px;
}

.exclude-card {
  min-height: 56px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.exclude-card__num {
  font-weight: 700;
  font-size: 1.1rem;
}

.exclude-card__kimariji {
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.exclude-card.is-selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* 読まれた札の追加画面用: 番号より決まり字（読み）を主役にする。 */
.exclude-grid--kimariji-first .exclude-card__kimariji {
  order: -1;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.exclude-grid--kimariji-first .exclude-card__num {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.exclude-card.is-selected .exclude-card__num,
.exclude-card.is-selected .exclude-card__kimariji {
  color: #fff;
}

.exclude-confirm-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  max-width: 448px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  z-index: 40;
}

.exclude-confirm-bar[hidden] {
  display: none;
}

#exclude-confirm-text {
  font-weight: 700;
}

/* ---------- match detail: per-card edit link ---------- */

.edit-link {
  display: inline-block;
  min-height: 32px;
  line-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 0.8rem;
  text-decoration: none;
  white-space: nowrap;
}

/* ---------- single card edit screen ---------- */

.edit-context {
  margin: 0;
}

.edit-label {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

/* ---------- analysis: scope switch & tabs ---------- */

.scope-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.scope-switch__btn {
  display: block;
  text-align: center;
  min-height: 44px;
  line-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.scope-switch__btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 4px 0 12px;
  position: sticky;
  top: 0;
  background: var(--color-bg);
  padding: 6px 0;
  z-index: 10;
}

.tabs__btn {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.tabs__btn.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.subtabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 14px;
  overflow-x: auto;
}

.subtabs__btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.subtabs__btn.is-active {
  background: #efe9dc;
  border-color: var(--color-text-muted);
  color: var(--color-text);
}

.section-heading {
  font-size: 0.95rem;
  margin: 18px 0 8px;
  padding-top: 4px;
  border-top: 1px solid var(--color-border);
}

.section-heading:first-of-type {
  border-top: none;
  margin-top: 8px;
}

.completion-note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 4px 0 12px;
}

/* ---------- analysis: summary hero ---------- */

.summary-hero {
  text-align: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 8px;
}

.summary-hero__label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.summary-hero__value {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.summary-hero__count {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.highlight-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.highlight-box__item {
  border-radius: var(--radius);
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.95rem;
}

.highlight-box__item--strength {
  background: var(--color-self-bg);
  color: var(--color-self);
}

.highlight-box__item--weakness {
  background: var(--color-opponent-bg);
  color: var(--color-opponent);
}

.highlight-box__tag {
  display: inline-block;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 1px 8px;
  margin-right: 6px;
  background: rgba(0, 0, 0, 0.08);
}

/* ---------- analysis: rate bar ---------- */

.rate-bar {
  margin-bottom: 10px;
}

.rate-bar__head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.85rem;
  margin-bottom: 3px;
}

.rate-bar__label {
  font-weight: 700;
  color: var(--color-text);
}

.rate-bar__badge {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  background: var(--color-missing-bg);
  border-radius: 999px;
  padding: 0 6px;
}

.rate-bar__value {
  margin-left: auto;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.rate-bar__track {
  height: 10px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.rate-bar__fill {
  height: 100%;
  border-radius: 999px;
}

.rate-bar.rate-high .rate-bar__fill { background: var(--color-self); }
.rate-bar.rate-mid .rate-bar__fill { background: #b8892b; }
.rate-bar.rate-low .rate-bar__fill { background: var(--color-opponent); }
.rate-bar.rate-none .rate-bar__fill { background: var(--color-border); }

.rate-bar__composition {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ---------- analysis: 12-position board ---------- */

.analysis-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.analysis-board__side-label {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.analysis-board__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.analysis-board__row--single {
  grid-template-columns: 1fr;
}

.analysis-board__quadrant {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--color-surface);
}

.analysis-board__quadrant-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.analysis-board__cell {
  margin-bottom: 6px;
}

.analysis-board__cell .rate-bar {
  margin-bottom: 0;
}

.analysis-board__cell:not(.analysis-board__cell--labeled) .rate-bar__label {
  display: none;
}

.analysis-board__cell--labeled .rate-bar__label {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* ---------- analysis: tappable position cells ---------- */

.analysis-board__cell--link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.analysis-board__cell--link:active {
  opacity: 0.7;
}

.analysis-board__cell--expandable {
  position: relative;
  cursor: pointer;
}

.analysis-board__cell--expandable > summary {
  list-style: none;
  cursor: pointer;
}

.analysis-board__cell--expandable > summary::-webkit-details-marker {
  display: none;
}

.analysis-board__cell--expandable::after {
  content: "▸";
  position: absolute;
  top: 0;
  right: 0;
  font-size: 0.65rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.analysis-board__cell--expandable[open]::after {
  content: "▾";
}

.board-cell-detail {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--color-border);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.board-cell-detail__empty {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.board-cell-detail__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 999px;
}

.board-cell-detail__item small {
  font-size: 0.68rem;
  opacity: 0.8;
}

.board-cell-detail__item--self {
  background: var(--color-self-bg);
  color: var(--color-self);
}

.board-cell-detail__item--opponent {
  background: var(--color-opponent-bg);
  color: var(--color-opponent);
}

/* ---------- analysis: active position filter chip ---------- */

.position-filter-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  background: var(--color-self-bg);
  color: var(--color-self);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 12px;
}

.position-filter-chip__clear {
  margin-left: auto;
  font-size: 0.78rem;
  color: inherit;
  text-decoration: underline;
  white-space: nowrap;
}

/* ---------- analysis: tables ---------- */

.analysis-table th,
.analysis-table td {
  text-align: center;
}

.analysis-table th:first-child,
.analysis-table td:first-child {
  text-align: left;
}

.analysis-table--cross th,
.analysis-table--cross td {
  min-width: 52px;
}

.analysis-table--cross th:first-child {
  min-width: 90px;
}

/* 「件数も表示」スイッチ。オンのときだけ、割合の下に「取れた枚数/出た枚数」を小さく出す。 */
.cross-cell__n {
  display: none;
  font-size: 0.66rem;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.analysis-table--cross.is-show-n .cross-cell__n {
  display: block;
}

.n-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-bottom: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.n-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--color-primary);
  flex: none;
}

/* 子音別・母音別の表で、グループ名の下に含まれる初字を小さく添える。 */
.kana-members {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.card-sort {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.card-sort__link {
  font-size: 0.78rem;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  text-decoration: none;
}

.card-sort__link.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.cross-picker {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.cross-picker .form-field {
  flex: 1;
  margin-bottom: 0;
}

/* ---------- analysis: filter panel ---------- */

.analysis-filter-toggle {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  margin-bottom: 12px;
  overflow: hidden;
}

.analysis-filter-toggle > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.analysis-filter-toggle > summary::-webkit-details-marker {
  display: none;
}

.analysis-filter-toggle > summary::before {
  content: "▸";
  color: var(--color-text-muted);
  font-size: 0.75rem;
}

.analysis-filter-toggle[open] > summary::before {
  content: "▾";
}

.analysis-filter-toggle__badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--color-primary);
  color: #fff;
  padding: 1px 8px;
  border-radius: 999px;
}

.analysis-filter {
  padding: 0 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.analysis-filter__row {
  display: flex;
  gap: 10px;
}

.analysis-filter__row .form-field {
  flex: 1;
}

.analysis-filter .btn {
  margin-top: 6px;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-group__item {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--color-surface);
}

.checkbox-group__item:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-opponent-bg);
  color: var(--color-primary);
}

/* ---------- 札取抄（自動分析レポート） ---------- */

.torisho-masthead {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.torisho-masthead__eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  font-weight: 700;
}

.torisho-masthead__title {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0;
}

.torisho-masthead__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.torisho-masthead__meta span {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 12px;
}

.torisho-masthead__meta strong {
  color: var(--color-text);
  font-weight: 700;
}

.torisho-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

.torisho-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.torisho-hero__figure {
  text-align: center;
}

.torisho-hero__value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.torisho-hero__label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.torisho-courts {
  display: flex;
  gap: 10px;
  flex: 1;
  min-width: 220px;
}

.torisho-court-tile {
  flex: 1;
  min-width: 0;
  background: var(--color-bg);
  border-radius: 10px;
  padding: 10px 12px;
}

.torisho-pos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.torisho-court-tile--low-n { border: 1px dashed var(--color-text-muted); opacity: 0.75; }

.torisho-court-tile__label { font-size: 0.75rem; color: var(--color-text-muted); font-weight: 700; }
.torisho-court-tile__rate { font-size: 1.2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.torisho-court-tile__n { font-size: 0.72rem; color: var(--color-text-muted); }

.torisho-bar-track {
  height: 6px;
  background: var(--color-border);
  border-radius: 999px;
  margin-top: 6px;
  overflow: hidden;
}

.torisho-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-primary);
}

.torisho-heat-scroll { overflow-x: auto; }

table.torisho-heat {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 0.78rem;
}

table.torisho-heat th,
table.torisho-heat td {
  padding: 8px 6px;
  text-align: center;
  border: 1px solid var(--color-border);
}

table.torisho-heat thead th {
  background: var(--color-bg);
  font-weight: 700;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

table.torisho-heat tbody th {
  background: var(--color-bg);
  font-weight: 700;
  white-space: nowrap;
}

.torisho-heat-cell { font-variant-numeric: tabular-nums; font-weight: 700; }
.torisho-heat-cell__n { display: block; font-weight: 400; font-size: 0.68rem; color: var(--color-text-muted); }
.torisho-heat-cell--low-n { opacity: 0.55; border-style: dashed; }
.torisho-heat-cell--empty { color: var(--color-text-muted); font-weight: 400; }

.torisho-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 10px;
}

.torisho-legend-scale {
  width: 90px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgb(217, 138, 115), rgb(245, 243, 238), rgb(122, 178, 143));
  border: 1px solid var(--color-border);
}

.torisho-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.torisho-compare-grid > * { min-width: 0; }

.torisho-compare-box {
  background: var(--color-bg);
  border-radius: 10px;
  padding: 12px 14px;
}

.torisho-compare-box--flag { background: var(--color-opponent-bg); }
.torisho-compare-box__title { font-size: 0.8rem; font-weight: 700; margin-bottom: 6px; }
.torisho-compare-box__rate { font-size: 1.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.torisho-compare-box__n { font-size: 0.72rem; color: var(--color-text-muted); }
.torisho-compare-box__vs {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 8px;
  line-height: 1.5;
}

.torisho-chip-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.torisho-chip-cols > * { min-width: 0; }

.torisho-chip-col__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.torisho-chip-col__label--strength { color: var(--color-self); }
.torisho-chip-col__label--weakness { color: var(--color-opponent); }

.torisho-chip-list { display: flex; flex-direction: column; gap: 6px; }

.torisho-chip {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

.torisho-chip--self { background: var(--color-self-bg); color: var(--color-self); }
.torisho-chip--opp { background: var(--color-opponent-bg); color: var(--color-opponent); }
.torisho-chip__name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.torisho-chip__stat { font-size: 0.72rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.torisho-chip--rich { flex-direction: column; align-items: stretch; gap: 3px; }
.torisho-chip--rich .torisho-chip__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.torisho-chip__sub {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--color-text-muted);
  display: flex;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.torisho-subgroup-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-text-muted);
  margin: 18px 0 8px;
}

.torisho-subgroup-title:first-of-type { margin-top: 4px; }

@media (max-width: 480px) {
  .torisho-compare-grid,
  .torisho-chip-cols {
    grid-template-columns: 1fr;
  }
  .torisho-hero {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------- 札取抄への導線（トップ・分析画面） ---------- */

.feature-promo {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--color-self-bg), var(--color-surface));
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--color-text);
  margin-top: 12px;
}

.feature-promo__icon { font-size: 1.6rem; line-height: 1; }
.feature-promo__body { flex: 1; min-width: 0; }
.feature-promo__title {
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.feature-promo__badge {
  font-size: 0.62rem;
  font-weight: 800;
  color: #fff;
  background: var(--color-primary);
  border-radius: 999px;
  padding: 1px 7px;
  letter-spacing: 0.04em;
}
.feature-promo__desc {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.feature-promo__arrow { font-size: 1.1rem; color: var(--color-text-muted); }

/* ---------- 札取抄-比べ-（fudatorisho_compare.php） ---------- */

:root {
  --cmp-bar-a: #35597d;
  --cmp-bar-b: #c9bea8;
}

.cmp-lede { font-size: 0.85rem; color: var(--color-text-muted); margin: 0; }
.cmp-sub { font-size: 0.78rem; color: var(--color-text-muted); margin: 4px 0 0; }

.cmp-ctl-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: 14px 0 6px;
}
.cmp-ctl-label:first-child { margin-top: 0; }

.cmp-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cmp-seg__btn {
  display: block;
  text-align: center;
  min-height: 44px;
  line-height: 44px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
.cmp-seg__btn.is-active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.cmp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp-chip-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}
.cmp-chip-btn.is-active { background: #efe9dc; border-color: var(--color-text-muted); color: var(--color-text); }

.cmp-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.cmp-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 12px;
}
.cmp-legend strong { color: var(--color-text); }
.cmp-sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: none; }
.cmp-sw--a { background: var(--cmp-bar-a); }
.cmp-sw--b { background: var(--cmp-bar-b); }

.cmp-fine { font-size: 0.72rem; color: var(--color-text-muted); margin: 10px 0 0; }
.cmp-warn {
  margin: 10px 0 0;
  font-size: 0.8rem;
  background: var(--color-opponent-bg);
  color: var(--color-primary-dark);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.cmp-hint { font-size: 0.8rem; color: var(--color-text-muted); background: var(--color-bg); border-radius: var(--radius); padding: 10px 12px; margin: 10px 0 0; }
.cmp-empty { font-size: 0.8rem; color: var(--color-text-muted); padding: 6px 0; margin: 0; }

/* 項目ごとの比較行（B→Aの2本の棒。取得率は0%起点なので長さがそのまま比較になる） */
.cmp-rows { display: flex; flex-direction: column; margin-top: 8px; }
.cmp-row { padding: 12px 0; border-top: 1px solid var(--color-border); }
.cmp-row:first-child { border-top: 0; }
.cmp-row__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cmp-row__label { font-weight: 800; font-size: 0.95rem; }
.cmp-row__label small { font-weight: 400; color: var(--color-text-muted); font-size: 0.72rem; margin-left: 6px; }
.cmp-row__n { font-size: 0.7rem; color: var(--color-text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
.cmp-row__extra { font-size: 0.74rem; color: var(--color-text-muted); margin-top: 2px; }

.cmp-bars { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.cmp-bar { display: grid; grid-template-columns: 4.6em 1fr; gap: 8px; align-items: center; }
.cmp-bar__name { font-size: 0.74rem; color: var(--color-text-muted); font-weight: 700; }
.cmp-bar__track { position: relative; height: 24px; background: var(--color-bg); border-radius: 5px; overflow: hidden; }
.cmp-bar__fill { height: 100%; border-radius: 5px; min-width: 2px; }
.cmp-bar__fill--a { background: var(--cmp-bar-a); }
.cmp-bar__fill--b { background: var(--cmp-bar-b); }
.cmp-bar__mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--color-text-muted); opacity: 0.35; z-index: 1; }
.cmp-bar__val {
  position: absolute;
  top: 0;
  line-height: 24px;
  font-size: 0.85rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
.cmp-bar__val--in { color: #fff; }

.cmp-pill {
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.cmp-pill--up { background: var(--color-self-bg); color: var(--color-self); }
.cmp-pill--down { background: var(--color-opponent-bg); color: var(--color-opponent); }
.cmp-pill--flat { background: var(--color-missing-bg); color: var(--color-text-muted); }
.cmp-pill--low { background: transparent; color: var(--color-text-muted); border: 1px dashed var(--color-text-muted); font-weight: 600; }

.cmp-grp { font-size: 0.78rem; font-weight: 800; margin: 16px 0 6px; }
.cmp-grp--down { color: var(--color-opponent); }
.cmp-grp--up { color: var(--color-self); }
.cmp-grp--flat { color: var(--color-text-muted); }

.cmp-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cmp-points li { font-size: 0.88rem; padding-left: 22px; position: relative; }
.cmp-points li::before { position: absolute; left: 0; top: 0; font-size: 0.8rem; }
.cmp-points li.is-down::before { content: "▼"; color: var(--color-opponent); }
.cmp-points li.is-up::before { content: "▲"; color: var(--color-self); }
.cmp-points li.is-flat::before { content: "＝"; color: var(--color-text-muted); }
.cmp-points b { white-space: nowrap; }

/* ヒートマップ（差分） */
.cmp-heat-wrap { margin-top: 10px; overflow-x: auto; }
table.cmp-heat { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; min-width: 290px; }
.cmp-heat th { font-size: 0.68rem; font-weight: 700; color: var(--color-text-muted); padding: 2px 0; text-align: center; }
.cmp-heat th.cmp-heat__rowh { width: 58px; text-align: left; color: var(--color-text); padding-right: 2px; font-size: 0.64rem; white-space: nowrap; }
.cmp-heat tr.cmp-heat__sep th,
.cmp-heat tr.cmp-heat__sep td { padding-top: 6px; }
.cmp-heat__cell {
  text-align: center;
  border-radius: 6px;
  padding: 6px 0 5px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.cmp-heat__d { font-size: 0.92rem; font-weight: 800; line-height: 1.15; display: block; }
.cmp-heat__s { font-size: 0.58rem; color: var(--color-text-muted); display: block; margin-top: 1px; letter-spacing: -0.02em; }
.cmp-heat__cell--low { border: 1px dashed var(--color-text-muted); }
.cmp-heat__cell--low .cmp-heat__d { color: var(--color-text-muted); font-weight: 600; }
.cmp-heat__cell--empty { color: var(--color-text-muted); background: var(--color-bg); cursor: default; }
.cmp-heat__cell--tot { border-color: var(--color-border); }
.cmp-heat__cell.is-selected { outline: 2px solid var(--color-text); }
.cmp-heat__cell:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.cmp-heat-detail {
  margin-top: 10px;
  font-size: 0.8rem;
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 10px 12px;
  min-height: 3.2em;
  font-variant-numeric: tabular-nums;
}
.cmp-legend-scale { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 0.72rem; color: var(--color-text-muted); flex-wrap: wrap; }
.cmp-legend-scale__bar {
  width: 120px;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgb(217, 138, 115), rgb(245, 243, 238), rgb(122, 178, 143));
}

/* 変わったところ・変わらなかったところ */
.cmp-chiplist { display: flex; flex-direction: column; gap: 6px; }
.cmp-chip { border-radius: var(--radius); padding: 8px 12px; border: 1px solid var(--color-border); }
.cmp-chip--down { background: var(--color-opponent-bg); border-color: #e8cfc7; }
.cmp-chip--up { background: var(--color-self-bg); border-color: #cde3d5; }
.cmp-chip--flat { background: var(--color-missing-bg); }
.cmp-chip__head { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 0.9rem; }
.cmp-chip__d { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-chip--down .cmp-chip__d { color: var(--color-opponent); }
.cmp-chip--up .cmp-chip__d { color: var(--color-self); }
.cmp-chip--flat .cmp-chip__d { color: var(--color-text-muted); }
.cmp-chip__sub { font-size: 0.74rem; color: var(--color-text-muted); margin-top: 1px; font-variant-numeric: tabular-nums; }

/* 初字別 */
.cmp-init {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--color-border);
  font-variant-numeric: tabular-nums;
}
.cmp-init__ch { font-size: 1.25rem; font-weight: 800; text-align: center; }
.cmp-init__v { font-size: 0.85rem; }
.cmp-init__v i { font-style: normal; font-size: 0.7rem; color: var(--color-text-muted); margin-left: 6px; }

.cmp-guide {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  padding-left: 1.2em;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cmp-guide b { color: var(--color-text); }

/* ===== 札ログ トップ整理案: style.css への追加／変更 ===== */

/* [変更] .home-hero: カード型・中央寄せ → 横並びの細い帯（高さ約52px）。 .auth-card は外す */
.home-hero { display: flex; align-items: center; gap: 12px; margin: 0; padding: 0 2px; text-align: left; }
.home-hero__mark { display: block; flex: none; width: 48px; height: 48px; }
.home-hero .page-title { margin: 0; font-size: 1.25rem; line-height: 1.2; }
.home-hero .brand-sub { margin: 3px 0 0; line-height: 1; white-space: nowrap; }
.home-hero > div { flex: none; }

/* [新規] ページ内の縦リズム（.card-panel の代わり） */
.home { display: flex; flex-direction: column; gap: 18px; }

/* [変更] .resume-box: 縦積み → 左に文言・右にボタンの横並び（約90px） */
.resume-box { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; }
.resume-box__text { flex: 1; min-width: 0; }
.resume-box__label { margin: 0; font-size: 0.85rem; }
.resume-box__meta { margin: 2px 0 0; font-size: 0.78rem; line-height: 1.4; }
.resume-box__progress { margin: 2px 0 0; font-size: 0.78rem; }
.resume-box .btn { flex: none; width: auto; white-space: nowrap; padding: 12px 16px; }

/* [新規] 最重要ボタン（.btn--large と併用） */
.btn--record { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 64px; font-size: 1.1rem; }

/* [新規] 見出し付きグループ */
.home-group__title { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; color: var(--color-text-muted); }
.home-group__title::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }

/* [新規] 行リスト（旧 .btn--secondary のリンク2つ + .feature-promo 2つ + .btn--taisencho を統一） */
.home-list { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.home-list--accent { border-color: var(--color-primary); }
.home-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 14px; color: var(--color-text); text-decoration: none; }
.home-row + .home-row { border-top: 1px solid var(--color-border); }
.home-row:active { background: var(--color-bg); }
.home-row__icon { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; background: var(--color-bg); }
.home-row__body { flex: 1; min-width: 0; }
.home-row__title { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.95rem; line-height: 1.3; }
.home-row__desc { display: block; margin-top: 2px; font-size: 0.78rem; line-height: 1.4; color: var(--color-text-muted); }
.home-row__arrow { flex: none; color: var(--color-text-muted); }
.ico { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico--sm { width: 18px; height: 18px; }

/* [新規] 対戦帳だけ少し特別な行 */
.home-row--featured { min-height: 76px; background: #fbeee9; }
.home-row--featured:active { background: var(--color-opponent-bg); }
.home-row--featured .home-row__icon { width: 44px; height: 44px; background: var(--color-primary); color: #fff; }
.home-row--featured .home-row__title { font-size: 1.05rem; font-weight: 800; color: var(--color-primary-dark); }
.home-row--featured .home-row__desc { color: #5e5547; }
.home-row--featured .home-row__arrow { color: var(--color-primary); }

/* [新規] NEWバッジ: .badge-new の span を消すだけで外せる */
.badge-new { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em; line-height: 1; padding: 3px 6px; border-radius: 999px; color: var(--color-primary-dark); background: #fff; border: 1px solid var(--color-primary); }

/* [新規・任意] 直近の戦績（1件以上登録済みのときだけ出力） */
.taisencho-recent { display: flex; align-items: center; margin-top: 4px; font-size: 0.78rem; color: #5e5547; }
.taisencho-recent__label { margin-right: 8px; }
.taisencho-recent__r { font-weight: 800; letter-spacing: 0.12em; }
.taisencho-recent__r--win { color: var(--color-self); }
.taisencho-recent__r--lose { color: var(--color-opponent); }

/* [新規] 分析グループ: 「分析を見る」は .home-row--featured（対戦帳と同格）、札取抄2つはアシスト（一段小さく・インデント） */
.home-row--sub { min-height: 52px; padding-left: 28px; background: #faf8f4; }
.home-row--sub .home-row__icon { width: 30px; height: 30px; background: var(--color-surface); border: 1px solid var(--color-border); }
.home-row--sub .home-row__icon .ico { width: 18px; height: 18px; }
.home-row--sub .home-row__title { font-size: 0.88rem; font-weight: 600; }
.home-row--sub .home-row__desc { font-size: 0.75rem; }

/* [新規] 「分析を見る」を対戦帳と同格のメイン行に。右に小さな棒グラフ装飾 */
.home-row__spark { flex: none; width: 40px; height: 26px; fill: var(--color-primary); }

/* 試合情報フォームの補足文 */
#match-form .btn + .btn { margin-top: 10px; }
.form-hint { margin: 10px 2px 0; font-size: 0.8rem; line-height: 1.5; color: var(--color-text-muted); }

/* ---------- 試合の共有（match_share.php / share.php） ---------- */
.share-notice { margin: 0 0 16px; padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); font-size: 0.9rem; line-height: 1.6; }
.share-notice p { margin: 0 0 8px; }
.share-notice p:last-child { margin-bottom: 0; }
.share-box { margin: 0 0 12px; }
.share-box input[readonly] { font-size: 0.85rem; }
.share-actions { margin-top: 20px; }
.share-summary { margin: 0 0 16px; padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.share-summary dt { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 8px; }
.share-summary dt:first-child { margin-top: 0; }
.share-summary dd { margin: 2px 0 0; font-size: 1rem; }
.share-similar { margin: 0 0 12px; padding: 8px 10px; background: var(--color-missing-bg); border-radius: var(--radius); }
.btn[hidden] { display: none; }
