/* マイページ・プロフィール・つぶやき・ユーザー設定。
   構造はX風（見出し→1段のタブ→中身）に現代化し、色と質感はサイトの語彙
   (羊皮紙 #F7F5E4 / こげ茶 #261914 / 金 #F3EBA2 / 朱 #a0171a / 二重罫線 #996 / 明朝) から取る。
   マイページ・プロフィール・設定・スレッドは同じ幅（.ps-page）にそろえ、画面を移っても位置が変わらないようにする。 */

.ps-page {
    max-width: 760px;
    margin: 0 auto 30px;
}
/* hidden 属性で隠す部品（続きを読む・ミニメの入力欄など）に display を指定すると、
   ブラウザ標準の「hidden なら出さない」が負けて常に見えてしまうので、ここで必ず隠す */
.ps-page [hidden] {
    display: none !important;
}

/* --- 共通のボタン（サイト全体の button 指定を打ち消す） ---------------------- */
.ps-btn,
button.ps-btn,
.st-save,
button.st-save,
.tb-compose .tb-submit,
.mp-more button,
.mp-more-link,
.mp-band {
    display: inline-block;
    max-width: none;
    margin: 0;
    padding: 6px 16px;
    border: 2px solid #261914;
    border-radius: 999px;
    background: #fff;
    color: #261914;
    font-size: 0.88rem;
    font-weight: bold;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: none;
    cursor: pointer;
}
.ps-btn:hover,
.st-save:hover {
    background: #F3EBA2;
    text-decoration: none;
}
.ps-btn.is-primary,
.st-save,
button.st-save,
.tb-compose .tb-submit,
.mp-more button,
.mp-more-link,
.mp-band {
    background: #261914;
    color: #F3EBA2;
}
.ps-btn.is-primary:hover,
.st-save:hover {
    background: #a0171a;
    border-color: #a0171a;
    color: #fff;
}
.ps-btn.is-on {
    background: #F3EBA2;
    border-color: #996;
}
/* 主役でない操作（ミニメなど）は小さく */
.ps-btn.is-small,
button.ps-btn.is-small {
    padding: 4px 12px;
    border-width: 1px;
    font-size: 0.8rem;
    font-weight: normal;
}
.tb-compose .tb-submit:disabled {
    opacity: .45;
    cursor: default;
}

/* --- 見出し（プロフィール・マイページ） --------------------------------------- */
/* 枠はサイトの .border と同じ質感（白地に羊皮紙のにじみ・二重線・影） */
.ps-head,
.st-preview,
.ps-bar,
.ps-body {
    border: 5px double #996;
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 3px 10px #000, 0 0 300px #F7F5E4 inset;
    color: #261914;
}
.ps-head,
.st-preview {
    padding: 12px 14px;
}
.ps-top {
    display: flex;
    align-items: center;
    gap: 10px;
}
.ps-avatar {
    flex: 0 0 auto;
}
.ps-avatar .badge-frame {
    width: 52px;
    height: 52px;
    margin: 0;
    padding: 3px;
}
/* 枠だけ大きくしても中の絵が30pxのままなので、枠いっぱいに広げる */
.ps-avatar .badge-frame .badge {
    width: 100%;
    height: 100%;
}
.ps-id {
    flex: 1 1 auto;
    min-width: 0;
}
.ps-name {
    margin: 0;
    font-family: ten-mincho, serif;
    font-size: 1.3rem;
    line-height: 1.3;
    color: #261914;
    word-break: break-word;
}
.ps-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    margin-top: 2px;
    font-size: 0.82rem;
    color: #6b5a4a;
}
.ps-turtles img {
    width: auto;
    height: 18px;
    vertical-align: middle;
}
.ps-settings {
    flex: 0 0 auto;
    align-self: flex-start;
}
.ps-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 2px;
}
.ps-actions:empty {
    display: none;
}
/* アイコンのボタン（丸いアイコン＋下に短い文字）。文字があるので、絵だけで何のボタンか迷わない */
.ps-ibtn,
button.ps-ibtn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 54px;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: #261914;
    text-decoration: none;
    cursor: pointer;
}
.ps-ico {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 2px solid #261914;
    border-radius: 50%;
    background: #fff;
    color: #261914;
}
.ps-ibtn:hover .ps-ico {
    background: #F3EBA2;
}
.ps-ibtn.is-primary .ps-ico {
    background: #261914;
    color: #F3EBA2;
}
.ps-ibtn.is-primary:hover .ps-ico {
    border-color: #a0171a;
    background: #a0171a;
    color: #fff;
}
.ps-ibtn.is-on .ps-ico {
    border-color: #996;
    background: #F3EBA2;
}
.ps-ibtn[aria-expanded="true"] .ps-ico {
    background: #F3EBA2;
}
.ps-ibtn-label {
    font-size: 0.7rem;
    line-height: 1.2;
    color: #6b5a4a;
    white-space: nowrap;
}
.ps-ibtn:hover .ps-ibtn-label {
    text-decoration: underline;
}
.ps-inline-form {
    display: inline;
    margin: 0;
}
.ps-mail {
    margin-top: 10px;
}
.ps-mail textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #996;
    border-radius: 8px;
    font-size: 1rem;
}
.ps-mail-foot {
    margin-top: 6px;
    text-align: right;
}
.ps-note {
    margin: 10px 0 0;
    font-size: 0.85rem;
    color: #6b5a4a;
}
.ps-bio-wrap {
    position: relative;
    margin-top: 8px;
}
.ps-bio {
    line-height: 1.7;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}
