
:root {
  --page-bg: #e8e8e5;
  --panel-bg: #ffffff;
  --header-bg: #202b35;
  --header-border: #111a21;
  --accent: #8b1e2d;
  --accent-hover: #681522;
  --link: #28577a;
  --border: #c7c9c8;
  --text: #25292c;
  --muted: #6a7074;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Arial, "Noto Sans JP", sans-serif;
  font-size: 14px;
  line-height: 1.65;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Header */

.site-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  background: var(--header-bg);
  border-bottom: 5px solid var(--header-border);
  color: #fff;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #fff;
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
}

.logo-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 2px solid #e5e8ea;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -1px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.logo-text strong {
  font-size: 17px;
  letter-spacing: 0.12em;
}

.logo-text small {
  margin-top: 4px;
  color: #c4cbd0;
  font-size: 10px;
  letter-spacing: 0.2em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-link,
.header-register {
  display: inline-block;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
}

.header-link {
  color: #f0f2f3;
}

.header-register {
  background: var(--accent);
  color: #fff;
  border: 1px solid #b34b58;
}

.header-register:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* Main layout */

.page-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px;
  align-items: start;
}

.sidebar {
  background: #f8f8f6;
  border: 1px solid var(--border);
  padding: 14px 0;
}

.side-section {
  padding: 0 12px 16px;
}

.side-section + .side-section {
  border-top: 1px solid #dedfdd;
  padding-top: 14px;
}

.side-section h2 {
  margin: 0 0 7px;
  padding: 0 8px;
  color: #73797d;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.side-link {
  display: block;
  padding: 7px 9px;
  border-left: 3px solid transparent;
  color: #34434c;
  font-size: 13px;
}

.side-link:hover {
  background: #e9ecee;
  text-decoration: none;
}

.side-link.active {
  background: #e5e8ea;
  border-left-color: var(--accent);
  font-weight: 700;
}

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

.breadcrumb {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumb a {
  color: var(--link);
}

/* Welcome */

.welcome-panel {
  padding: 30px 34px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-top: 5px solid var(--accent);
}

.panel-label {
  color: #777d80;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.welcome-panel h1 {
  margin: 8px 0 12px;
  color: #25292c;
  font-family: Georgia, "Noto Serif JP", serif;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.15;
}

.welcome-panel p {
  max-width: 720px;
  margin: 0;
  color: #4f565a;
  font-size: 15px;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button-primary,
.button-secondary {
  display: inline-block;
  padding: 10px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.button-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.button-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.button-secondary {
  background: #f6f6f4;
  color: #343a3e;
  border-color: #bfc3c4;
}

.button-secondary:hover {
  background: #e9ebeb;
  text-decoration: none;
}

/* Content columns */

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 255px;
  gap: 20px;
  margin-top: 22px;
  align-items: start;
}

.content-panel,
.account-panel,
.info-panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
}

.content-panel {
  min-width: 0;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 17px;
  background: #f3f4f2;
  border-bottom: 1px solid var(--border);
}

.panel-heading h2,
.account-panel h2,
.info-panel h2 {
  margin: 0;
  font-size: 15px;
}

.panel-heading a {
  font-size: 11px;
}

.dream-list {
  padding: 0 17px;
}

.dream-list .loading {
  color: var(--muted);
}

.dream-record {
  display: block;
  padding: 17px 2px;
  border-bottom: 1px solid #dedfdd;
  color: var(--text);
}

.dream-record:last-child {
  border-bottom: 0;
}

.dream-record:hover {
  text-decoration: none;
  background: #fafaf8;
}

.dream-record small {
  color: #73797d;
  font-size: 10px;
}

.dream-record h3 {
  margin: 5px 0;
  color: var(--link);
  font-size: 17px;
}

.dream-record p {
  margin: 0;
  color: #5d6468;
  font-size: 12px;
}

/* Right column */

.right-column {
  display: grid;
  gap: 15px;
}

.account-panel,
.info-panel {
  padding: 17px;
}

.account-panel h2,
.info-panel h2 {
  padding-bottom: 10px;
  border-bottom: 1px solid #dedfdd;
}

.account-panel p,
.info-panel p {
  margin: 12px 0;
  color: #5b6266;
  font-size: 12px;
}

.full-width {
  display: block;
  width: 100%;
  margin-top: 9px;
}

.info-panel a {
  display: block;
  padding: 6px 0;
  border-bottom: 1px solid #eeeeeb;
  font-size: 12px;
}

.site-footer {
  margin-top: 35px;
  padding: 14px 0;
  border-top: 1px solid #bfc2c1;
  color: #73797d;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.12em;
}

/* Responsive */

@media (max-width: 1050px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .right-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-panel {
    grid-row: span 2;
  }
}

@media (max-width: 700px) {
  .site-header {
    padding: 12px 14px;
  }

  .logo-text strong {
    font-size: 13px;
  }

  .header-actions {
    gap: 4px;
  }

  .header-link,
  .header-register {
    padding: 8px 9px;
    font-size: 11px;
  }

  .page-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-section {
    padding-bottom: 10px;
  }

  .side-section + .side-section {
    border-top: 0;
    padding-top: 0;
  }

  .welcome-panel {
    padding: 23px 20px;
  }

  .right-column {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-panel {
    grid-row: auto;
  }
}
/* Secondary pages (header / layout / editorPage / auth) */

header {
  padding: 12px 28px;
  background: var(--header-bg);
  border-bottom: 5px solid var(--header-border);
  color: #fff;
}

header > div {
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: 1440px;
  margin: 0 auto;
}

a.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.12em;
}

a.brand:hover {
  text-decoration: none;
}

header span {
  color: #c4cbd0;
  font-size: 10px;
  letter-spacing: 0.2em;
}

.layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px;
  align-items: start;
}

