/* Theme variables */
:root{
  --bg:#f4f7f8;
  --fg:#22282b;
  --muted:#69747a;
  --card:#ffffff;
  --line:#d9e1e5;
  --accent:#506a78;
  --accent2:#e8eef1;
  --danger:#c7354a;
}

html.theme-simple{
  --bg:#f4f7f8;
  --fg:#22282b;
  --muted:#69747a;
  --card:#ffffff;
  --line:#d9e1e5;
  --accent:#506a78;
  --accent2:#e8eef1;
  --danger:#c7354a;
}

html.theme-natural{
  --bg:#f8f4ec;
  --fg:#685151;
  --muted:#746d62;
  --card:#ffffff;
  --line:#e2d7c8;
  --accent:#685151;
  --accent2:#e2d7c8;
  --danger:#a34852;
}

html.theme-dark{
  --bg: #323943;
  --fg: #ffffff;
  --muted: #ffffff;
  --card: #3f4955;
  --line: #636f82;
  --accent: #20b5af;
  --accent2: #636f82;
  --danger: #ff7b72;
}

html.theme-pop{
  --bg:#fff0fb;
  --fg:#2a2a30;
  --muted:#5f5f65;
  --card:#ffffff;
  --line:#ffabe1;
  --accent:#ff3fa4;
  --accent2:#e8edff;
  --danger:#e60055;
}

html.theme-mono{
  --bg:#f3f3f3;
  --fg:#111111;
  --muted:#666666;
  --card:#ffffff;
  --line:#c9c9c9;
  --accent:#000000;
  --accent2:#e0e0e0;
  --danger:#b00020;
}

/* Base */
*{box-sizing:border-box}

body{
  margin:0;
  background:var(--bg);
  color:var(--fg);
  font-family:var(--site-font-family,'Zen Kaku Gothic New','Hiragino Kaku Gothic ProN','Yu Gothic',Meiryo,sans-serif);
  line-height:1.8;
}

h1,h2,h3,.section-head h2,.hero-full h1,.hero-editable h1,.post h1,.card h2,.card h3,.work-card h2,.diary-card h2{
  font-family:var(--heading-font-family,'Zen Old Mincho','Yu Mincho','Hiragino Mincho ProN',serif);
  letter-spacing:0;
  font-weight:600;
}

h2,.section-head h2{
  font-size:clamp(1.18rem,2.4vw,1.38rem);
  line-height:1.5;
}

h3{
  font-size:clamp(1.04rem,2vw,1.18rem);
  line-height:1.55;
}

main{
  max-width:780px;
  margin:auto;
  padding:28px 5vw;
}

main:has(+ .hero-full){
  display:none;
}

a{color:inherit}

label{
  display:block;
  margin:14px 0;
  font-weight:700;
}

input[type="checkbox"] {
  width: auto;
}

input,textarea,select{
  width:100%;
  padding:12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:var(--card);
  color:var(--fg);
  font:inherit;
}

button,.btn,.tool-file{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:0;
  border-radius:999px;
  padding:10px 16px;
  background:var(--accent);
  color:#fff;
  text-decoration:none;
  font-weight:700;
  line-height:1.2;
  cursor:pointer;
}

.ghost{
  background:#eeeeee;
  color:#333333;
}

.theme-dark .ghost{
  background:#657284;
  color:#f2f0f5;
}

.site{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 5vw;
  border-bottom:1px solid var(--line);
  background:var(--card);
  box-shadow:0 4px 20px #00000008;
}

.theme-dark .site {
  border: none;
  box-shadow: none;
}

.brand{
  color:var(--fg);
  text-decoration:none;
  font-weight:700;
}

.site nav{
  display:flex;
  align-items:center;
  gap:14px;
}

.site nav a{
  display:inline-flex;
  align-items:center;
  gap:.38em;
  color:var(--fg);
  text-decoration:none;
}

.site nav a.search-icon,
.site nav a.search-icon span{
  font-weight:400;
}

.site nav .fa-solid{
  width:1.15em;
  text-align:center;
  font-size:1.05rem;
}

.note {
  color: var(--muted);
  font-size: .78rem;
}

.menu-toggle{
  display:none;
  padding:4px 8px;
  border-radius:0;
  background:transparent;
  color:var(--fg);
  font-size:26px;
}

