:root {
  --paper:  #eaecf1;
  --panel:  #ffffff;
  --ink:    #171c2e;
  --mist:   #5c6480;
  --rule:   #c3c8d4;
  --seal:   #c0392f;

  --serif: "Nanum Myeongjo", serif;
  --sans:  "Pretendard", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;

  --gutter: clamp(1rem, 4vw, 2.5rem);
}

* { box-sizing: border-box; }

/* hidden 속성이 붙은 요소는 어떤 display 값보다 우선해서 숨긴다 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
}

a { color: inherit; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- 상단바 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.9rem 1.6rem;
  padding: 0.8rem var(--gutter);
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.brand {
  order: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  width: 10px;
  height: 26px;
  background: var(--ink);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  width: 22px;
  height: 2px;
  background: var(--seal);
}

.brand-name {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.06em;
  padding-left: 0.7rem;
}

.tabs {
  order: 2;
  display: flex;
  gap: 1.05rem;
  margin-right: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tabs a {
  text-decoration: none;
  color: var(--mist);
  font-size: 0.94rem;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs a:hover { color: var(--ink); }

.account {
  order: 3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--mist);
  flex-shrink: 0;
}
.account strong { color: var(--ink); font-weight: 600; }

.admin-chip {
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--seal);
  color: var(--seal);
}

/* ---------------------------------------------------------------- 레이아웃 */

.view {
  max-width: 62rem;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 6rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-bottom: 1.3rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.section-head h1,
.section-head h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.note { color: var(--mist); font-size: 0.88rem; }

/* ---------------------------------------------------------------- 히어로 */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(12.5rem, 0.8fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: clamp(1.4rem, 3.5vw, 2.3rem);
  margin-bottom: 2.5rem;
}
.hero-body { min-height: 7rem; display: flex; flex-direction: column; justify-content: center; }

.hero-kicker {
  font-size: 0.82rem;
  color: var(--mist);
  margin: 0 0 0.9rem;
}

.hero-quote {
  font-family: var(--serif);
  font-size: clamp(1.3rem, 2.9vw, 1.95rem);
  line-height: 1.6;
  margin: 0;
  overflow-wrap: anywhere;
}
/* 짧은 대목은 크게 키워 왼쪽이 허전해 보이지 않게 한다 */
.hero-quote.short { font-size: clamp(1.6rem, 4.2vw, 2.6rem); }

.hero-side {
  border-left: 1px solid var(--rule);
  padding-left: clamp(1.2rem, 3vw, 2rem);
}
.hero-cover {
  display: block;
  width: 5.5rem;
  margin-bottom: 0.9rem;
  border: 1px solid var(--rule);
}
.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.02rem;
  margin: 0 0 0.9rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.hero-meta { margin: 0 0 1.3rem; }
.hero-meta div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.32rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.85rem;
}
.hero-meta dt { color: var(--mist); margin: 0; }
.hero-meta dd { margin: 0; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 목록 */

.story-list { display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); }

