:root {
  --bg: #f6f3ec;
  --ink: #1c1a17;
  --muted: #6b645b;
  --card: #fffdf8;
  --line: #e4ddd2;
  --accent: #0f6a5a;
  --danger: #a33b2d;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d9efe8 0%, transparent 55%),
    linear-gradient(180deg, #f8f5ef, var(--bg));
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { width: min(1040px, calc(100% - 2rem)); margin: 0 auto; }
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255,253,248,.86);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: .9rem 0;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--ink); }
nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
nav a.active { font-weight: 700; }
.user { color: var(--muted); font-size: .9rem; }
main.wrap { padding: 1.5rem 0 3rem; }
.layout-2 { display: grid; grid-template-columns: 1fr 220px; gap: 1.5rem; }
.card, .article-view, .auth-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.card h2 { margin: 0 0 .4rem; font-size: 1.15rem; }
.meta, .excerpt, .empty { color: var(--muted); }
.content { line-height: 1.75; overflow-wrap: anywhere; }
.content pre, .content code {
  background: #f1eee7; border-radius: 6px;
}
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { margin: .35rem 0; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.btn, button {
  background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; padding: .45rem .8rem; cursor: pointer;
}
.btn.danger, button.danger { background: var(--danger); }
.form { display: grid; gap: .8rem; }
.form label { display: grid; gap: .35rem; font-size: .95rem; }
.form input, .form textarea, .form select {
  width: 100%; padding: .55rem .65rem; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff;
}
.auth-box { max-width: 420px; margin: 2rem auto; }
.auth-box.wide { max-width: 820px; }
.error { color: var(--danger); }
.table { width: 100%; border-collapse: collapse; background: var(--card); }
.table th, .table td { border-bottom: 1px solid var(--line); padding: .55rem; text-align: left; vertical-align: top; }
.filters { display: flex; gap: 1rem; }
.filters a.active { font-weight: 700; }
.pager { display: flex; gap: 1rem; align-items: center; margin-top: 1rem; }
.site-footer { color: var(--muted); padding-bottom: 2rem; font-size: .9rem; }
.search { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search input { flex: 1; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 8px; }
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem;
  align-items: center;
}
.filter-bar input, .filter-bar select {
  padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.inline { display: inline; }
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem;
  align-items: center;
}
.filter-bar input, .filter-bar select {
  padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.inline { display: inline; }
@media (max-width: 800px) {
  .layout-2 { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
}
.admin-shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.25rem;
  padding: 1.25rem 0 2.5rem;
  align-items: start;
}
.admin-side {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .9rem;
  display: grid;
  gap: .35rem;
  position: sticky;
  top: 4.2rem;
}
.admin-side .side-title {
  margin: 0 0 .4rem;
  font-weight: 700;
  color: var(--ink);
}
.admin-side a {
  display: block;
  padding: .45rem .55rem;
  border-radius: 8px;
  color: var(--ink);
}
.admin-side a:hover { background: #f1eee7; text-decoration: none; }
.admin-side a.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.admin-side .side-sub {
  margin: .2rem 0 .4rem .55rem;
  display: grid;
  gap: .25rem;
}
.admin-side .side-sub a {
  font-size: .92rem;
  color: var(--muted);
  padding: .3rem .45rem;
}
.admin-main { min-width: 0; }
.admin-main .toolbar h1 { margin: 0; }
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  color: inherit;
  display: block;
}
.game-card:hover { text-decoration: none; border-color: var(--accent); }
.game-card img { width: 100%; height: 140px; object-fit: cover; display: block; background: #e8e2d8; }
.game-card h2 { margin: .7rem .8rem .3rem; font-size: 1.05rem; }
.game-card p { margin: 0 .8rem 1rem; color: var(--muted); font-size: .9rem; }

/* Public reading layout and independent administration workspace. */
:root { --bg:#f5f7fa; --card:#fff; --line:#e5e9ef; --ink:#202b3c; --muted:#718096; --accent:#187d72; }
body { background:var(--bg); font-size:15px; line-height:1.65; }
.wrap { width:min(1160px,calc(100% - 48px)); }
.site-header { background:#fff; }
.site-header .wrap { min-height:76px; }
.brand { font-size:23px; letter-spacing:.04em; }
nav a { padding:6px 12px; border-radius:7px; }
nav a.active { background:#e9f5f1; }
main.wrap { padding-top:42px; min-height:75vh; }
h1 { font-size:28px; letter-spacing:-.03em; margin:0 0 26px; }
.layout-2 { grid-template-columns:minmax(0,1fr) 250px; gap:32px; }
.card { padding:25px 28px; border-radius:14px; margin-bottom:18px; }
.card h2 { font-size:20px; line-height:1.5; }
.card h2 a { color:var(--ink); }
.meta { font-size:12px; margin:10px 0; }
.excerpt { font-size:14px; line-height:1.9; margin-bottom:0; }
.side-col { background:#fff; border:1px solid var(--line); border-radius:14px; padding:22px; align-self:start; }
.side-col h3 { margin-top:0; }
.cat-list a { display:block; padding:7px 10px; border-radius:6px; }
.cat-list a:hover,.cat-list a.active { background:#e9f5f1; }
.admin-body .wrap { width:min(1440px,calc(100% - 48px)); }
.admin-shell { grid-template-columns:210px minmax(0,1fr); gap:30px; padding-top:32px; }
.admin-side { padding:18px 12px; top:100px; }
.admin-side .side-title { padding:0 12px 14px; color:var(--muted); font-size:12px; letter-spacing:.12em; }
.admin-side a { padding:11px 14px; }
.admin-main { overflow-x:auto; }
.admin-main .toolbar { margin-bottom:24px; }
.table { border:1px solid var(--line); border-radius:10px; font-size:14px; }
.table th { background:#edf1f6; color:#657184; font-size:12px; white-space:nowrap; }
.table td,.table th { padding:15px 16px; }
.table td:first-child,.table td:nth-child(n+3) { white-space:nowrap; }
.table td:nth-child(2) { min-width:240px; overflow-wrap:anywhere; }
.table tbody tr:hover { background:#f8fbfc; }
.table .danger { background:#fff0ee; color:#b44539; }
.filters { margin:0 0 20px; }
.filters a { padding:5px 14px; border-radius:6px; }
.filters a.active { background:#e4f2ee; }
button,.btn { font:inherit; font-size:14px; padding:9px 16px; }
.article-view { padding:32px; }
.content img { max-width:100%; height:auto; }
.content pre { overflow-x:auto; padding:16px; }
@media(max-width:800px) {
 .wrap,.admin-body .wrap { width:calc(100% - 28px); }
 .layout-2,.admin-shell { grid-template-columns:1fr; }
 .admin-side { position:static; display:flex; flex-wrap:wrap; gap:6px; }
 .admin-side .side-title { width:100%; padding-bottom:0; }
 .admin-side .side-sub { display:flex; flex-wrap:wrap; }
 .site-header .wrap { gap:12px; flex-wrap:wrap; padding:14px 0; }
 nav { gap:4px; font-size:13px; }
 main.wrap { padding-top:24px; }
 .card,.article-view { padding:20px; }
 .toolbar { flex-wrap:wrap; }
}

.admin-shell { grid-template-columns:190px minmax(0,1fr); gap:24px; }
.admin-body .wrap { width:calc(100% - 48px); max-width:1440px; }
.admin-main .table { table-layout:auto; }
.admin-main .table td:nth-child(2) { min-width:0; }
.admin-main .table td:nth-child(n+3) { white-space:normal; }
.admin-main .table th,.admin-main .table td { padding:12px; }
.admin-main .table td:last-child { white-space:nowrap; }
.admin-main .table th:first-child { width:54px; }
.admin-main .reminder-table th:first-child { width:180px; }
.reminder-date { white-space:normal !important; width:180px; font-size:13px; }
.reminder-table td:nth-child(4) { min-width:130px; }
.filter-bar input,.filter-bar select { min-width:0; max-width:220px; }
.status-badge { display:inline-block; font-size:12px; color:#916720; background:#fff4dc; padding:2px 8px; border-radius:4px; margin-bottom:6px; }
.status-badge.done { color:#187d72; background:#e5f5ed; }
.reminder-table .inline { display:block; }
.reminder-table .btn { font-size:12px; padding:6px 9px; white-space:nowrap; }
.btn.secondary { background:#edf2f7; color:#536276; }
.rich-editor { background:#fff; line-height:1.6; min-width:0; }
.rich-editor .w-e-toolbar { flex-wrap:wrap; border-radius:8px 8px 0 0; position:relative; z-index:2 !important; }
.rich-editor .w-e-text-container { height:380px !important; z-index:1 !important; border-radius:0 0 8px 8px; }
.rich-editor img { max-width:100%; }
.form label:has(.rich-editor) { display:block; }
.comments { max-width:900px; margin:24px auto; }
.comment { border-top:1px solid var(--line); padding:18px 0; }
.comment-list { margin-top:24px; }
.comment p { white-space:pre-wrap; overflow-wrap:anywhere; margin-bottom:0; }
@media(max-width:800px) {
 .admin-shell { grid-template-columns:1fr; gap:18px; }
 .admin-body .wrap { width:calc(100% - 28px); }
 .admin-side { position:static; padding:12px; }
 .admin-side a { padding:7px 10px; }
 .admin-main .table { min-width:640px; }
 .admin-main .reminder-table { min-width:900px; }
}

.admin-side .side-sub { margin:0 0 8px 20px; padding-left:10px; border-left:2px solid #dcebe6; display:grid; gap:2px; }
.admin-side .side-sub a { font-size:13px; padding:7px 10px; }
.admin-side .side-sub a.current { color:var(--accent); background:#e9f5f1; font-weight:600; }
@media(max-width:800px) { .admin-side .side-sub { flex-basis:100%; display:grid; margin-left:20px; } }

.account-chip { display:inline-flex; gap:8px; align-items:center; border:1px solid var(--line); border-radius:20px; padding:5px 12px; color:var(--ink); font-size:13px; max-width:190px; overflow-wrap:anywhere; }
.account-dot { width:7px; height:7px; background:var(--accent); border-radius:50%; flex-shrink:0; }
.account-logout { margin:0; }.account-logout button { background:transparent; color:var(--muted); padding:6px; font-size:13px; }
.diary-page .toolbar { margin-bottom:22px; }.diary-page .toolbar h1 { margin-bottom:0; }.diary-page .toolbar .meta { margin:5px 0 0; }
.diary-card .excerpt { cursor:pointer; line-height:1.9; }.diary-card .excerpt:hover { color:var(--ink); }
.diary-actions { display:flex; justify-content:space-between; align-items:center; margin-top:20px; padding-top:14px; border-top:1px solid var(--line); }
.diary-read { font-size:14px; font-weight:600; }.diary-delete { color:var(--danger); background:#fff1ee; padding:6px 12px; font-size:13px; }
.dialog-open { overflow:hidden; }
.diary-dialog,.delete-dialog { border:1px solid var(--line); border-radius:18px; box-shadow:0 24px 100px #16263540; padding:0; color:var(--ink); background:#fff; }
dialog::backdrop { background:#14263566; backdrop-filter:blur(3px); }
.diary-dialog { width:min(820px,calc(100vw - 36px)); max-height:85vh; }
.diary-dialog[open] { display:flex; flex-direction:column; }
.dialog-header { display:flex; justify-content:space-between; gap:20px; padding:24px 28px 16px; border-bottom:1px solid var(--line); flex-shrink:0; }
.dialog-header h2 { margin:0; font-size:23px; overflow-wrap:anywhere; }.dialog-header .meta { margin:5px 0 0; }
.dialog-close { background:#f0f3f7; color:var(--muted); border-radius:50%; width:34px; height:34px; padding:0; font-size:23px; flex-shrink:0; }
.diary-full-content { padding:24px 28px; overflow-y:auto; white-space:pre-wrap; line-height:1.85; min-height:80px; }
.diary-full-content p:first-child { margin-top:0; }.diary-full-content table { border-collapse:collapse; max-width:100%; }.diary-full-content td,.diary-full-content th { border:1px solid var(--line); padding:7px; }
.dialog-footer { padding:14px 28px; text-align:right; border-top:1px solid var(--line); flex-shrink:0; }
.delete-dialog { width:min(430px,calc(100vw - 36px)); padding:28px; }
.delete-dialog h2 { margin:14px 0 10px; font-size:22px; }.delete-dialog p { color:var(--muted); line-height:1.8; overflow-wrap:anywhere; }
.delete-dialog-icon { width:40px; height:40px; border-radius:50%; background:#fff0ed; color:var(--danger); text-align:center; line-height:40px; font-weight:700; font-size:23px; }
.delete-dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:24px; }button:disabled { opacity:.6; cursor:wait; }
@media(max-width:600px) { .dialog-header {padding:20px 18px 14px;}.diary-full-content{padding:20px 18px;}.dialog-footer{padding:12px 18px;}.account-chip{max-width:140px;} }