.layout > aside {
  background: #f8f8f6;
  border: 1px solid var(--border);
  padding: 14px 0;
}

.layout > aside b {
  display: block;
  margin: 14px 0 7px;
  padding: 0 12px;
  color: #73797d;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.layout > aside b:first-child {
  margin-top: 0;
}

.layout > aside a {
  display: block;
  padding: 7px 12px;
  border-left: 3px solid transparent;
  color: #34434c;
  font-size: 13px;
  text-decoration: none;
}

.layout > aside a:hover {
  background: #e9ecee;
  text-decoration: none;
}

.layout > aside a.active {
  background: #e5e8ea;
  border-left-color: var(--accent);
  font-weight: 700;
}

.layout > main {
  min-width: 0;
}

.editorPage {
  padding: 24px 28px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-top: 5px solid var(--accent);
}

.editorPage > small {
  color: #777d80;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.editorPage > h1 {
  margin: 8px 0 16px;
  color: #25292c;
  font-family: Georgia, "Noto Serif JP", serif;
  font-size: 28px;
  line-height: 1.2;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 17px;
  margin-bottom: 16px;
  background: #f3f4f2;
  border: 1px solid var(--border);
  color: #73797d;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

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

.editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 5px;
}

.editor textarea {
  min-height: 320px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.editor #preview {
  padding: 10px;
  background: #fafaf8;
  border: 1px solid var(--border);
  overflow: auto;
  font-size: 13px;
}

form label {
  display: block;
  margin: 12px 0;
  color: #4f565a;
  font-size: 12px;
  font-weight: 700;
}

form input,
form select,
form textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
}

form input:focus,
form select:focus,
form textarea:focus {
  outline: 2px solid var(--link);
  outline-offset: -1px;
}

form small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
}

button,
form button {
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
form button:hover {
  background: var(--accent-hover);
}

body.dark {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--header-bg);
}

.auth {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}

.authbox {
  padding: 28px 26px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-top: 5px solid var(--accent);
}

.authbox small {
  color: #777d80;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.authbox h1 {
  margin: 8px 0 18px;
  color: var(--text);
  font-family: Georgia, "Noto Serif JP", serif;
  font-size: 24px;
}

.authbox p,
.authbox a {
  font-size: 12px;
}

.authbox p {
  margin: 12px 0 0;
  color: #5b6266;
}

@media (max-width: 700px) {
  header {
    padding: 12px 14px;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
  }

  .layout > aside {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editorPage {
    padding: 18px 16px;
  }

  .two,
  .editor {
    grid-template-columns: 1fr;
  }
}

/* Rich document content */
.docBody table{width:100%;border-collapse:collapse;margin:16px 0;font-size:13px}
.docBody th,.docBody td{border:1px solid var(--border);padding:7px 9px;text-align:left;vertical-align:top}
.docBody th{background:#f3f4f2;font-weight:700}
.docBody img{max-width:100%;height:auto}
.rt-embed{position:relative;width:100%;aspect-ratio:16/9;margin:16px 0;background:#111}
.rt-embed iframe{width:100%;height:100%;border:0}
.info-panel figure{margin:12px 0}
.info-panel figure img{display:block;max-width:100%;height:auto}
#mediaList article{padding:10px 0;border-bottom:1px solid #eeeeeb}
#mediaList small{display:block;color:var(--muted)}
#mediaList button{margin-top:6px}

.paper{background:var(--article-paper,var(--panel-bg));color:var(--article-text,var(--text));border-radius:var(--article-radius,0);box-shadow:var(--article-shadow,none);border-top-color:var(--article-accent,var(--accent))}
body[data-article-effect="glow"] .paper{box-shadow:0 0 28px rgba(139,30,45,.18)}
body[data-article-effect="scanlines"] .paper{background-image:repeating-linear-gradient(to bottom,transparent 0,transparent 3px,rgba(0,0,0,.035) 4px)}
body[data-article-effect="soft"] .paper{filter:saturate(.92)}
body[data-article-font="serif"] .paper,.paper[data-font="serif"]{font-family:Georgia,"Noto Serif JP",serif}
body[data-article-font="mono"] .paper,.paper[data-font="mono"]{font-family:ui-monospace,SFMono-Regular,Consolas,monospace}

.rt-tool-embed{width:100%;margin:16px 0}
.rt-tool-embed iframe{display:block;width:100%;min-height:320px;border:1px solid var(--border);background:var(--panel-bg)}
