:root {
  --ink: #213547;
  --muted: #5d6b76;
  --line: #c9d4dc;
  --surface: rgba(255, 255, 255, 0.94);
  --shadow: 0 12px 30px rgba(47, 72, 88, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.6;
  background: #effafa url("../images/kabe.jpg") repeat;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: #0756b3;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #b42318;
}

a:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 3px;
  border-radius: 4px;
}

.site-header,
.page-shell {
  width: min(1060px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 24px 0 18px;
  text-align: center;
}

.site-header h1 {
  grid-column: 2;
  margin: 0;
  line-height: 1;
}

.site-title-image {
  width: 486px;
  filter: drop-shadow(0 5px 10px rgba(32, 78, 99, 0.13));
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding-bottom: 36px;
}

.sidebar,
.content-card,
.site-footer {
  border: 1px solid rgba(123, 151, 166, 0.35);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar {
  overflow: hidden;
}

.side-home {
  display: block;
  padding: 12px 14px;
  color: #0b5272;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  background: #d9f7fb;
}

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

.side-section h2 {
  margin: 0;
  padding: 7px 12px;
  color: #24323a;
  font-size: 0.84rem;
  text-align: center;
}

.side-section ul,
.utility-links {
  padding: 0;
  margin: 0;
  list-style: none;
}

.side-section a {
  display: block;
  padding: 5px 12px;
  font-size: 0.8rem;
  text-align: right;
  text-decoration: none;
}

.side-section a:hover {
  background: rgba(255, 255, 255, 0.65);
}

.side-main h2 {
  background: #9cf39c;
}

.side-main ul {
  background: #d7fbd7;
}

.side-new h2 {
  background: #fff096;
}

.side-new ul {
  background: #fffbd0;
}

.side-library h2 {
  background: #ffabab;
}

.side-library ul {
  background: #ffe0e0;
}

.utility-links {
  border-top: 1px solid var(--line);
  background: #fff78c;
}

.utility-links a {
  display: block;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  border-bottom: 1px solid rgba(204, 188, 55, 0.35);
}

.side-actions {
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: center;
}

.side-actions a {
  display: block;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 700;
  text-decoration: none;
  background: #d8f8f8;
}

.side-actions .amazon-link {
  color: #7a3b00;
  background: #fff0d6;
}

.qr-card {
  grid-column: 3;
  justify-self: end;
  width: 142px;
  padding: 9px 8px 8px;
  margin: 0;
  text-align: center;
  border: 1px solid rgba(123, 151, 166, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 22px rgba(47, 72, 88, 0.1);
}

.qr-card img {
  display: block;
  width: 104px;
  margin: 0 auto 5px;
  border: 4px solid #fff;
  border-radius: 6px;
}

.qr-card figcaption {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
}

.main-content {
  display: grid;
  gap: 18px;
}

.content-card {
  overflow: hidden;
}

.forum-grid,
.library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--panel-line);
  border-radius: 11px;
  background: #fff;
}

.panel h2 {
  margin: 0;
  padding: 10px 12px;
  color: var(--panel-heading);
  font-size: clamp(1.2rem, 2.7vw, 1.75rem);
  font-weight: 500;
  text-align: center;
  background: var(--panel-head-bg);
  border-bottom: 2px solid var(--panel-line);
}

.panel h2 small {
  display: block;
  margin-top: 2px;
  color: #cc3344;
  font-size: 0.7rem;
}

.new-forum {
  --panel-line: #e58ed8;
  --panel-heading: #d35f66;
  --panel-head-bg: #fffdf0;
}

.main-forum {
  --panel-line: #8588ee;
  --panel-heading: #287c78;
  --panel-head-bg: #ffe9ff;
}

.forum-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.forum-list li {
  padding: 9px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(113, 137, 151, 0.25);
}

.forum-list li:last-child {
  border-bottom: 0;
}

.forum-list a {
  font-weight: 700;
}

.forum-list p {
  margin: 4px 0 0;
  color: #a12887;
  font-size: 0.72rem;
  line-height: 1.45;
}

.new-forum .forum-list li:nth-child(odd) {
  background: #ebffff;
}

.new-forum .forum-list li:nth-child(even) {
  background: #f2fbff;
}

.new-forum .forum-list li:last-child {
  background: #fff0d5;
}

.main-forum .forum-list li {
  padding-block: 10px;
  background: #fffef1;
}

.library-card {
  padding: 18px;
  text-align: center;
  border: 1px solid #e4a64a;
  border-radius: 11px;
}

.library-card:first-child {
  background: #efff88;
}

.library-card:last-child {
  background: #ffec83;
}

.library-card h2 {
  margin: 0 0 12px;
  color: #d44b24;
  font-size: 1.12rem;
}

.library-card h2 small {
  color: #8e5233;
  font-size: 0.65rem;
}

.library-card p {
  margin: 7px 0;
}

.quick-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  margin: 0;
  list-style: none;
}

.quick-links a {
  display: grid;
  min-height: 50px;
  place-items: center;
  padding: 8px;
  font-size: 0.83rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  background: #fff437;
  border-right: 1px solid rgba(164, 148, 0, 0.35);
  border-bottom: 1px solid rgba(164, 148, 0, 0.35);
}

.quick-links li:nth-child(4n) a {
  border-right: 0;
}

.quick-links a:hover {
  background: #ffe75a;
}

.site-footer {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.mail-card {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  text-align: center;
}

.mail-card p {
  margin: 0;
  font-size: 0.8rem;
}

.mail-card img {
  width: 72px;
}

.notice h2 {
  margin: 0;
  padding: 8px 12px;
  font-size: 0.98rem;
  text-align: center;
  background: #d8f6f8;
  border-radius: 9px 9px 0 0;
}

.notice-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  background: #fffbd7;
  border-radius: 0 0 9px 9px;
}

.notice-body p {
  margin: 0;
  font-size: 0.85rem;
}

.privacy-link {
  white-space: nowrap;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 820px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .side-sections {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-section {
    padding-bottom: 0;
  }

  .side-section a {
    text-align: center;
  }

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

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

}

@media (max-width: 640px) {
  .site-header,
  .page-shell {
    width: min(100% - 20px, 1060px);
  }

  .site-header {
    grid-template-columns: 1fr;
    padding-top: 14px;
  }

  .site-header h1,
  .qr-card {
    grid-column: 1;
  }

  .qr-card {
    display: flex;
    width: auto;
    align-items: center;
    justify-self: center;
    gap: 10px;
    padding: 7px 12px;
    text-align: left;
  }

  .qr-card img {
    width: 82px;
    margin: 0;
  }

  .forum-grid,
  .library-grid,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .main-content {
    order: 1;
  }

  .sidebar {
    order: 2;
  }

  .side-sections {
    grid-template-columns: 1fr;
  }

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

  .quick-links li:nth-child(odd) a {
    border-right: 1px solid rgba(164, 148, 0, 0.35);
  }

  .quick-links li:nth-child(even) a {
    border-right: 0;
  }

  .notice-body {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