.ps-bio.is-short {
    -webkit-line-clamp: 2;
}
@media (max-width: 480px) {
    .ps-bio {
        -webkit-line-clamp: 2;
    }
}
.ps-bio.is-open {
    display: block;
    overflow: visible;
}
.ps-bio-more,
button.ps-bio-more {
    /* 畳んだ最後の行の右端に重ねる。左側は地の色へぼかし、文の終わりを隠しすぎない */
    position: absolute;
    right: 0;
    bottom: 0;
    display: inline-block;
    max-width: none;
    margin: 0;
    padding: 0 0 0 2.2em;
    border: 0;
    border-radius: 0;
    background: linear-gradient(90deg, rgba(253, 252, 246, 0), #fdfcf6 40%);
    line-height: 1.7;
    box-shadow: none;
    color: #a0171a;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}
/* 開いた後の「閉じる」は文の下、右端に置く（重ねると最後の行を隠す） */
.ps-bio-more.is-open,
button.ps-bio-more.is-open {
    position: static;
    display: block;
    margin: 2px 0 0 auto;
    padding: 0;
    background: none;
}
body.dark-mode .ps-bio-more.is-open,
body.dark-mode button.ps-bio-more.is-open {
    background: none;
}
.ps-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin-top: 6px;
}
/* 数字は枠をやめて文字だけで1行に並べる（Xの「フォロー中・フォロワー」と同じ形）。間は「·」 */
.ps-stat,
button.ps-stat {
    display: inline-block;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: #261914;
    font-size: 0.85rem;
    line-height: 1.6;
}
.ps-stat + .ps-stat::before {
    content: "·";
    display: inline-block;
    margin: 0 7px;
    color: #8a7a5a;
    text-decoration: none;
}
.ps-stat b {
    margin-right: 3px;
    font-size: 0.95rem;
}
/* 一覧へ移れる札だけ下線（サイトのリンクと同じ）。「正解」は移る先が無いので下線なし */
a.ps-stat {
    text-decoration: underline;
}
a.ps-stat:hover {
    color: #a0171a;
}
button.ps-record-toggle {
    cursor: pointer;
    color: #6b5a4a;
}
button.ps-record-toggle::after {
    content: " ▾";
}
button.ps-record-toggle[aria-expanded="true"]::after {
    content: " ▴";
}
.ps-record {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px dashed #996;
    border-radius: 8px;
    background: #fff;
    font-size: 0.85rem;
}
.ps-record dl {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 2px 14px;
    margin: 0;
}
.ps-record dt {
    color: #6b5a4a;
}
.ps-record dd {
    margin: 0;
}
.ps-record-row {
    margin-top: 8px;
}
.ps-record-label {
    display: block;
    margin-bottom: 2px;
    color: #6b5a4a;
}
.ps-shelf {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}
.ps-shelf-label {
    flex: 0 0 auto;
    font-size: 0.8rem;
    color: #6b5a4a;
}
.ps-shelf-item {
    flex: 0 0 auto;
    padding: 3px 12px;
    border: 2px solid #805731;
    border-radius: 10px;
    background: #9e6d3f;
    color: #fff !important;
    font-size: 0.8rem;
    font-weight: bold;
    text-decoration: none;
}
.ps-shelf-item small {
    margin-left: 5px;
    font-weight: normal;
    opacity: .9;
}

/* --- タブ：サイトの .subnavi-wrapper（ランキングの「月間/累計」と同じ）をそのまま使う --- */
.ps-tabs.subnavi-wrapper {
    margin: 12px 0 0;
}
.ps-tabs .subnavi,
.ps-tabs .subnavi2 {
    float: none;
    margin: 0;
    padding: 8px 2px;
    font-family: ten-mincho, serif;
    font-size: 1.02rem;
    font-weight: bold;
    letter-spacing: 0;
    white-space: nowrap;
}
@media (max-width: 480px) {
    .ps-tabs .subnavi,
    .ps-tabs .subnavi2 {
        font-size: 0.92rem;
    }
}
.ps-tabs .subnavi a {
    color: #261914;
}
.mp-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 4px;
    border-radius: 50%;
    background: #a0171a;
    vertical-align: super;
}

