:root {
  --paper: #f4f0e7;
  --paper-deep: #e9e2d4;
  --ink: #252521;
  --muted: #746f65;
  --line: #cfc6b6;
  --accent: #bd3b2d;
  --moss: #526152;
  --shadow: 0 24px 70px rgba(60, 49, 35, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "BIZ UDPMincho", serif;
  line-height: 1.8;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .24; background-image: radial-gradient(#574d3b 0.45px, transparent .55px); background-size: 5px 5px; mix-blend-mode: multiply; z-index: 10; }
.eyebrow { margin: 0 0 .55rem; color: var(--accent); font: 700 .7rem/1.2 Georgia, serif; letter-spacing: .2em; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr); }
.login-copy { padding: clamp(3rem, 8vw, 9rem); display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.login-copy::after { content: "余"; position: absolute; right: -4vw; bottom: -20vh; color: rgba(189, 59, 45, .055); font-size: min(55vw, 48rem); line-height: 1; }
.login-copy h1 { margin: 0; max-width: 8em; font-size: clamp(3.4rem, 8vw, 8.5rem); font-weight: 400; line-height: .96; letter-spacing: -.06em; }
.login-copy h1 span { display: block; margin-top: .5em; font-size: .32em; letter-spacing: .08em; }
.lead { margin-top: 3rem; font-size: clamp(1rem, 1.5vw, 1.25rem); color: var(--muted); }
.login-panel { background: #252521; color: var(--paper); display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 6vw, 6rem); position: relative; }
.login-panel .seal { width: 3.25rem; height: 3.25rem; display: grid; place-items: center; background: var(--accent); margin-bottom: 3rem; font-size: 1.4rem; }
.login-panel h2 { font-size: 2rem; font-weight: 400; margin: 0; }
.login-panel p { color: #bbb3a5; }
.login-panel strong { color: var(--paper); font-weight: 700; }
.setup-hint { margin: .4rem 0 0; color: #bbb3a5; font-size: .76rem; line-height: 1.6; }
.login-panel select { border-color: #5c5a54; color-scheme: dark; }
.login-panel select option { background: #252521; color: var(--paper); }

label { display: grid; gap: .35rem; margin: 1.1rem 0; font-size: .86rem; letter-spacing: .04em; }
input, textarea, select { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: inherit; padding: .72rem .2rem; outline: none; transition: border-color .2s, background .2s; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); background: rgba(255,255,255,.28); }
.login-panel input { border-color: #5c5a54; }
.login-panel input:focus { background: rgba(255,255,255,.05); }
.button { border: 1px solid var(--ink); padding: .72rem 1.25rem; background: transparent; color: var(--ink); cursor: pointer; transition: transform .2s, background .2s, color .2s; }
.button:hover { transform: translateY(-2px); }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.quiet:hover { background: var(--ink); color: var(--paper); }
.button.wide { width: 100%; margin-top: 1rem; }
.text-button, .text-link, .author-link { border: 0; padding: .2rem 0; color: inherit; background: none; cursor: pointer; text-decoration: none; border-bottom: 1px solid currentColor; }
.form-error { min-height: 1.8em; color: #df776d !important; font-size: .86rem; }

.topbar { height: 74px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 clamp(1.2rem, 4vw, 4rem); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 8; background: rgba(244,240,231,.94); backdrop-filter: blur(12px); }
.wordmark { color: var(--ink); text-decoration: none; font-size: 1.55rem; letter-spacing: .12em; }
.wordmark span { margin-left: .75rem; color: var(--muted); font: .58rem Georgia, serif; letter-spacing: .22em; }
.topbar nav { display: flex; gap: 2.2rem; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: .83rem; }
.topbar nav a.active { color: var(--ink); border-bottom: 1px solid var(--accent); }
.identity { justify-self: end; display: flex; gap: 1rem; align-items: center; font-size: .82rem; }
.identity > span::before { content: "@"; color: var(--accent); }
.identity .text-button { color: var(--muted); border: 0; }
.content { width: min(1080px, calc(100% - 3rem)); margin: 0 auto; padding: clamp(3.5rem, 8vw, 7rem) 0 8rem; }
.screen { animation: enter .48s ease-out both; }
@keyframes enter { from { opacity: 0; transform: translateY(12px); } }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: clamp(2rem, 5vw, 4rem); }
.section-heading h1 { margin: 0; font-weight: 400; font-size: clamp(2.2rem, 5vw, 4.5rem); line-height: 1.1; letter-spacing: -.04em; }
.section-heading > p { color: var(--muted); font-size: .88rem; }
.room-name::before { content: "— "; color: var(--accent); }

.post-card { background: rgba(255,255,255,.38); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; }
.feature-card { padding: clamp(2rem, 7vw, 6rem); min-height: min(52vh, 530px); display: flex; flex-direction: column; justify-content: center; overflow: hidden; }
.feature-card::before { content: "“"; position: absolute; top: -2rem; left: 1rem; color: var(--accent); opacity: .13; font: 14rem Georgia, serif; }
.post-meta { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: .8rem; }
.author-link { color: var(--accent); border: 0; font-weight: 700; }
.author-link::before { content: "@"; }
.post-body { white-space: pre-wrap; font-size: clamp(1.28rem, 2.7vw, 2.15rem); line-height: 1.75; letter-spacing: .025em; margin: 2rem 0; position: relative; }
.facets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; }
.facets div { border-top: 1px solid var(--line); padding-top: .75rem; }
.facets dt { color: var(--muted); font-size: .69rem; letter-spacing: .08em; }
.facets dd { margin: .2rem 0 0; font-size: .9rem; white-space: pre-wrap; }
.tags { display: flex; gap: .5rem; flex-wrap: wrap; }
.tag { color: var(--moss); background: rgba(82,97,82,.1); padding: .18rem .6rem; font-size: .72rem; }
.home-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 2rem; }
.place-button { position: fixed; z-index: 7; right: clamp(1.2rem, 4vw, 3.5rem); bottom: clamp(1.2rem, 4vw, 3rem); width: 5rem; height: 5rem; border-radius: 50%; display: grid; place-items: center; align-content: center; background: var(--accent); color: white; text-decoration: none; box-shadow: 0 14px 35px rgba(140,44,33,.28); font-size: .82rem; transition: transform .2s; }
.place-button:hover { transform: rotate(-4deg) scale(1.04); }
.place-button span { display: block; font-size: 1.15rem; line-height: 1; }

.paper-form { width: min(760px, 100%); margin: 0 auto; background: rgba(255,255,255,.4); border: 1px solid var(--line); padding: clamp(1.5rem, 5vw, 4rem); box-shadow: var(--shadow); }
.body-field textarea { font-size: 1.3rem; line-height: 1.8; }
details { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 2rem 0; padding: 1rem 0; }
summary { cursor: pointer; color: var(--moss); }
summary span, .hint { color: var(--muted); font-size: .72rem; }
.optional-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; }

.filters { display: grid; grid-template-columns: 1.25fr 1.25fr 1fr 1fr auto auto; gap: 1rem; align-items: end; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 1rem 0; margin-bottom: 3rem; }
.filters label { margin: 0; }
.filters .button { padding: .55rem .8rem; }
.filters .text-button { margin-bottom: .55rem; font-size: .78rem; }
.post-list { display: grid; gap: 1.25rem; }
.list-card { padding: clamp(1.4rem, 4vw, 3rem); box-shadow: none; }
.list-card .post-body { font-size: clamp(1.05rem, 2vw, 1.35rem); margin: 1.25rem 0; }
.post-footer { display: flex; justify-content: space-between; gap: 1rem; align-items: end; }
.owner-actions { display: flex; gap: 1rem; font-size: .75rem; }
.danger { color: #9f3027; }
.empty { padding: 4rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--line); }

dialog { width: min(700px, calc(100% - 2rem)); max-height: calc(100vh - 2rem); border: 0; padding: 0; color: var(--ink); background: var(--paper); box-shadow: 0 30px 100px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(25,24,21,.58); backdrop-filter: blur(3px); }
.paper-form.compact { width: 100%; max-height: calc(100vh - 2rem); overflow: auto; box-shadow: none; }
.dialog-heading { display: flex; justify-content: space-between; align-items: center; }
.dialog-heading h2 { font-weight: 400; }
.icon-button { border: 0; background: none; font-size: 1.6rem; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 2rem; transform: translate(-50%, 2rem); background: var(--ink); color: var(--paper); padding: .7rem 1.2rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-copy { min-height: 48vh; padding: 4rem 1.5rem 3rem; }
  .login-copy h1 { font-size: clamp(3.4rem, 19vw, 6rem); }
  .login-panel { min-height: 52vh; padding: 3rem 1.5rem 4rem; }
  .login-panel .seal { margin-bottom: 1.5rem; }
  .topbar { height: auto; min-height: 68px; grid-template-columns: 1fr auto; padding: .75rem 1.1rem; }
  .topbar nav { order: 3; grid-column: 1 / -1; width: 100%; justify-content: center; gap: 2.5rem; padding-top: .55rem; border-top: 1px solid var(--line); }
  .identity > span { display: none; }
  .content { width: min(100% - 1.5rem, 1080px); padding-top: 3rem; }
  .section-heading { display: block; margin-bottom: 2rem; }
  .section-heading > p { margin-top: 1rem; }
  .feature-card { min-height: 55vh; padding: 2rem 1.4rem; }
  .post-body { font-size: 1.28rem; }
  .facets, .optional-grid { grid-template-columns: 1fr; }
  .home-actions { align-items: stretch; flex-direction: column; gap: 1.1rem; }
  .home-actions .text-link { align-self: flex-start; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .button { align-self: end; }
  .post-footer { align-items: start; flex-direction: column; }
  .place-button { width: 4.25rem; height: 4.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