.story-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--panel);
  text-decoration: none;
}
.story-row:hover { background: #f7f8fb; }

.row-main { min-width: 0; }

.story-row h3 {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.55;
  /* body 의 keep-all 을 여기서만 풀어, 띄어쓰기 없는 긴 제목이 배지 옆부터 흐르게 한다 */
  word-break: break-word;
  overflow-wrap: anywhere;
}
.row-title { margin-right: 0.2rem; }

.story-row p {
  margin: 0.3rem 0 0;
  color: var(--mist);
  font-size: 0.88rem;
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}

.story-stats {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  font-size: 0.82rem;
  color: var(--mist);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.story-stats .stat-main { color: var(--ink); font-weight: 600; }
.story-stats .stat-time { font-size: 0.78rem; }

.kind {
  display: inline-block;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.72rem;
  line-height: 1.35;
  padding: 0.08rem 0.4rem;
  margin-right: 0.4rem;
  border: 1px solid var(--rule);
  color: var(--mist);
  vertical-align: 0.12em;
  white-space: nowrap;
}
.kind.webtoon { border-color: var(--ink); color: var(--ink); }

.closed-tag {
  display: inline-block;
  margin-left: 0.35rem;
  color: var(--mist);
  font-size: 0.72rem;
  line-height: 1.35;
  border: 1px solid var(--rule);
  padding: 0.08rem 0.4rem;
  font-family: var(--sans);
  font-weight: 400;
  vertical-align: 0.12em;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 회차 실타래 */

.thread { position: relative; padding-left: 2.6rem; }
.thread::before {
  content: "";
  position: absolute;
  left: 0.72rem;
  top: 0.6rem;
  bottom: 3.5rem;
  width: 1px;
  background: var(--rule);
}

.episode { position: relative; margin-bottom: 2.2rem; }

.episode::before {
  content: "";
  position: absolute;
  left: -2.6rem;
  top: 0.45rem;
  width: 0.75rem;
  height: 0.75rem;
  border: 1px solid var(--ink);
  background: var(--paper);
  transform: translateX(0.35rem);
}
.episode.is-best::before { background: var(--seal); border-color: var(--seal); }

.episode-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem 0.7rem;
  font-size: 0.86rem;
  color: var(--mist);
  margin-bottom: 0.6rem;
}
.episode-seq { font-family: var(--serif); font-size: 1rem; font-weight: 700; color: var(--ink); }

.episode-body {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.3rem 1.4rem;
}

.episode-text {
  font-family: var(--serif);
  font-size: 1.03rem;
  line-height: 1.95;
  white-space: pre-wrap;
  margin: 0;
  max-width: 42em;
}

.episode-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin-top: 1rem;
  border: 1px solid var(--rule);
}
.episode-body > .episode-image:first-child { margin-top: 0; }

.episode-foot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.blinded {
  background: repeating-linear-gradient(135deg, #e3e6ec 0 8px, #dde1e9 8px 16px);
  border: 1px dashed var(--rule);
  padding: 1.6rem 1.4rem;
  color: var(--mist);
  font-size: 0.92rem;
  text-align: center;
}

/* BEST 낙관 도장 */
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.1rem;
  height: 3.1rem;
  border: 2px solid var(--seal);
  border-radius: 2px;
  color: var(--seal);
  font-family: var(--serif);
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.1;
  text-align: center;
  transform: rotate(-7deg);
  flex-shrink: 0;
  opacity: 0.9;
}

.episode-mark {
  position: absolute;
  right: 1rem;
  top: 1.6rem;
}

/* ---------------------------------------------------------------- 버튼 */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  padding: 0.5rem 1.05rem;
  cursor: pointer;
  font-size: 0.92rem;
  text-decoration: none;
}
.btn:hover { background: #0e1220; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: #dfe3ea; }

.btn.quiet {
  background: transparent;
  border-color: transparent;
  color: var(--mist);
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
}
.btn.quiet:hover { color: var(--ink); background: #e2e5ec; }

.btn.like.on { border-color: var(--seal); color: var(--seal); background: transparent; }
.btn.danger { border-color: var(--seal); color: var(--seal); background: transparent; }
.btn.danger:hover { background: var(--seal); color: #fff; }

.btn.small { padding: 0.3rem 0.65rem; font-size: 0.82rem; }

/* ---------------------------------------------------------------- 폼 */

.form {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: clamp(1.25rem, 4vw, 2rem);
  max-width: 34rem;
}
.form.wide { max-width: none; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: 0.86rem; margin-bottom: 0.35rem; }
.field .hint { color: var(--mist); font-size: 0.8rem; margin-top: 0.3rem; }

input[type=text], input[type=password], input[type=number], textarea, select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  background: #fbfbfd;
  border: 1px solid var(--rule);
  border-radius: 0;
}
textarea { resize: vertical; min-height: 9rem; line-height: 1.8; font-family: var(--serif); }

input[type=file] { font-size: 0.86rem; }

.radio-row { display: flex; gap: 1.2rem; }
.radio-row label { display: flex; align-items: center; gap: 0.4rem; margin: 0; }

.form-foot { display: flex; align-items: center; gap: 0.9rem; margin-top: 1.4rem; }

.error {
  color: var(--seal);
  font-size: 0.88rem;
  margin: 0 0 1rem;
}

.split { display: grid; gap: 2.5rem; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 40rem) { .split { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- 쿨타임 */

.cooldown {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--mist);
}
.cooldown-bar {
  flex: 1;
  max-width: 10rem;
  height: 3px;
  background: var(--rule);
  position: relative;
}
.cooldown-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--ink);
}

/* ---------------------------------------------------------------- 표 */

.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; background: var(--panel); }
.table th, .table td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.table th { font-weight: 600; color: var(--mist); font-size: 0.8rem; }
.table tr.suspended td { background: #fdf1f0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); }

.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

.stat-row { display: flex; flex-wrap: wrap; gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-bottom: 2rem; }
.stat {
  flex: 1 1 8rem;
  background: var(--panel);
  padding: 0.9rem 1rem;
}
.stat b { display: block; font-family: var(--serif); font-size: 1.6rem; line-height: 1.2; }
.stat span { font-size: 0.82rem; color: var(--mist); }
.stat.alert b { color: var(--seal); }

.report-card {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.1rem 1.2rem;
  margin-bottom: 1rem;
}
.report-card blockquote {
  margin: 0.8rem 0;
  padding: 0.8rem 1rem;
  background: #f5f6f9;
  border-left: 2px solid var(--rule);
  font-family: var(--serif);
  white-space: pre-wrap;
  max-height: 12rem;
  overflow: auto;
}
.report-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }

.empty {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--mist);
  background: var(--panel);
  border: 1px dashed var(--rule);
}
.empty p { margin: 0 0 1.1rem; }

/* ---------------------------------------------------------------- 토스트 & 모달 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translate(-50%, 1.5rem);
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.2rem;
  font-size: 0.9rem;
  max-width: min(30rem, 90vw);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s, visibility 0s 0.18s;
  z-index: 60;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 0.18s, transform 0.18s, visibility 0s 0s;
}
.toast.warn { background: var(--seal); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(23, 28, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  z-index: 50;
}
/* hidden 속성이 붙으면 무조건 숨긴다 (.modal 의 display:flex 보다 우선) */
.modal[hidden] { display: none; }
.modal-sheet {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.6rem;
  width: min(28rem, 100%);
  max-height: 85vh;
  overflow: auto;
}
.modal-sheet h2 { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 1rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 34rem) {
  .topbar { flex-wrap: wrap; gap: 0.7rem 1rem; }
  .thread { padding-left: 1.6rem; }
  .episode::before { left: -1.6rem; }
  .thread::before { left: 0.2rem; }
  .episode-mark { position: static; margin-bottom: 0.8rem; }
}

/* ---------------------------------------------------------------- 공지 */

.notice {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.3rem 1.4rem;
  margin-bottom: 1rem;
}
.notice.pinned { border-left: 3px solid var(--seal); }

.notice-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.7rem;
  margin-bottom: 0.7rem;
}
.notice-head h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}
.pin {
  font-size: 0.72rem;
  color: var(--seal);
  border: 1px solid var(--seal);
  padding: 0.05rem 0.35rem;
}
.notice-body {
  margin: 0;
  white-space: pre-wrap;
  max-width: 60ch;
  line-height: 1.85;
}

/* 성인 표시 */
.kind.adult {
  border-color: var(--seal);
  color: var(--seal);
  font-weight: 700;
}

/* 계정 삭제 영역 */
.danger-zone { border-color: var(--seal); }
.danger-zone .note { max-width: 40ch; }

/* ---------------------------------------------------------------- 그림판 */

.paint-wrap {
  border: 1px solid var(--rule);
  background: var(--panel);
}