/* 評価タブの中：「つけた評価／もらった評価」の2択＋Good・ブクマ（・問題集）＋いま見ている一覧の見出し */
.ps-rate {
    margin-top: 10px;
    padding: 12px 14px;
    border: 5px double #996;
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 3px 10px #000, 0 0 300px #F7F5E4 inset;
    color: #261914;
}
.ps-rate-side {
    display: flex;
    gap: 8px;
}
.ps-rate-btn {
    flex: 1 1 0;
    padding: 8px 4px;
    border: 3px double #996;
    border-radius: 8px;
    background: #fff;
    color: #261914 !important;
    font-family: ten-mincho, serif;
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}
a.ps-rate-btn:hover {
    background: #F3EBA2;
    text-decoration: none;
}
.ps-rate-btn.is-active {
    border-color: #996;
    background: #261914;
    color: #F3EBA2 !important;
}
.ps-rate-kind {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.ps-rate-chip {
    padding: 4px 16px;
    border: 1px solid #996;
    border-radius: 999px;
    background: #fff;
    color: #261914 !important;
    font-size: 0.88rem;
    text-decoration: none;
}
a.ps-rate-chip:hover {
    background: #F3EBA2;
    text-decoration: none;
}
.ps-rate-chip.is-active {
    border-color: #261914;
    background: #261914;
    color: #F3EBA2 !important;
    font-weight: bold;
}
.ps-rate-cap {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #996;
    font-weight: bold;
    font-size: 1.02rem;
}
.ps-rate-cap small {
    margin-left: 6px;
    font-weight: normal;
    font-size: 0.85rem;
    color: #6b5a4a;
}
body.dark-mode .ps-rate {
    background-color: #15202b;
    box-shadow: 0 3px 10px #000, 0 0 300px #15202b inset;
    color: #F3F4F4;
}
body.dark-mode .ps-rate-btn,
body.dark-mode .ps-rate-chip {
    background: #10171f;
    color: #F3F4F4 !important;
}
body.dark-mode .ps-rate-btn.is-active,
body.dark-mode .ps-rate-chip.is-active {
    background: #261914;
    border-color: #F3EBA2;
    color: #F3EBA2 !important;
}
body.dark-mode .ps-rate-cap small {
    color: #b8b29a;
}

/* --- 中身 ---------------------------------------------------------------- */
.ps-body {
    margin-top: 10px;
    overflow: hidden;
}
/* 問題一覧は既存のカードに枠があるので、外枠は付けない */
.ps-body.ps-body-list {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
}
.ps-count {
    margin: 0 2px 6px;
    font-size: 0.85rem;
    color: #6b5a4a;
}
.ps-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
}
.ps-back {
    flex: 0 1 auto;
    max-width: 60%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 3px 12px;
    border: 1px solid #996;
    border-radius: 999px;
    background: #fff;
    color: #261914 !important;
    font-size: 0.82rem;
    text-decoration: none;
    white-space: nowrap;
}
.ps-back::before {
    content: "‹ ";
}
.ps-bar-title {
    margin: 0;
    font-family: ten-mincho, serif;
    font-size: 1.2rem;
    color: #261914;
}

/* --- 書く欄 ------------------------------------------------------------ */
.tb-compose {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #fdfcf3;
}
.tb-compose textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 4.6em;
    padding: 8px 10px;
    border: 1px solid #996;
    border-radius: 8px;
    background: #fff;
    color: #261914;
    font-size: 1rem;
    line-height: 1.6;
    resize: vertical;
}
.tb-compose textarea:focus {
    outline: none;
    border-color: #a0171a;
    box-shadow: 0 0 0 2px rgba(160, 23, 26, .15);
}
.tb-compose-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.tb-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: auto;
    border: 1px solid #996;
    border-radius: 50%;
    background: #fff;
    color: #6b5a4a !important;
    font-size: 0.8rem;
    font-weight: bold;
    text-decoration: none;
}
.tb-help:hover {
    background: #F3EBA2;
    text-decoration: none;
}
.tb-count {
    font-size: 0.85rem;
    color: #6b5a4a;
    white-space: nowrap;
}
.tb-count.is-over {
    color: #a0171a;
    font-weight: bold;
}
.tb-error {
    margin: 6px 0 0;
    color: #a0171a;
    font-size: 0.85rem;
}

