* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", sans-serif;
    background: #f6f7f9;
    color: #222;
}
a { color: #245ac4; }
.wrap {
    max-width: 900px;
    margin: 60px auto;
    background: #fff;
    padding: 36px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.wrap.narrow { max-width: 620px; }
h1 { margin-top: 0; }
.ok { font-weight: 700; }
.muted { color: #6b7280; }
dl {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 18px;
}
dt { font-weight: 700; }
.form-card {
    display: grid;
    gap: 18px;
    margin: 24px 0;
}
.form-card label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}
input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #cdd3dc;
    border-radius: 8px;
    font: inherit;
}
button, .btn {
    display: inline-block;
    border: 0;
    border-radius: 8px;
    padding: 10px 15px;
    background: #222;
    color: #fff;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.btn.outline {
    background: #fff;
    color: #222;
    border: 1px solid #aaa;
}
button.secondary {
    background: #fff;
    color: #222;
    border: 1px solid #aaa;
}
.alert, .status {
    padding: 14px 16px;
    border-radius: 10px;
    margin: 18px 0;
}
.alert.error, .bad { background:#fff0f0; border:1px solid #f1b4b4; }
.alert.success, .good { background:#edf9ef; border:1px solid #a8d9ae; }
.warn { background:#fff7e8; border:1px solid #e5c580; }
.member-bar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    padding: 16px;
    margin: 22px 0;
    background: #f4f6f8;
    border-radius: 10px;
}
.profile-card {
    padding: 22px;
    background: #f7f8fa;
    border-radius: 12px;
    margin: 20px 0;
}
@media (max-width: 640px) {
    .wrap { margin: 20px 12px; padding: 24px 18px; }
    dl { grid-template-columns: 100px 1fr; }
}

textarea {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #cdd3dc;
    border-radius: 8px;
    font: inherit;
    resize: vertical;
}
.search-row {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}
.search-row input { flex: 1; }
.list { display: grid; gap: 10px; margin: 18px 0; }
.list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 16px;
    border: 1px solid #e2e5ea;
    border-radius: 10px;
}
.right { text-align: right; }
.rank { display:inline-block; min-width:34px; font-weight:800; margin-right:6px; }
.book-head { display:flex; gap:24px; align-items:flex-start; margin-bottom:30px; }
.book-cover { width:140px; max-height:200px; object-fit:cover; border-radius:8px; border:1px solid #ddd; }
.review-body { line-height:1.8; font-size:17px; padding:24px 0; border-top:1px solid #eee; border-bottom:1px solid #eee; }
.reward-summary { padding:14px 16px; margin:18px 0; background:#f3f6fb; border-radius:10px; }
.button-row { display:flex; gap:10px; }
button.danger { background:#9b1c1c; }
@media (max-width:640px) {
    .list-card, .book-head { align-items:flex-start; }
    .book-head { flex-direction:column; }
    .search-row { flex-direction:column; }
}

.provider-status { padding: 12px 14px; border: 1px solid #e2e5ea; border-radius: 10px; }

.reward-form {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
}
.reward-form label {
    display: grid;
    gap: 6px;
    min-width: 180px;
}
.reward-form input[type="number"] {
    width: 180px;
}

.sort-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 18px;
}
.helpful-box {
    margin: 18px 0;
    padding: 14px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

/* v0.13 admin foundation */
.admin-wrap { max-width: 1100px; }
.admin-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 18px 0 24px;
}
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 22px 0;
}
.metric-card {
    display: grid;
    gap: 5px;
    padding: 16px;
    background: #f7f8fa;
    border: 1px solid #e2e5ea;
    border-radius: 10px;
}
.metric-card span { color: #6b7280; font-size: 14px; }
.metric-card strong { font-size: 22px; }
.metric-card small { color: #6b7280; }
.badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #eef0f3;
}
.badge.active { background: #e8f7eb; }
.badge.suspended { background: #fdecec; }
.badge.admin { background: #eef1ff; }
.code-lite {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    background: #f4f5f7;
    color: #4b5563;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    overflow-wrap: anywhere;
}
select {
    padding: 12px 13px;
    border: 1px solid #cdd3dc;
    border-radius: 8px;
    background: #fff;
    font: inherit;
}

.badge.published { background: #e8f7eb; }
.badge.hidden { background: #fff3cd; }
.badge.deleted { background: #eef0f3; }

/* v0.19.1: policy-consent checkboxes */
.policy-consents {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid #e2e5ea;
    border-radius: 10px;
}
.policy-consent-row {
    display: grid !important;
    grid-template-columns: 22px 1fr;
    gap: 10px !important;
    align-items: start;
    font-weight: 400 !important;
}
.policy-consent-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 2px 0 0 0;
    border-radius: 4px;
}
.policy-consent-title {
    font-weight: 700;
}
.policy-consent-meta {
    margin-top: 4px;
    font-size: 14px;
}


/* v0.20: review discussion */
.comment-card { min-width:0; }
.comment-reply { margin-left:clamp(12px, 4vw, 32px); border-left:3px solid #dbe3ed; }
.comment-body { margin:12px 0; overflow-wrap:anywhere; white-space:normal; }
.comment-actions { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-top:10px; font-size:14px; }
.inline-form { display:inline-flex; margin:0; padding:0; }
.inline-form button { width:auto; padding:5px 9px; font-size:13px; }

/* v0.21: member discussion history */
.comment-history-card { align-items: flex-start; }
.comment-history-content { min-width: 0; width: 100%; overflow-wrap: anywhere; }
.comment-history-title { margin: 8px 0; font-size: 18px; line-height: 1.5; }
.comment-history-meta { margin: 6px 0 12px; font-size: 14px; }
.comment-history-body { line-height: 1.75; overflow-wrap: anywhere; }
@media (max-width: 640px) {
    .comment-history-card { padding: 14px; }
    .comment-history-title { font-size: 16px; }
    .comment-history-card .comment-actions { gap: 10px; }
}


/* v0.21.1: review / comment / reply visual language */
.discussion-review { background: transparent; }
.discussion-kind {
    display:inline-flex; align-items:center; gap:5px;
    padding:3px 9px; border-radius:7px;
    font-size:13px; font-weight:800; line-height:1.5;
    border:1px solid #d6dbe3; background:#fff; color:#303846;
}
.discussion-kind--review { background:#fff; color:#303846; border-color:#d6dbe3; }
.discussion-kind--comment { background:#fff0b8; color:#614b13; border-color:#dfc875; }
.discussion-kind--reply { background:#d5e8ff; color:#234e7e; border-color:#9fc1e9; }
.discussion-card {
    display:block; min-width:0; padding:18px;
    border:1px solid #e1e5eb; border-radius:12px;
    overflow-wrap:anywhere;
}
.discussion-card > div { min-width:0; }
.discussion-card.discussion-comment, .discussion-form.discussion-comment {
    background:#fff9e6; border-color:#e5d5a2;
}
.discussion-card.discussion-reply, .discussion-form.discussion-reply {
    background:#ebf4ff; border-color:#b7d2f1;
}
.discussion-card.discussion-reply {
    margin-left:clamp(14px, 4vw, 32px);
    border-left:4px solid #8bb6e6;
}
.discussion-form {
    border:1px solid #e1e5eb; border-radius:12px;
    padding:18px; margin:12px 0;
}
.discussion-form h3 { margin:0; }
.discussion-form .form-card { margin:0; }
.discussion-form .button-row { flex-wrap:wrap; }
.discussion-meta { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.discussion-meta .muted { font-size:13px; }
.discussion-parent {
    margin:10px 0; font-size:14px; line-height:1.6;
    color:#315b85;
}
.discussion-parent a { color:#245889; }
.discussion-card .comment-body {
    border:0; padding:0; margin:14px 0;
    font-size:16px; line-height:1.8;
    white-space:normal; overflow-wrap:anywhere;
}
.discussion-card .comment-actions a {
    display:inline-flex; align-items:center;
    min-height:30px; font-weight:600;
}
.discussion-card:target {
    outline:2px solid #496b93; outline-offset:2px;
}
.discussion-card .inline-form button { min-height:30px; }
.discussion-card .badge { margin-left:0; }
.discussion-card .comment-history-title { margin:12px 0; }
.discussion-card .comment-history-body { margin:12px 0; }
.discussion-card .comment-history-meta { margin:8px 0; }
.discussion-card .comment-history-content { width:100%; }
.discussion-actions-heading { font-size:14px; font-weight:700; margin:0; }
@media (max-width:640px) {
    .discussion-card, .discussion-form { padding:14px; }
    .discussion-card.discussion-reply { margin-left:14px; }
    .discussion-card .comment-actions { gap:10px; }
}
@media (forced-colors:active) {
    .discussion-card.discussion-comment, .discussion-card.discussion-reply,
    .discussion-form.discussion-comment, .discussion-form.discussion-reply {
        border:2px solid CanvasText;
    }
}

/* v0.22: book portal search and rankings */
.portal-wrap { max-width: 980px; }
.portal-hero {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 18px;
}
.portal-hero h1 { margin: 2px 0 10px; }
.portal-search {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 24px 0;
    padding: 16px;
    border: 1px solid #e2e5ea;
    border-radius: 12px;
    background: #f8fafc;
}
.portal-search input { flex: 1; }
.portal-section { margin-top: 34px; }
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 14px;
}
.section-head h2 { margin: 0 0 6px; }
.portal-list { gap: 12px; }
.portal-book-card, .portal-review-card {
    align-items: flex-start;
    justify-content: flex-start;
}
.portal-rank {
    min-width: 42px;
    font-size: 20px;
    font-weight: 900;
    color: #475569;
}
.portal-cover {
    width: 58px;
    height: 82px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #d8dde6;
    background: #fff;
}
.portal-card-body { flex: 1; min-width: 0; }
.portal-card-body h3 { margin: 2px 0 8px; }
.portal-card-body p { margin: 5px 0; }
.portal-card-stats {
    min-width: 150px;
    text-align: right;
    display: grid;
    gap: 5px;
}
.portal-card-stats span { color: #6b7280; font-size: 14px; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
@media (max-width: 760px) {
    .portal-hero, .section-head, .portal-search { flex-direction: column; }
    .portal-search, .portal-search input, .portal-search button, .portal-search .btn { width: 100%; }
    .portal-book-card, .portal-review-card { display: grid; grid-template-columns: auto 1fr; }
    .portal-cover { grid-row: span 2; }
    .portal-card-stats { grid-column: 1 / -1; text-align: left; }
}


/* v0.23: independent, accessible book/review pagination */
.portal-pagination {
    display:flex; align-items:center; justify-content:center; flex-wrap:wrap;
    gap:7px; margin:24px 0 4px; padding-top:16px; border-top:1px solid #e2e5ea;
}
.portal-pagination a, .portal-page-current {
    display:inline-flex; align-items:center; justify-content:center;
    min-width:38px; min-height:38px; padding:7px 11px;
    border:1px solid #cdd3dc; border-radius:8px; text-decoration:none;
    background:#fff; color:#222; font-weight:600;
}
.portal-pagination a:hover { background:#f2f4f7; }
.portal-pagination a:focus-visible { outline:3px solid #245ac4; outline-offset:2px; }
.portal-page-current { background:#222; border-color:#222; color:#fff; }
.portal-page-label { width:100%; text-align:center; font-size:14px; color:#6b7280; }
.portal-page-gap { padding:0 4px; color:#6b7280; }
.portal-result-count { margin:8px 0 14px; font-size:14px; }
.portal-section { scroll-margin-top:20px; }
.portal-book-card, .portal-review-card { min-width:0; }
.portal-book-card .portal-card-body, .portal-review-card .portal-card-body { overflow-wrap:anywhere; }
@media (max-width:760px) {
    .portal-card-stats { min-width:0; }
    .portal-pagination { gap:5px; }
    .portal-pagination a, .portal-page-current { min-width:36px; }
}

/* v0.24 personal book shelf */
.bookmark-form { display:inline-block; margin:0.5rem 0.35rem 0.5rem 0; }
.bookmark-form button { width:auto; }

/* v0.25: clearly separated, non-billable development promotion pilot. */
.promotion-section{margin:24px 0;padding:20px;border:1px solid #d8e2dc;border-radius:14px;background:#f7faf8}
.promotion-section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px}
.promotion-section-head h2{margin:0;font-size:1.2rem}
.promotion-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr));gap:14px}
.promotion-card{min-width:0;padding:18px;border:1px solid #d5ded8;border-radius:10px;background:#fff;overflow-wrap:anywhere}
.promotion-card h3{font-size:1.08rem;margin:10px 0}
.promotion-card p{line-height:1.65;white-space:normal}
.promotion-label{display:inline-block;font-size:.78rem;font-weight:700;color:#45584c;border:1px solid #b8c9bd;background:#e8efe9;padding:4px 9px;border-radius:5px}
.promotion-action{display:inline-block;margin:4px 8px 4px 0}
.promotion-action button{max-width:100%}
.promotion-section .btn{white-space:normal;text-align:center}
@media(max-width:480px){.promotion-section{padding:14px}.promotion-card{padding:15px}.promotion-action{display:block}.promotion-action button{width:100%}}


/* v0.26: advertising product catalog. */
.promotion-product-head{display:flex;justify-content:space-between;align-items:baseline;gap:16px;flex-wrap:wrap;margin-bottom:12px}
.promotion-product-head h2{margin:0}
.promotion-product-price{font-size:1.25rem;white-space:nowrap}
@media(max-width:480px){.promotion-product-price{font-size:1.1rem}}