.theme-pop body{
  background:linear-gradient(135deg, #ffe4f8 0%, #eefbff 55%, #e3fff3 100%) fixed;
  background-repeat:no-repeat;
  background-size:cover;
}

.theme-pop .btn,
.theme-pop .tool-file{
  background:linear-gradient(90deg,#ff3fa4,#7a5cff);
}

.theme-pop .ghost{
  background:#eeeeee;
  color:#333333;
}

.theme-dark .card,
.theme-dark .panel,
.theme-dark .post{
  box-shadow: none;
  border: none;
}

.theme-natural .site{
  background:var(--line);
  box-shadow:none;
}

.theme-natural .card,
.theme-natural .panel,
.theme-natural .post{
  border-radius:28px;
  box-shadow:none;
}

.theme-natural .tweet-card,
.theme-natural .admin-row{
  box-shadow:none;
}

.theme-mono .card,
.theme-mono .panel,
.theme-mono .post{
  border:2px solid #111;
  border-radius:8px;
  box-shadow:6px 6px 0 #111;
}

.theme-mono .card-link:hover {
  box-shadow: 6px 6px 0 #111;
}

/* Home hero */
.hero-full{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  max-width:none;
  min-height:clamp(280px,44vh,480px);
  margin:0;
  padding:0 5vw;
  overflow:hidden;
  border:0;
  border-radius:0;
  background-color:var(--accent);
  background-size:cover;
  background-position:center;
}

.hero-full::before{
  content:"";
  position:absolute;
  inset:0;
  background: #000;
  opacity: .5;
}

.hero-full .hero-inner{
  position:relative;
  z-index:1;
  width:min(980px,100%);
  color:#fff;
  text-shadow:0 2px 16px rgba(0,0,0,.36);
}

.hero-full h1{
  margin:0 0 .18em;
  font-size:clamp(2rem,5vw,4.35rem);
  line-height:1.12;
}

.hero-full p{
  color:rgba(255,255,255,.88);
  font-size:clamp(1rem,2vw,1.35rem);
  font-weight: 500;
}

.theme-simple .hero-full::before{background:linear-gradient(110deg,rgba(38,56,66,.86),rgba(80,106,120,.58),rgba(232,238,241,.38))}
.theme-natural .hero-full::before{background: #968686; opacity: .7;}
.theme-dark .hero-full::before{background: #2a3444;}
.theme-pop .hero-full::before{background:linear-gradient(115deg,rgba(255,63,164,10.78),rgba(122,92,255,7.52),rgba(143,242,255,20.42))}

/* Cards and archives */
.card,.panel,.post{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:18px;
  box-shadow:0 6px 20px #00000008;
}

body > main.panel{
  width:min(520px,calc(100% - 36px));
  margin:48px auto;
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:18px;
}

.works-grid,
.diary-grid,
.search-results-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
}

.work-card,
.diary-card{
  display:flex;
  flex-direction:column;
  min-height:100%;
}

.card-link{
  display:block;
  color:inherit;
  text-decoration:none;
  transition:transform .15s ease,box-shadow .15s ease;
}

.card-link:hover{
  transform:translateY(-2px);
  box-shadow:0 10px 26px #00000012;
}

.card img,
.thumb,
.cover,
.body-image,
.image-protect,
.image-protect img,
.no-image{
  border-radius:0;
}

.card-media{
  position:relative;
  display:block;
  width:100%;
  overflow:hidden;
  background:var(--accent2);
  aspect-ratio:16/10;
}

.card-media .card-image,
.card-media img,
.card-media .no-image{
  width:100%;
  height:100%;
  object-fit:cover;
}

.card-media .sensitive-cover,
.card-image.sensitive-cover{
  filter:blur(12px);
  transform:scale(1.04);
}

.card-media .age-badge{
  position:absolute;
  left:8px;
  top:8px;
  z-index:2;
  margin:0;
}

.card>.age-badge,
.card-link>.age-badge{
  display:none;
}

.work-card h2,
.work-card h3,
.diary-card h2,
.diary-card h3,
.card h2,
.card h3{
  margin:.75em 0 0;
  font-size:.98rem;
  line-height:1.55;
}

.work-card .meta,
.diary-card .meta,
.search-results-grid .meta {
  margin:0;
  color:var(--muted);
  font-size: .78rem;
}

.cover{
  width:100%;
  max-height:440px;
  object-fit:cover;
}

.no-image{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  aspect-ratio:16/10;
  background:var(--accent2);
  color:var(--muted);
  font-weight:800;
  letter-spacing:.08em;
}

.image-protect{
  position:relative;
  display:block;
  overflow:hidden;
  -webkit-touch-callout:none;
  user-select:none;
}

.image-protect img{
  display:block;
  width:100%;
  height:auto;
  pointer-events:none;
  -webkit-user-drag:none;
  user-select:none;
}

.image-protect::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:2;
  background:transparent;
}

.image-protect .wm{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  z-index:3;
  padding:3px 8px;
  background-image: linear-gradient(0deg, #3b3b3b38 15%, transparent);
  color:#fff;
  text-align:right;
  font-size:10px;
  line-height:1.4;
  pointer-events:none;
}

.image-protect.card-image img{aspect-ratio:16/10;object-fit:cover}
.image-protect.thumb{max-width:220px}
.image-protect.body-image{max-width:100%;margin:1.2em auto 0}
.image-protect.sensitive-cover img{filter:blur(14px);transform:scale(1.01)}

/* Labels and pagination */
.age-badge{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:4px 10px;
  color:#fff;
  font-size:.78rem;
  font-weight:800;
  line-height:1.4;
}

.age-badge.nsfw{background:#f1538e}
.age-badge.r18{background:#000;color:#fff}

.theme-pop .nsfw{background:#9c3fff}
.theme-natural .nsfw{background:#f16f53}

.status-badge,
.type-badge{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:3px 9px;
  font-size:.78rem;
  font-weight:800;
}

.status-badge.published{background:#e8f6ed;color:#1f6d3a;border:1px solid #b9dfc5}
.status-badge.draft{background:#f3f3f3;color:#555;border:1px solid #d9d9d9}
.status-badge.locked{background:#efe2ff;color:#5c248f}
.type-badge{background:var(--accent2);color:var(--fg)}
.muted{color:var(--muted)}

.pagination,
.post-pager{
  display:flex;
  gap:8px;
  justify-content:center;
  flex-wrap:wrap;
  margin:28px 0;
}

.post-pager{margin-top:28px;margin-bottom:0}

.pagination a,
.pagination span,
.post-pager a,
.post-pager span{
  min-width:38px;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--card);
  color:var(--fg);
  text-align:center;
  text-decoration:none;
}

.pagination .current,
.post-pager .current{
  background:var(--accent);
  color:#fff;
  border-color:var(--accent);
}

/* Home latest */
.home-section{
  margin:36px 0;
}

.home-intro-section{
  padding-bottom:24px;
}

.home-intro-section h2{
  margin:0 0 .6em;
}

.home-intro-body{
  color:var(--fg);
}

.home-intro-body > :last-child{
  margin-bottom:0;
}

.section-head{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:14px;
  margin-bottom:8px;
  padding-bottom:0;
  border-bottom:0;
}

.section-head h2{
  margin:0;
}

.section-head .more-link{
  display:none;
}

.home-carousel{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:18px;
  max-width:none;
}

.home-carousel .card,
.home-carousel .tweet-card,
.home-carousel .gallery-thumb{
  height:100%;
  min-width:0;
}

.home-more-card{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100%;
  border:1px dashed color-mix(in srgb,var(--line) 72%,var(--muted));
  background:color-mix(in srgb,var(--card) 76%,var(--accent2));
  color:var(--fg);
  text-decoration:none;
  font-weight:900;
}

.home-latest-list{
  display:grid;
  gap:0;
  border-top:0;
}

.home-latest-item{
  display:grid;
  grid-template-columns:auto auto minmax(0,1fr);
  gap:10px;
  align-items:center;
  padding:10px 0;
  border-bottom:1px solid var(--line);
  color:var(--fg);
  text-decoration:none;
}

.home-latest-item:hover .home-latest-title{
  text-decoration:underline;
  text-underline-offset:3px;
}

.home-latest-item time{
  color:var(--muted);
  font-variant-numeric:tabular-nums;
}

.home-latest-type{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--line);
  border-radius:999px;
  background:color-mix(in srgb,var(--card) 72%,var(--accent2));
  color:var(--muted);
  padding:2px 9px;
  font-size:.78rem;
  font-weight:700;
  line-height:1.5;
  white-space:nowrap;
}

.theme-pop .home-latest-type{
  background:#000;
  color:#fff;
  border-color:#000;
}

.home-latest-title{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Post body */
.post{
  border-radius:20px;
  padding:24px;
}

.post h1,
main>h1{
  font-size:clamp(1.55rem,3.4vw,2.05rem);
  line-height:1.45;
}

.post .meta{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin:0 0 .65em;
  color:var(--muted);
  font-size:.9rem;
}

.post .meta .meta-date{
  color:var(--muted);
  font-variant-numeric:tabular-nums;
}

.post .meta .age-badge{
  margin:0;
  padding:1px 7px;
  font-size:.68rem;
  line-height:1.45;
}

.post :is(p,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,figure,details){
  margin-block-start:0;
  margin-block-end:1em;
}

.post :is(p,h2,h3,h4,h5,h6,ul,ol,blockquote,pre,figure,details):last-child{
  margin-block-end:0;
  margin-block-start: 1em;
}

.body,
.post .body,
.tweet-card .body{
  font-size:var(--body-font-size,16px);
  font-weight:var(--body-font-weight,400);
  line-height:var(--body-line-height,1.9);
  overflow-wrap:anywhere;
  word-break:break-word;
}

.body :is(strong,b){
  font-weight:700;
}

.body-image{
  display:block;
  max-width:100%;
  height:auto;
  margin:1.2em auto;
}

.body .password-form{
  font-size:1rem;
}

.body-accordion,
.tweet-card details{
  margin:0;
  border:0;
  border-radius:0;
  background:transparent;
  padding:0;
}

.body-accordion summary,
.tweet-card summary{
  display:inline-flex;
  align-items:center;
  gap:7px;
  cursor:pointer;
  padding:0;
  color:var(--accent);
  font-weight:500;
  list-style:none;
}

.body-accordion summary::-webkit-details-marker,
.tweet-card summary::-webkit-details-marker{
  display:none;
}

.body-accordion summary::marker,
.tweet-card summary::marker{
  content:"";
}

.body-accordion summary::before,
.tweet-card .more-toggle-icon::before{
  content:"\002B";
  display:inline-grid;
  place-items:center;
  width:1.35em;
  height:1.35em;
  border:1px solid var(--accent);
  border-radius:999px;
  color:var(--accent);
  font-weight:700;
  line-height:1;
}

.body-accordion[open] summary::before,
.tweet-card details[open] .more-toggle-icon::before{
  content:"\2212";
}

.body-accordion>div{
  margin-top:.65em;
  padding:0;
  color:var(--fg);
}

.tweet-card details[open] summary{
  margin-bottom:.7em;
}

.tweet-card .more-read-label{
  color:var(--accent);
  font-size:.9rem;
  font-weight:500;
}

.post-date,
.tweet-date{
  margin-top:1.4em;
  margin-bottom:0;
  color:var(--muted);
  font-size:.9rem;
  text-align:right;
}

.tags{
  color:var(--muted);
}

/* Search and tags */
.tagcloud{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.tagcloud a{
  padding:6px 12px;
  border-radius:999px;
  background:var(--accent2);
  color:var(--fg);
  text-decoration:none;
  font-weight:700;
}

.theme-pop .tagcloud a{
  background:#000;
  color:#fff;
}

.tweet-list{
  display:grid;
  grid-template-columns:1fr;
  gap:14px;
}

.tweet-card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:18px;
  padding:18px;
  box-shadow:0 6px 20px #00000008;
}

.theme-dark .tweet-card {
  box-shadow: none;
  border: none;
}

.tweet-card .age-badge{
  position:static;
  display:inline-flex;
  margin:0 12px 0 0;
  min-width: 54px;
  justify-content: center;
}

.search-controls{
  margin-top:36px;
  padding-top:22px;
  border-top:1px solid var(--line);
}

.search-controls-plain{
  margin-top:0;
  padding-top:0;
  border-top:0;
}

.searchbox,
.inline-form,
.password-form{
  display:flex;
  align-items:stretch;
  gap:8px;
}

.searchbox{
  margin-bottom:20px;
}

.searchbox input,
.inline-form input,
.password-form input{
  flex:1;
  min-width:0;
  min-height:46px;
  padding: 0 12px;
}

.searchbox button,
.inline-form button,
.password-form button{
  align-self:stretch;
  min-height:46px;
  min-width: 90px;
  width:auto;
  margin:0;
  padding:0 18px;
  white-space:nowrap;
  font-size:1.02rem;
}

.password-form{
  max-width:440px;
  margin:18px 0;
  padding:0;
  border:0;
  background:transparent;
}

.password-form p{
  display:none;
}

.password-form input::placeholder{
  color:var(--muted);
  opacity:1;
}

/* Gallery */
.gallery-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}

.gallery-groups{
  display:grid;
  gap:30px;
}

.gallery-group h2{
  margin:0 0 10px;
  color:var(--fg);
  font-size:1.08rem;
}

.gallery-thumb{
  position:relative;
  display:block;
  aspect-ratio:1/1;
  overflow:hidden;
  border:0;
  border-radius:0;
  padding:0;
  background:var(--fg);
  cursor:pointer;
}

.theme-dark .gallery-thumb{background:var(--bg);}

.gallery-thumb img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}

.gallery-thumb .age-badge{
  position:absolute;
  left:6px;
  top:6px;
  z-index:3;
  margin:0;
}

.gallery-thumb.is-sensitive img{
  filter: blur(10px);
  transform: scale(1.3);
  opacity: 0.5;
}

.gallery-modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:99999;
  align-items:center;
  justify-content:center;
  padding:50px 48px;
  background:rgba(0,0,0,.88);
}

.gallery-modal.is-open{
  display:flex;
}

.gallery-modal figure{
  position:relative;
  z-index:100001;
  max-width:min(94vw,1100px);
  max-height:90vh;
  margin:0;
  color:#fff;
  text-align:center;
}

.gallery-modal img{
  max-width:100%;
  max-height:82vh;
  object-fit:contain;
}

.gallery-modal figcaption{
  display:none;
}

.gallery-close,
.gallery-prev,
.gallery-next{
  position:absolute;
  z-index:100002;
  border:1px solid rgba(255,255,255,.35);
  border-radius:0;
  background:rgba(0,0,0,.82);
  color:#fff;
  box-shadow:0 8px 24px rgba(0,0,0,.45);
}

.theme-pop .gallery-close,
.theme-pop .gallery-prev,
.theme-pop .gallery-next{
  background:rgba(0,0,0,.82);
  color:#fff;
}

.gallery-close{
  right:16px;
  top:14px;
  font-size:26px;
}

.gallery-prev,
.gallery-next{
  top:50%;
  transform:translateY(-50%);
  padding:10px 18px;
  font-size:42px;
}

.gallery-prev{left:12px}
.gallery-next{right:12px}

.modal-image-protect,
.gallery-modal-image-wrap{
  position:relative;
  display:inline-block;
  max-width:100%;
  line-height:0;
  -webkit-touch-callout:none;
  user-select:none;
}

.modal-image-protect::after,
.gallery-modal-image-wrap::after{
  content:"";
  position:absolute;
  inset:0;
  z-index:3;
  background:transparent;
}

.modal-image-protect img,
.gallery-modal-image-wrap img{
  display:block;
  pointer-events:none;
  -webkit-user-drag:none;
  user-select:none;
}

.modal-image-protect .wm,
.gallery-modal-image-wrap .wm{
  display:none;
  position:absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 3px 8px;
  background: linear-gradient(#00000021 0%, #0000006b 100%);
  color:#fff;
  text-align:center;
  font-size:.8rem;
  line-height:1.4;
  letter-spacing:.08em;
}

.gallery-modal.has-watermark .modal-image-protect .wm{
  display:block;
}

/* Admin */
.admin-layout{
  display:grid;
  grid-template-columns:190px minmax(0,1fr);
  gap:24px;
  align-items:start;
}

.admin-side{
  position:sticky;
  top:16px;
  display:grid;
  gap:10px;
  padding:16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:var(--card);
}

.admin-side h2{
  margin:0;
  font-size:1rem;
}

.admin-side .btn{
  display:flex;
  text-align:center;
  line-height: 1.8;
}

.admin-side hr{
  width:100%;
  margin:4px 0;
  border:0;
  border-top:1px solid var(--line);
}

.admin-side .fa-solid,
.admin-actions .fa-solid{
  margin-right:.35em;
}

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

.admin-layout label,
.editor label,
.admin-filter label{
  font-weight:400;
}

.admin-filter{
  display:flex;
  gap:12px;
  align-items:end;
  flex-wrap:wrap;
  max-width:none;
  margin-bottom:18px;
}

.admin-filter label{
  flex:0 1 220px;
  min-width:180px;
  margin:0;
}

.admin-list{
  display:grid;
  gap:14px;
  padding-top:4px;
}

.admin-row{
  display:block;
  overflow:hidden;
  padding:0;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--card);
  box-shadow:0 8px 22px rgba(0,0,0,.045);
}

.admin-row-body{
  display:flex;
  gap:12px;
  min-width:0;
  padding:10px 14px 14px;
}

.admin-row-main{
  display:block;
  flex:1;
  min-width:0;
}

.admin-title-line{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  min-width:0;
}

.admin-title{
  display:block;
  min-width:0;
  overflow:hidden;
  color:var(--fg);
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:1.02rem;
  font-weight:700;
  line-height:1.55;
}

.admin-title-link{
  color:var(--fg);
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-underline-offset:4px;
}

.admin-title-link:hover{
  color:var(--accent);
}

.admin-public-link{
  display:none;
}

.admin-status{
  display:inline-flex;
  align-items:center;
  margin:12px 14px 0;
  padding:2px 9px;
  border-radius:999px;
  font-size:.78rem;
  font-weight:700;
  line-height:1.6;
}

.admin-badges{
  display:flex;
  align-items:center;
  gap:7px;
  flex-wrap:wrap;
  margin:10px 0 0;
}

.admin-badges .type-badge,
.admin-badges .status-badge,
.admin-badges .age-badge{
  border:1px solid var(--muted);
  background:transparent;
  color:var(--muted);
  padding:2px 9px;
  font-size:.78rem;
  font-weight:700;
  line-height:1.5;
  gap: 3px;
}

.admin-badges .muted{
  margin-left:auto;
  color:var(--muted);
  font-size:.78rem;
}

.admin-actions{
  display:flex;
  gap:0;
  margin:0;
  border-top:1px solid var(--line);
}

.admin-actions form{
  display:flex;
  flex:0 0 34%;
  margin:0;
  border-left: 1px solid var(--line);
}

.admin-actions .btn.small,
.admin-actions button{
  display:flex;
  align-items:center;
  justify-content:center;
  flex:1;
  width:100%;
  min-height:42px;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--fg);
  padding:9px 12px;
  font-size:.92rem;
  line-height:1.2;
}

.admin-actions .btn.small{
  font-weight:700;
}

.admin-actions .btn.danger,
.admin-actions button.danger{
  border-left:1px solid var(--line);
  color:var(--danger);
}

.admin-actions .danger .fa-solid{
  color:inherit;
}

.admin-thumb{
  width:74px;
  height:74px;
  flex:0 0 auto;
  margin:0;
  border:1px solid var(--line);
  background:color-mix(in srgb,var(--card) 78%,#eee);
  object-fit:cover;
}

.admin-type-gallery .admin-row-body{
  align-items:center;
}

.admin-type-gallery .admin-badges{
  margin-top:0;
}

.toolbar,
.adminbar{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin:8px 0 20px;
}

.toolbar button,
.toolbar .tool-file{
  min-height:38px;
  margin:0;
  padding:8px 12px;
  border:0;
  border-radius:999px;
  background:var(--accent);
  color:#fff;
  box-shadow:none;
  font-size:.9rem;
  font-weight:700;
  line-height:1.2;
  vertical-align:middle;
}

.toolbar .tool-file input{
  display:none;
}

.editor{
  max-width:760px;
}

.editor>button,
.panel form>button,
.login-button{
  width:100%;
  margin-top:12px;
  padding:14px 18px;
  font-size:1.08rem;
}

.settings-preview {
  max-width: 200px;
}

.cover-field{
  margin:14px 0;
}

.gallery-category-field{
  display:none;
}

/* Settings and system messages */
.settings-group{
  margin:22px 0 0;
  padding:18px 0 0;
  border:0;
  border-top:1px solid var(--line);
}

.settings-group legend{
  padding:0 10px 0 0;
  color:var(--fg);
  font-weight:800;
}

.settings-group label:first-of-type{
  margin-top:8px;
}

.error{
  padding:10px;
  border-radius:10px;
  background:#ffe8e8;
  color:#8a1f1f;
}

.ok{
  padding:10px;
  border-radius:10px;
  background:#e8ffed;
  color:#176b2a;
}

.privacy-screen{
  display:none;
  position:fixed;
  inset:0;
  z-index:999999;
  align-items:center;
  justify-content:center;
  background:#000;
  color:#fff;
  font-weight:700;
}

.privacy-mask .privacy-screen{
  display:flex;
}

.privacy-mask body>*:not(.privacy-screen){
  visibility:hidden;
}

/* Utilities */
.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;
}

.foot{
  padding:22px 5vw;
  color:var(--muted);
  text-align:center;
  font-size:.78rem;
}

/* Responsive */
@media(min-width:760px){
  .admin-list{
    grid-template-columns:repeat(auto-fit,minmax(340px,1fr));
    gap:16px;
  }
}

@media(max-width:760px){
  main{
    padding:18px;
  }

  .site{
    display:flex;
    align-items:center;
  }

  .menu-toggle{
    display:block;
    margin-left:auto;
  }

  .site nav{
    display:none;
    position:absolute;
    left:0;
    right:0;
    top:100%;
    z-index:50;
    gap:0;
    padding:12px 5vw;
    border-bottom:1px solid var(--line);
    background:var(--card);
    box-shadow:0 12px 24px #00000018;
  }

  .site nav.is-open{
    display:grid;
  }

  .site nav a{
    display:flex;
    padding:10px 0;
    border-bottom:1px solid var(--line);
  }

  .site nav a:last-child{
    border-bottom:0;
  }

  .hero-full{
    min-height:240px;
  }

  .home-section{
    margin:12px 0 0;
  }

  .home-carousel{
    display:flex;
    gap:12px;
    overflow-x:auto;
    overscroll-behavior-x:contain;
    scroll-snap-type:x proximity;
    padding:0 18px 8px;
    margin-left:-18px;
    margin-right:-18px;
  }

  .home-carousel .card,
  .home-carousel .tweet-card,
  .home-carousel .gallery-thumb{
    flex:0 0 min(78vw,320px);
    scroll-snap-align:start;
  }

  .home-more-card{
    min-height:160px;
  }

  .works-grid,
  .diary-grid,
  .search-results-grid{
    grid-template-columns:1fr;
    gap:16px;
  }

  .gallery-grid{
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:6px;
  }

  .gallery-modal{
    padding:44px 10px;
  }

  .gallery-prev,
  .gallery-next{
    padding:5px 9px;
    font-size:26px;
  }

  .gallery-prev{left:6px}
  .gallery-next{right:6px}
  .gallery-close{
    right:8px;
    top:8px;
    padding:4px 9px;
    font-size:20px;
  }

  .admin-layout{
    grid-template-columns:1fr;
  }

  .admin-side{
    position:static;
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .admin-side h2,
  .admin-side hr{
    grid-column:1/-1;
  }
}

@media(max-width:640px){
  .card,
  .panel{
    padding:24px;
  }

  .post{
    padding:18px;
  }

  .home-latest-item{
    grid-template-columns:auto auto minmax(0,1fr);
    gap:7px;
    font-size:.92rem;
  }

  .home-latest-type{
    padding:2px 7px;
    font-size:.74rem;
  }

  .searchbox button,
  .password-form button{
    padding:0 14px;
  }

  .admin-filter{
    display:grid;
    grid-template-columns:1fr;
    gap:10px;
  }

  .admin-filter label{
    min-width:0;
    flex:auto;
  }

  .admin-list{
    gap:16px;
  }

  .admin-row-body{
    padding:9px 12px 12px;
  }

  .admin-status{
    margin:10px 12px 0;
  }

  .admin-title{
    font-size:.98rem;
  }

  .admin-badges{
    gap:6px;
  }

  .admin-badges .muted{
    display:none;
  }

  .admin-actions .btn.small,
  .admin-actions button{
    min-height:40px;
  }

  .admin-thumb{
    width:54px;
    height:54px;
  }

  .tweet-card{
    padding:14px;
  }
}