/* --- カード ------------------------------------------------------------ */
.tb-card {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #fff;
}
.tb-card.is-new {
    background: #fffbe0;
    box-shadow: inset 4px 0 0 #a0171a;
}
.tb-card.is-reply {
    background: #fcfbf3;
}
.tb-card.is-focus {
    background: #F3EBA2;
}
/* 一覧の返信のツリー。つぶやきのバッジの真下から線を引き、返信を小さめに並べる */
.tb-thread {
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #fff;
}
.tb-thread > .tb-card {
    border-bottom: 0;
}
.tb-tree {
    margin: -4px 0 0 33px;
    padding: 0 0 6px;
    border-left: 2px solid rgba(153, 153, 102, .55);
}
.tb-tree .tb-card.is-tree {
    gap: 8px;
    padding: 6px 12px 6px 12px;
    border-bottom: 0;
    background: transparent;
}
.tb-tree .tb-card.is-focus {
    background: #F3EBA2;
}
.tb-tree .tb-avatar {
    width: 28px;
}
.tb-tree .tb-avatar .badge-frame {
    width: 28px;
    height: 28px;
    padding: 2px;
}
.tb-tree .tb-body {
    margin-top: 2px;
    font-size: 0.98rem;
    line-height: 1.7;
}
.tb-tree .tb-actions {
    margin-top: 0;
}
.tb-tree-more,
button.tb-tree-more {
    display: block;
    max-width: none;
    margin: 4px 0 2px 12px;
    padding: 2px 4px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    box-shadow: none;
    color: #a0171a;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}
.tb-tree-more:hover {
    background: rgba(243, 235, 162, .7);
}
/* 返信の2段目。1段目のまとまり（.tb-branch）の中で、1段目のバッジの真下から線を引いて字下げする */
.tb-branch {
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #fcfbf3;
}
.tb-branch > .tb-card {
    border-bottom: 0;
}
.tb-subtree {
    margin: -6px 0 6px 33px;
    border-left: 2px solid rgba(153, 153, 102, .55);
}
.tb-subtree:empty {
    display: none;
}
.tb-subtree .tb-card {
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 0;
    background: transparent;
}
.tb-subtree .tb-card.is-focus {
    background: #F3EBA2;
}
.tb-subtree .tb-avatar {
    width: 28px;
}
.tb-subtree .tb-avatar .badge-frame {
    width: 28px;
    height: 28px;
    padding: 2px;
}
.tb-subtree .tb-body {
    margin-top: 2px;
    font-size: 0.98rem;
    line-height: 1.7;
}
.tb-subtree .tb-actions {
    margin-top: 0;
}
/* 一覧のツリーの中では、まとまりの地と区切りを付けず、線だけでつなぐ */
.tb-tree .tb-branch {
    border-bottom: 0;
    background: transparent;
}
.tb-tree .tb-subtree {
    margin: -4px 0 2px 25px;
}
/* 返信への返信の欄（1段目のまとまりの最後に開く） */
.tb-branch > .tb-compose.is-inline {
    margin: 0 12px 10px 47px;
    padding: 8px 10px;
    border: 1px solid rgba(153, 153, 102, .55);
    border-radius: 8px;
}
.tb-cancel,
button.tb-cancel {
    max-width: none;
    margin: 0 auto 0 0;
    padding: 2px 6px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #6b5a4a;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}
.tb-avatar {
    flex: 0 0 auto;
    width: 40px;
}
/* サイトのバッジ枠はPCで58px・スマホで38pxと変わるので、どの幅でも列に収まる大きさに固定する
   （PCで列からはみ出し、本文に食い込んでいた） */
.tb-avatar .badge-frame {
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 3px;
}
.tb-avatar .badge-frame .badge {
    width: 100%;
    height: 100%;
}
.tb-main {
    flex: 1 1 auto;
    min-width: 0;
}
.tb-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 2px 6px;
    font-size: 0.88rem;
}
.tb-name {
    font-weight: bold;
    color: #261914;
}
.tb-degree {
    color: #8a7a5a;
    font-size: 0.78rem;
}
.tb-time {
    color: #8a7a5a;
    font-size: 0.8rem;
    text-decoration: none;
}
.tb-time:hover {
    text-decoration: underline;
}
.tb-new {
    padding: 0 6px;
    border-radius: 999px;
    background: #a0171a;
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
}
.tb-body {
    margin-top: 4px;
    font-size: 1.06rem;
    line-height: 1.8;
    color: #261914;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.tb-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 22px;
    margin-top: 4px;
}
/* 押しやすさのため、アイコンだけの操作も 32px 四方以上の当たりを取る */
.tb-actions .tb-act {
    min-width: 32px;
    min-height: 32px;
    justify-content: center;
}
.tb-act,
button.tb-act {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    max-width: none;
    margin: 0;
    padding: 3px 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-shadow: none;
    color: #6b5a4a;
    font-size: 0.82rem;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
}
.tb-act:hover {
    background: rgba(243, 235, 162, .7);
    text-decoration: none;
}
.tb-num {
    margin-left: 3px;
    font-weight: bold;
}
.tb-like-img {
    width: 18px;
    height: auto;
}
.tb-like .tb-like-on,
.tb-like.is-on .tb-like-off {
    display: none;
}
.tb-like.is-on .tb-like-on {
    display: inline;
}
.tb-like.is-on {
    color: #a0171a;
    font-weight: bold;
}
.tb-del {
    margin-left: auto !important;
}
.tb-del:hover {
    color: #a0171a;
}

/* つぶやきタブの「ブクマ相手も／自分だけ」。見た目は評価タブの「つけた／もらった」と同じボタン */
.ps-feed-switch {
    display: flex;
    gap: 8px;
    padding: 12px 14px 0;
}
.ps-feed-switch .ps-rate-btn {
    padding: 6px 4px;
    font-size: 0.95rem;
}

/* つぶやきの流れに混ぜるブクマ相手の出題 */
.tb-kind {
    padding: 0 7px;
    border: 1px solid #996;
    border-radius: 999px;
    background: #F7F5E4;
    color: #6b5a4a;
    font-size: 0.72rem;
    font-weight: bold;
}
.tb-mondai {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 8px 10px;
    border: 3px double #996;
    border-radius: 8px;
    background: #fdfcf3;
    color: #261914 !important;
    text-decoration: none;
}
.tb-mondai:hover {
    background: #F3EBA2;
    text-decoration: none;
}
.tb-mondai-state {
    flex: 0 0 auto;
    padding: 1px 8px;
    border-radius: 999px;
    background: #8a7a5a;
    color: #fff;
    font-size: 0.75rem;
    font-weight: bold;
}
.tb-mondai-state.is-open {
    background: #a0171a;
}
.tb-mondai-title {
    min-width: 0;
    font-family: ten-mincho, serif;
    font-size: 1.04rem;
    font-weight: bold;
    overflow-wrap: anywhere;
}

/* ユーザーブックマーク（人の一覧と解除） */
.ub-count {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #F7F5E4;
    color: #6b5a4a;
    font-size: 0.88rem;
}
.ub-count a {
    margin-left: 8px;
}
.ub-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #fff;
}
.ub-avatar .badge-frame {
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 3px;
}
.ub-avatar .badge-frame .badge {
    width: 100%;
    height: 100%;
}
.ub-main {
    flex: 1 1 auto;
    min-width: 0;
}
.ub-meta {
    margin-top: 2px;
    color: #8a7a5a;
    font-size: 0.8rem;
}
.ub-form {
    flex: 0 0 auto;
}
body.dark-mode .ub-row {
    background: #15202b;
}
body.dark-mode .ub-count {
    background: #10171f;
    color: #b8b29a;
}

