/* Reef — Discord と同じ文字装飾（md.js が組んだ物）の見た目。class="md" の中だけに効く。
   色は app.css の変数を使う（暗い画面）。スマホの幅でも、長い URL は折り返し、コードの塊は横に流す。 */

.md { color: var(--text); line-height: 1.6; overflow-wrap: anywhere; word-break: normal; min-width: 0; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }

/* 段落と改行 */
.md p { margin: 0 0 .6em; }
.md blockquote > :last-child, .md li > :last-child { margin-bottom: 0; }

/* 見出し（app.css の h2 / h3 より強く） */
.md h1, .md h2, .md h3 { color: var(--text); font-weight: 700; line-height: 1.35; margin: .7em 0 .35em; letter-spacing: .01em; }
.md h1 { font-size: 20px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 15px; }
.md .subtext { color: var(--dim); font-size: 12px; line-height: 1.5; margin: 0 0 .5em; }

/* 行の中 */
.md strong { font-weight: 700; color: var(--text); }
.md em { font-style: italic; }
.md u { text-decoration: underline; text-underline-offset: 2px; }
.md s { color: var(--muted); }
.md a.link { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; word-break: break-word; }
.md a.link:hover { text-decoration: underline; }
.md a.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* コード */
.md code.inline {
  font-family: var(--mono); font-size: .88em; padding: .1em .35em; border-radius: 4px;
  background: var(--panel3); border: 1px solid var(--line); color: var(--text);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.md pre.codeblock {
  margin: .45em 0 .7em; padding: 10px 12px; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  background: var(--term); border: 1px solid var(--line); border-radius: var(--radius-s);
}
.md pre.codeblock[data-lang]::before {
  content: attr(data-lang); display: block; margin-bottom: 6px;
  color: var(--dim); font: 600 11px/1.2 var(--sans); letter-spacing: .04em; text-transform: lowercase;
}
.md pre.codeblock code { display: block; font: 12.5px/1.55 var(--mono); color: #dbe3ea; white-space: pre; tab-size: 4; }

/* 引用 */
.md blockquote.quote {
  margin: .35em 0 .7em; padding: 2px 0 2px 12px; border-left: 4px solid var(--line2); border-radius: 2px; color: var(--text);
}

/* 箇条書き */
.md ul, .md ol { margin: .3em 0 .7em; padding-left: 1.5em; }
.md li { margin: .15em 0; }
.md li > ul, .md li > ol { margin: .15em 0; }
.md ul { list-style: disc; }
.md ul ul { list-style: circle; }
.md ul ul ul { list-style: square; }

/* 伏せ字: 押すまで中身を隠す（中のリンクとコードも押せない・選べない） */
.md .spoiler {
  background: var(--panel3); color: transparent; border-radius: 4px; padding: 0 2px;
  cursor: pointer; user-select: none; -webkit-user-select: none; transition: background .15s, color .15s;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.md .spoiler:hover { background: var(--line2); }
.md .spoiler:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.md .spoiler:not(.shown) * { opacity: 0; pointer-events: none; }
.md .spoiler.shown { background: rgba(255, 255, 255, .06); color: inherit; cursor: auto; user-select: text; -webkit-user-select: text; }

/* 札（メンション・時刻・絵文字の名前） */
.md .mention {
  display: inline; padding: 0 .3em; border-radius: 4px; font-weight: 550; white-space: nowrap;
  background: rgba(var(--accent-rgb), .14); color: var(--accent-2);
}
.md .mention.everyone { background: rgba(242, 201, 76, .14); color: var(--gold); }
.md .mention.command { font-family: var(--mono); font-size: .92em; }
.md time.ts { padding: 0 .3em; border-radius: 4px; background: var(--panel3); color: var(--text); white-space: nowrap; }
.md .emoji { color: var(--muted); }

@media (max-width: 720px) {
  .md h1 { font-size: 18px; }
  .md h2 { font-size: 16px; }
  .md pre.codeblock { padding: 8px 10px; }
  .md pre.codeblock code { font-size: 12px; }
  .md .mention, .md time.ts { white-space: normal; }
}