.paint-stage {
  position: relative;
  line-height: 0;
  overflow: hidden;
  background: #c3c8d4;
}

#px-view {
  display: block;
  width: 100%;
  cursor: crosshair;
  touch-action: none;          /* 브라우저 기본 스크롤·확대를 막고 직접 처리 */
  image-rendering: pixelated;
}

.paint-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem 1.2rem;
  padding: 0.7rem 0.9rem;
  border-top: 1px solid var(--rule);
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.swatch {
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--rule);
  padding: 0;
  cursor: pointer;
}
.swatch:hover { border-color: var(--ink); }
.swatch.on {
  border: 2px solid var(--ink);
  outline: 1px solid var(--paper);
  outline-offset: -3px;
}

.paint-meta {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.86rem;
  color: var(--mist);
  margin-left: auto;
}
#px-cool.waiting { color: var(--seal); font-variant-numeric: tabular-nums; }

@media (max-width: 34rem) {
  .paint-meta { margin-left: 0; width: 100%; justify-content: space-between; }
  .swatch { width: 1.5rem; height: 1.5rem; }
}

/* ---------------------------------------------------------------- 검색창 */

.topsearch { order: 4; flex-shrink: 0; }
.topsearch input {
  width: 9.5rem;
  padding: 0.38rem 0.65rem;
  font-size: 0.86rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  transition: width 0.15s;
}
.topsearch input:focus { width: 13rem; }

/* ---------------------------------------------------------------- 프로필 사진 */

.avatar {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.avatar.sm { width: 1.6rem; height: 1.6rem; }
.avatar.lg { width: 6rem; height: 6rem; }
.avatar.xl { width: 7.5rem; height: 7.5rem; }

.avatar.letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1;
}
.avatar.letter.sm { font-size: 0.85rem; }
.avatar.letter.lg { font-size: 2.5rem; }
.avatar.letter.xl { font-size: 3.1rem; }

/* 닉네임 + 프사 묶음 */
.who {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
}
.who:hover { text-decoration: underline; }

.avatar-edit { display: flex; gap: 1.2rem; align-items: flex-start; }

/* ---------------------------------------------------------------- 표지 */

.story-intro {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  margin: -0.4rem 0 2rem;
}
.story-intro .cover {
  width: 7.5rem;
  flex-shrink: 0;
  border: 1px solid var(--rule);
}

.story-row.has-cover { grid-template-columns: 3.2rem minmax(0, 1fr) auto; }
.story-row .row-cover {
  width: 3.2rem;
  height: 4.3rem;
  object-fit: cover;
  border: 1px solid var(--rule);
}

.prompt-tag {
  display: inline-block;
  margin: 0;
  padding: 0.2rem 0.55rem;
  border: 1px dashed var(--rule);
  color: var(--mist);
  font-size: 0.84rem;
}
.prompt-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }

/* ---------------------------------------------------------------- 댓글 */

.comments { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: 1.6rem; }
.comments > h2 {
  font-family: var(--serif);
  font-size: 1.2rem;
  margin: 0 0 0.25rem;
}
.comments > p.note { margin: 0 0 1.2rem; }
#clist { margin-bottom: 1.4rem; }
#clist > p.note { margin: 0; padding: 1.4rem 0; }

.comment {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}
.comment-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.86rem;
  margin-bottom: 0.35rem;
}
.comment p { margin: 0; white-space: pre-wrap; line-height: 1.75; }
.comment .ref {
  font-size: 0.76rem;
  border: 1px solid var(--rule);
  padding: 0.02rem 0.35rem;
  color: var(--mist);
}
.comment-form { margin-top: 1.2rem; }

/* ---------------------------------------------------------------- 건의사항 */

.sg {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.9rem;
}
.sg-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.3rem 0.7rem;
  margin-bottom: 0.6rem;
}
.sg-head h2 { font-family: var(--serif); font-size: 1.08rem; margin: 0; }
.sg-body { margin: 0; white-space: pre-wrap; max-width: 60ch; }