/* --- 空・もっと見る・帯・区切り -------------------------------------------- */
.mp-empty {
    padding: 28px 18px;
    text-align: center;
    color: #6b5a4a;
    line-height: 1.8;
}
.mp-empty-title {
    font-family: ten-mincho, serif;
    font-size: 1.1rem;
    font-weight: bold;
    color: #261914;
}
.mp-more {
    padding: 14px;
    text-align: center;
}
.mp-band {
    display: block;
    width: calc(100% - 28px);
    margin: 10px 14px 0;
    text-align: center;
}
.mp-section {
    padding: 10px 14px 6px;
    font-family: ten-mincho, serif;
    font-weight: bold;
    color: #261914;
}
.ps-body .mp-section {
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #F7F5E4;
}
.mp-section small {
    font-family: sans-serif;
    font-weight: normal;
    color: #6b5a4a;
}

/* --- 反応（返信といいね） --------------------------------------------------- */
.mp-activity {
    display: flex;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #fff;
    color: #261914 !important;
    font-size: 0.9rem;
    line-height: 1.6;
    text-decoration: none;
}
.mp-activity:hover {
    background: #fdfcf3;
    text-decoration: none;
}
.mp-activity.is-new {
    background: #fffbe0;
    box-shadow: inset 4px 0 0 #a0171a;
}
.mp-activity-kind {
    flex: 0 0 auto;
    align-self: flex-start;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #996;
    background: #F7F5E4;
    color: #261914;
}
.mp-kind-img {
    width: 16px;
    height: auto;
}
/* 画面には出さず、読み上げにだけ伝える文字 */
.u-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
.mp-activity-kind.is-like {
    border-color: #a0171a;
    color: #a0171a;
}
.mp-activity-kind.is-good {
    border-color: #b8860b;
    background: #fff6d6;
    color: #7a5600;
}
.mp-activity-kind.is-book,
.mp-activity-kind.is-collect {
    border-color: #805731;
    color: #805731;
}
.mp-activity-main {
    min-width: 0;
}
.mp-activity-quote {
    display: block;
    margin-top: 2px;
    color: #8a7a5a;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mp-likers {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(153, 153, 102, .55);
    background: #F7F5E4;
    font-size: 0.88rem;
}
.mp-likers-title {
    font-weight: bold;
    margin-bottom: 4px;
}
.mp-likers a {
    display: inline-block;
    margin: 2px 8px 2px 0;
}

