:root {
    --bg: #fbf8fc;
    --surface: #ffffff;
    --text: #2b2433;
    --muted: #6f6579;
    --accent: #c2477f;
    --accent-text: #ffffff;
    --border: #e6dcea;
    --notice: #fff4d6;
    --error: #ffe3e3;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1c1820;
        --surface: #26212b;
        --text: #f1ecf4;
        --muted: #b3a9bb;
        --accent: #e5739f;
        --accent-text: #1c1820;
        --border: #3b3442;
        --notice: #3d3420;
        --error: #4a2626;
    }
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
    line-height: 1.75;
}
a { color: var(--accent); }
main { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
header.site {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
header.site .brand { font-weight: 700; font-size: 1.2rem; text-decoration: none; color: var(--text); }
header.site .by { color: var(--muted); font-size: 0.85rem; }
footer.site { border-top: 1px solid var(--border); padding: 20px 16px; text-align: center; color: var(--muted); font-size: 0.85rem; }
footer.site nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
h1 { font-size: 1.6rem; line-height: 1.4; }
h2 { font-size: 1.2rem; margin-top: 2em; }
.small { color: var(--muted); font-size: 0.9rem; }
.hero { text-align: center; padding: 16px 0; }
.hero h1 { font-size: 2.4rem; margin: 0.2em 0; }
.lead { font-size: 1.1rem; }
.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 24px 0 8px; }
.product { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; }
.product.featured { border: 2px solid var(--accent); }
.product h2 { margin: 0; }
.product .price { font-size: 1.4rem; font-weight: 700; margin: 4px 0 8px; }
.product ul { padding-left: 1.2em; flex: 1; }
button, .button {
    font: inherit; cursor: pointer; border: 0; border-radius: 10px;
    padding: 10px 18px; background: var(--accent); color: var(--accent-text); font-weight: 600;
}
.product button { width: 100%; padding: 12px; font-size: 1.05rem; }
.agree { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.notice { background: var(--notice); border-radius: 10px; padding: 10px 14px; }
.notice.error { background: var(--error); }
.key-box { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 2px solid var(--accent); border-radius: 12px; padding: 16px; }
.key-box code { font-size: 1.3rem; letter-spacing: 0.04em; word-break: break-all; user-select: all; }
input[type=email], input[type=text], input[type=search], input[type=number], input[type=password], select {
    font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
input[type=email] { width: min(100%, 360px); }
form.resend label { display: block; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.legal th { width: 30%; white-space: nowrap; }
@media (max-width: 600px) { table.legal th { white-space: normal; } }
body.admin main { max-width: 1200px; }
body.admin .search { margin-left: auto; display: flex; gap: 6px; }
body.admin form.edit { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
body.admin form.edit p { width: 100%; margin: 0; }
body.admin td form { margin: 0; }
body.admin td button { padding: 4px 10px; }
pre { white-space: pre-wrap; word-break: break-all; }

/* 作品の一覧 (index.php) */
.crumbs { font-size: 0.9rem; color: var(--muted); margin-bottom: 8px; }
.catalog-head { text-align: center; padding: 8px 0 4px; }
.works { list-style: none; padding: 0; margin: 24px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.work > a, .work > div {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; height: 100%;
    padding: 20px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    color: var(--text); text-decoration: none;
}
.work > a:hover, .work > a:focus-visible { border-color: var(--accent); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); }
.work.soon > div { opacity: 0.7; }
.work-icon { width: 128px; height: 128px; object-fit: contain; }
.hero .work-icon { display: block; margin: 0 auto 4px; }
.work-name { font-size: 1.25rem; font-weight: 700; }
.work-summary { font-size: 0.92rem; }
.work-platform { font-size: 0.8rem; color: var(--muted); }
.work-price { font-weight: 700; color: var(--accent); margin-top: auto; }
.work-badge { margin-top: auto; font-size: 0.8rem; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
/* 管理画面: 製品の切り替え */
body.admin nav.products { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
body.admin nav.products a { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; color: var(--text); background: var(--surface); }
body.admin nav.products a.current { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
body.admin .tag { display: inline-block; font-size: 0.8em; padding: 1px 8px; border-radius: 999px; background: var(--border); }

/* 恋々小町の文の購入 (kk/) */
.payee { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; line-height: 1.9; }
.payee img.payee-name { vertical-align: middle; max-width: 100%; height: auto; border-radius: 6px; }
form.report label { display: block; }
form.report input[type=text], form.report input[type=email], form.report textarea, form.report select { width: 100%; max-width: 32rem; box-sizing: border-box; }
.product h3 { margin: 0; }

/* 購入完了ページの「ご購入を確認しています」 (success.php) */
.confirming { display: flex; align-items: center; gap: 14px; background: var(--notice); border-radius: 10px; padding: 14px 16px; }
.confirming p { margin: 0; }
.spinner { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; opacity: .6; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