.sg-status {
  font-size: 0.74rem;
  padding: 0.08rem 0.4rem;
  border: 1px solid var(--rule);
  color: var(--mist);
}
.sg-status.done { border-color: var(--ink); color: var(--ink); }
.sg-status.open { border-color: var(--seal); color: var(--seal); }

.sg-reply {
  margin-top: 0.9rem;
  padding: 0.8rem 1rem;
  background: #f5f6f9;
  border-left: 2px solid var(--ink);
  font-size: 0.92rem;
}
.sg-reply p { margin: 0.4rem 0 0; white-space: pre-wrap; }

/* ---------------------------------------------------------------- 복구 코드 */

.recovery-code {
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 1rem;
  margin: 1rem 0;
  background: #f5f6f9;
  border: 1px solid var(--rule);
  user-select: all;
  word-break: break-all;
}


@media (max-width: 34rem) {
  .story-intro { flex-direction: column; }
  .story-intro .cover { width: 6rem; }
  .avatar-edit { flex-direction: column; }
}

/* ---------------------------------------------------------------- 반응형 보정 */

@media (max-width: 60rem) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }
  .hero-side {
    border-left: 0;
    border-top: 1px solid var(--rule);
    padding-left: 0;
    padding-top: 1.3rem;
  }
  .hero-cover { width: 4.5rem; }
}

/* 데스크톱에서는 상단 검색창이 있으므로 탭의 '검색'을 숨긴다 */
.tab-search { display: none; }

@media (max-width: 46rem) {
  .topbar { flex-wrap: wrap; row-gap: 0.6rem; }
  .tabs { order: 9; width: 100%; margin-right: 0; }
  .account { order: 3; margin-left: auto; }
  /* 좁은 화면에서는 입력창 대신 탭의 '검색'으로 보낸다 */
  .topsearch { display: none; }
  .tab-search { display: inline; }
}

@media (max-width: 34rem) {
  .story-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    align-items: start;
  }
  .story-row.has-cover { grid-template-columns: 3.2rem minmax(0, 1fr); }
  .story-stats {
    flex-direction: row;
    align-items: baseline;
    gap: 0.7rem;
    justify-content: flex-start;
  }
  .story-row.has-cover .story-stats { grid-column: 2; }
  .hero-quote { font-size: 1.25rem; }
}

/* ---------------------------------------------------------------- 개인 페이지 */

.profile-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.2rem 1.6rem;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: clamp(1.3rem, 3.5vw, 2.1rem);
  margin-bottom: 2rem;
}

.profile-id h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  margin: 0 0 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}
.profile-id .note { margin: 0 0 0.7rem; }

.profile-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.profile-stats div {
  background: var(--panel);
  padding: 0.7rem 0.6rem;
  text-align: center;
}
.profile-stats dt { color: var(--mist); font-size: 0.78rem; margin: 0 0 0.15rem; }
.profile-stats dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
}

/* 개인 페이지에서는 회차를 실타래 없이 평평하게 보여준다 */
.episode.flat { padding-left: 0; margin-bottom: 1.4rem; }
.episode.flat::before { display: none; }

@media (max-width: 46rem) {
  .profile-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 34rem) {
  .profile-head { grid-template-columns: 1fr; justify-items: start; }
  .avatar.xl { width: 5.5rem; height: 5.5rem; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- 공개 범위 */

.vis-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
}
.vis-row label { margin: 0; flex: 1; }
.vis-row select { width: auto; min-width: 9rem; }

.vis-warn {
  background: #f5f6f9;
  border-left: 2px solid var(--seal);
  padding: 0.7rem 0.9rem;
  margin: 0 0 1.1rem;
}

.vis-mark {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  font-weight: 400;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--seal);
  color: var(--seal);
  white-space: nowrap;
}

.profile-hidden { grid-column: 1 / -1; margin: 0; }

/* ---------------------------------------------------------------- 방명록 */

.guest {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
}
.guest p { margin: 0; white-space: pre-wrap; line-height: 1.75; }