/* --- ユーザー設定 -------------------------------------------------------- */
.st-preview {
    margin-top: 10px;
}
.st-preview-label {
    margin-bottom: 6px;
    font-size: 0.78rem;
    color: #6b5a4a;
}
.st-list {
    margin-top: 10px;
}
.st-sec {
    margin-bottom: 8px;
    border: 1px solid rgba(153, 153, 102, .7);
    border-radius: 10px;
    background: #fff;
    color: #261914;
}
.st-sec > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    list-style: none;
    cursor: pointer;
}
.st-sec > summary::-webkit-details-marker {
    display: none;
}
.st-sec > summary::after {
    content: "▾";
    margin-left: 4px;
    color: #996;
}
.st-sec[open] > summary {
    border-bottom: 3px double #996;
}
.st-sec[open] > summary::after {
    content: "▴";
}
.st-title {
    flex: 0 0 auto;
    font-family: ten-mincho, serif;
    font-weight: bold;
    font-size: 1.02rem;
}
.st-hint {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
    font-size: 0.82rem;
    color: #6b5a4a;
}
.st-hint-badge {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}
.st-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin: 0 3px 0 6px;
    border: 1px solid #996;
    border-radius: 3px;
    vertical-align: middle;
}
.st-body {
    padding: 12px 14px;
}
.st-textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #996;
    border-radius: 8px;
    font-size: 1rem;
    line-height: 1.6;
}
.st-help {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: #6b5a4a;
    line-height: 1.6;
}
.st-actions {
    margin-top: 10px;
    text-align: right;
}
.st-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
}
.st-row select {
    flex: 1 1 160px;
    min-width: 0;
    padding: 6px;
    border: 1px solid #996;
    border-radius: 6px;
}
.st-label {
    flex: 1 1 100%;
    font-size: 0.85rem;
    color: #6b5a4a;
}
.st-row .st-label + .st-save,
.st-row span.st-label {
    flex: 1 1 auto;
}
.st-badge-grid {
    display: flex;
    flex-wrap: wrap;
}
.st-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}
.st-color {
    flex: 1 1 200px;
}
.st-sub {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed #996;
}
.st-locked {
    display: flex;
    flex-wrap: wrap;
}
.st-sec .push-setting {
    padding: 0;
}
.st-logout {
    margin: 18px 0 0;
    text-align: center;
}

/* --- ミニメ（受信・送信） --------------------------------------------------- */
.mm-list {
    margin-top: 10px;
}
.mm-card {
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 5px double #996;
    border-radius: 10px;
    background-color: #fff;
    box-shadow: 0 3px 10px #000, 0 0 300px #F7F5E4 inset;
    color: #261914;
}
/* 未読は左に朱の線、地を少し明るく */
.mm-card.is-unread {
    border-left: 6px solid #a0171a;
    box-shadow: 0 3px 10px #000, 0 0 300px #fff6c8 inset;
}
.mm-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}
.mm-avatar .badge-frame {
    margin: 0;
}
.mm-who {
    font-weight: bold;
}
.mm-to {
    margin-right: 4px;
    font-size: 0.75rem;
    font-weight: normal;
    color: #8a7a5a;
}
.mm-time {
    margin-left: auto;
    font-size: 0.8rem;
    color: #8a7a5a;
}
.mm-badge {
    padding: 0 7px;
    border-radius: 999px;
    background: #a0171a;
    color: #fff;
    font-size: 0.72rem;
    font-weight: bold;
}
.mm-read {
    padding: 0 7px;
    border: 1px solid #996;
    border-radius: 999px;
    font-size: 0.72rem;
    color: #8a7a5a;
}
.mm-body {
    margin-top: 8px;
    font-size: 1.02rem;
    line-height: 1.8;
    word-break: break-word;
    overflow-wrap: anywhere;
}
.mm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px 14px;
    margin-top: 8px;
}
.mm-note {
    font-size: 0.82rem;
    color: #8a7a5a;
}
.mm-link,
button.mm-link {
    display: inline;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    color: #8a7a5a;
    font-size: 0.82rem;
    text-decoration: underline;
    cursor: pointer;
}
.mm-reply {
    margin-top: 8px;
}
.mm-reply textarea {
    display: block;
    box-sizing: border-box;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #996;
    border-radius: 8px;
    font-size: 1rem;
}
.mm-reply-foot {
    margin-top: 6px;
    text-align: right;
}
.mm-pager {
    margin: 10px 0 0;
    text-align: center;
}
body.dark-mode .mm-card {
    background-color: #15202b;
    box-shadow: 0 3px 10px #000, 0 0 300px #15202b inset;
    color: #F3F4F4;
}
body.dark-mode .mm-card.is-unread {
    border-left-color: #ff6b6b;
    box-shadow: 0 3px 10px #000, 0 0 300px #2a2416 inset;
}
body.dark-mode .mm-time,
body.dark-mode .mm-to,
body.dark-mode .mm-read,
body.dark-mode .mm-note,
body.dark-mode button.mm-link {
    color: #b8b29a;
}
body.dark-mode button.mm-link {
    background: none;
    border: 0;
    box-shadow: none;
}
body.dark-mode .mm-reply textarea {
    background: #10171f;
    color: #F3F4F4;
}

/* --- マイ質問：同じ問題への質問を見出しでまとめる -------------------------------- */
.mq-head {
    clear: both;
    margin: 18px 0 6px;
    padding: 4px 2px 6px;
    border-bottom: 3px double #996;
    font-family: ten-mincho, serif;
    font-size: 1.05rem;
    font-weight: bold;
}
.mq-head:first-child {
    margin-top: 4px;
}
.mq-head a {
    color: #261914;
}
.mq-wait {
    padding: 0 7px;
    border-radius: 999px;
    background: #a0171a;
    color: #fff;
    font-weight: bold;
}
body.dark-mode .mq-head a {
    color: #F3EBA2;
}

/* --- ロビーのロビーチャット欄（行は旧ロビーチャットと同じ talk-box） ------------ */
.lobby-chat-log {
    margin-top: 8px;
}
.lobby-chat-enter {
    display: block;
    margin: 10px auto 4px;
    padding: 8px 20px;
    max-width: 18em;
    border: 2px solid #F3EBA2;
    border-radius: 999px;
    background: #261914;
    color: #F3EBA2 !important;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
}
.lobby-chat-enter:hover {
    background: #a0171a;
    text-decoration: none;
}

/* --- ダークモード ------------------------------------------------------- */
body.dark-mode .ps-head,
body.dark-mode .st-preview,
body.dark-mode .ps-bar,
body.dark-mode .ps-body {
    background-color: #15202b;
    box-shadow: 0 3px 10px #000, 0 0 300px #15202b inset;
    color: #F3F4F4;
}
body.dark-mode .ps-name,
body.dark-mode .ps-bar-title,
body.dark-mode .mp-empty-title,
body.dark-mode .mp-section,
body.dark-mode .tb-name,
body.dark-mode .st-title {
    color: #F3EBA2;
}
body.dark-mode .tb-card,
body.dark-mode .mp-activity,
body.dark-mode .st-sec,
body.dark-mode .ps-record,
body.dark-mode .ps-back,
body.dark-mode .tb-help {
    background: #10171f;
    color: #F3F4F4 !important;
}
body.dark-mode .ps-body.ps-body-list {
    background: transparent;
}
body.dark-mode .mp-dot {
    background: #ff6b6b;
}
body.dark-mode .ps-body .mp-section,
body.dark-mode .mp-likers {
    background: #15202b;
}
body.dark-mode .tb-compose {
    background: #15202b;
}
body.dark-mode .tb-compose textarea,
body.dark-mode .ps-mail textarea,
body.dark-mode .st-textarea {
    background: #10171f;
    color: #F3F4F4;
}
body.dark-mode .tb-card.is-reply {
    background: #182634;
}
body.dark-mode .tb-card.is-new,
body.dark-mode .mp-activity.is-new {
    background: #2a2416;
}
body.dark-mode .tb-card.is-focus {
    background: #3a3218;
}
body.dark-mode .tb-thread {
    background: #10171f;
}
body.dark-mode .tb-tree .tb-card.is-tree {
    background: transparent;
}
body.dark-mode .tb-tree .tb-card.is-focus {
    background: #3a3218;
}
body.dark-mode .tb-branch {
    background: #182634;
}
body.dark-mode .tb-tree .tb-branch,
body.dark-mode .tb-subtree .tb-card {
    background: transparent;
}
body.dark-mode .tb-subtree .tb-card.is-focus {
    background: #3a3218;
}
body.dark-mode button.tb-cancel {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #b8b29a;
}
body.dark-mode button.tb-tree-more {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #ff8a8a;
}
body.dark-mode .tb-body {
    color: #F3F4F4;
}
body.dark-mode .ps-meta,
body.dark-mode .ps-note,
body.dark-mode .ps-record dt,
body.dark-mode .ps-record-label,
body.dark-mode .ps-shelf-label,
body.dark-mode .ps-count,
body.dark-mode .tb-act,
body.dark-mode .tb-time,
body.dark-mode .tb-degree,
body.dark-mode .tb-count,
body.dark-mode .mp-empty,
body.dark-mode .mp-activity-quote,
body.dark-mode .st-hint,
body.dark-mode .st-help,
body.dark-mode .st-label,
body.dark-mode .st-preview-label {
    color: #b8b29a;
}
/* サイト全体の body.dark-mode button（青地）に負けないよう、ボタンは個別に戻す */
body.dark-mode button.tb-act,
body.dark-mode button.ps-bio-more {
    background: transparent;
    border: 0;
    box-shadow: none;
}
body.dark-mode .tb-act:hover,
body.dark-mode button.tb-act:hover {
    background: rgba(243, 235, 162, .12);
}
body.dark-mode .ps-btn,
body.dark-mode button.ps-btn {
    background: #10171f;
    border-color: #996;
    color: #F3EBA2;
}
body.dark-mode .ps-btn.is-primary,
body.dark-mode .st-save,
body.dark-mode button.st-save,
body.dark-mode .tb-compose .tb-submit,
body.dark-mode .mp-more button,
body.dark-mode .mp-more-link,
body.dark-mode .mp-band {
    background: #261914;
    border-color: #F3EBA2;
    color: #F3EBA2 !important;
}
body.dark-mode .ps-btn.is-on {
    background: #3a3218;
}
body.dark-mode .ps-bio-more,
body.dark-mode .tb-like.is-on,
body.dark-mode .tb-error,
body.dark-mode .tb-count.is-over {
    color: #ff8a8a;
}
body.dark-mode .mp-activity-kind {
    background: #261914;
    color: #F3EBA2;
}

@media (max-width: 480px) {
    .ps-head,
    .tb-compose,
    .tb-card,
    .mp-activity {
        padding-left: 10px;
        padding-right: 10px;
    }
    /* 線はバッジの真下に合わせる（カードの左の余白が狭くなる分） */
    .tb-tree {
        margin-left: 29px;
    }
    .tb-tree .tb-card.is-tree,
    .tb-subtree .tb-card {
        padding-left: 10px;
        padding-right: 10px;
    }
    .tb-subtree {
        margin-left: 29px;
    }
    .tb-tree .tb-subtree {
        margin-left: 23px;
    }
    .tb-branch > .tb-compose.is-inline {
        margin: 0 10px 10px 30px;
    }
    .ps-avatar .badge-frame {
        width: 56px;
        height: 56px;
    }
    .ps-name {
        font-size: 1.25rem;
    }
}

/* ページ内タブの文字。明るい地の色（こげ茶）のままだと、ダークの地（紺）に溶けて読めなかった。
   サイトのサブナビ（ダーク）と同じ色にする */
body.dark-mode .ps-tabs .subnavi a {
    color: #F3F4F4;
}
body.dark-mode .mp-section small {
    color: #b8b29a;
}

/* 通知の種類の札。朱・茶の文字はダークの地では暗すぎるので明るくする */
body.dark-mode .mp-activity-kind.is-like {
    border-color: #e57373;
    color: #f2a0a0;
}
body.dark-mode .mp-activity-kind.is-book,
body.dark-mode .mp-activity-kind.is-collect {
    border-color: #c79a6b;
    color: #e2c39d;
}
/* 設定の選択中の丸ボタン。サイト共通の灰色の地はダークで文字が薄くなるので、設定の中だけこげ茶地に金の文字にする */
body.dark-mode .st-list input[type="radio"]:checked + label.radio-text {
    border-color: #996;
    background: #261914;
    color: #F3EBA2;
}

/* 見出しのアイコンのボタンと「続き」のダークモード */
body.dark-mode .ps-ico {
    border-color: #F3EBA2;
    background: #10171f;
    color: #F3EBA2;
}
body.dark-mode .ps-ibtn:hover .ps-ico,
body.dark-mode .ps-ibtn[aria-expanded="true"] .ps-ico {
    background: #261914;
}
body.dark-mode .ps-ibtn.is-primary .ps-ico {
    background: #F3EBA2;
    color: #261914;
}
body.dark-mode .ps-ibtn.is-on .ps-ico {
    border-color: #996;
    background: #261914;
    color: #F3EBA2;
}
body.dark-mode .ps-ibtn-label {
    color: #b8b29a;
}
body.dark-mode .ps-bio-more,
body.dark-mode button.ps-bio-more {
    background: linear-gradient(90deg, rgba(21, 32, 43, 0), #15202b 40%);
}

/* 一本化（2026-10-25）で足した部品のダークモード */
body.dark-mode .ps-stat,
body.dark-mode button.ps-stat {
    border: 0;
    background: transparent;
    color: #F3F4F4;
}
body.dark-mode button.ps-record-toggle {
    color: #b8b29a;
}
body.dark-mode a.ps-stat:hover {
    color: #f0a0a0;
}
body.dark-mode button.ps-ibtn {
    border: 0;
    background: transparent;
    box-shadow: none;
}
body.dark-mode .tb-kind {
    background: #10171f;
    color: #b8b29a;
}
body.dark-mode .tb-mondai {
    background: #10171f;
    color: #F3F4F4 !important;
}
body.dark-mode .tb-mondai:hover {
    background: #261914;
}
body.dark-mode .mp-activity-kind.is-good {
    background: #2a2410;
    color: #F3EBA2;
}
