/* =========================================
   Base Layout
========================================= */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

html {
  scroll-padding-top: 80px;
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  font-family: Arial, sans-serif;
  padding-top: 70px;
  padding-bottom: 70px;
}

/* =========================================
   Main Layout
========================================= */
.main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* =========================================
   Sidebar
========================================= */
nav#menu {
  width: 200px;
  background: #333;
  color: white;
  padding: 1em;
  flex-shrink: 0;
  min-height: calc(100vh - 140px);
}

nav#menu a {
  display: block;
  background: #555;
  padding: 10px;
  margin: 5px 0;
  border-radius: 4px;
  text-decoration: none;
  color: white;
  text-align: center;
}

nav#menu a:hover {
  background: #777;
}

nav#menu a.retro-link {
  background: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  color: blue;
  text-align: left;
  text-decoration: underline;
  display: inline;
}

nav#menu a.retro-link:hover {
  background: none;
  color: purple;
  text-decoration: underline;
}

.close-btn {
  display: none;
  width: 100%;
  background: #444;
  color: white;
  border: none;
  padding: 12px;
  margin-bottom: 10px;
  text-align: center;
  font-size: 16px;
  cursor: pointer;
}

.close-btn:hover {
  background: #666;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 900;
}

.overlay.active {
  display: block;
}

/* =========================================
   Content Area
========================================= */
.content {
  flex: 1;
  overflow-y: auto;
  background: #f9f9f9;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.content::-webkit-scrollbar {
  display: none;
}

/* =========================================
   Banner Image
========================================= */
.banner img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 300px;
  object-fit: cover;
  max-width: 100%;
}

@media (max-width: 768px) {
  .banner img {
    max-height: 150px;
  }
}

/* =========================================
   Contents
========================================= */
.contents {
  padding: 2em;
  padding-bottom: 140px;
}

.contents p {
  white-space: pre-wrap;
}

.text-block {
  white-space: pre-wrap;
}

section {
  margin-bottom: 2em;
  padding: 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  display: none;
}

section.active {
  display: block;
}

/* =========================================
   新着情報
========================================= */

.post_tag {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 6px;

  font-size: 10.5px;
  font-weight: bold;
  letter-spacing: 0.04em;

  color: #fff;
  border-radius: 999px;
  cursor: default;

  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
}

.post_tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.25);
  opacity: 0.9;
}

.post_tag.new {
  background: #2da44e;
}

.post_tag.talk {
  background: #0969da;
}

.post_tag.paper {
  background: #8250df;
}

.post_tag.info {
  background: #e5533d;
}

.postedfeed {
  max-height: 110px;
  overflow-y: auto;
  padding-right: 6px;
}

.postedfeed::-webkit-scrollbar {
  display: none;
}

.postedfeed {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.posts li {
  line-height: 1.4;
}

/* =========================================
   Images
========================================= */
section img,
.contents img {
  max-width: 100%;
  height: auto;
  display: block;
}

.img-block {
  margin-bottom: 0.4em;
}

.img-block img {
  margin-bottom: 0;
}

.img-caption {
  margin-top: 2px;
  margin-bottom: 0.6em;
  line-height: 1.2;
}

/* =========================================
   Divider
========================================= */
hr.divider {
  border: none;
  border-top: 1px solid #bbb;
  margin: 1.5em 0;
}

/* =========================================
   Slash Table
========================================= */
.slash-table {
  margin-top: 1em;
  border: 1px solid #bbb;
  font-size: 14px;
}

.slash-row {
  display: grid;
  grid-template-columns: 90px 140px 60px 1.5fr 2fr;
  border-bottom: 1px solid #ddd;
}

.slash-row > div {
  padding: 8px 10px;
  border-right: 1px solid #ddd;
}

.slash-row > div:last-child {
  border-right: none;
}

.slash-row.header {
  background: #f0f0f0;
  font-weight: bold;
  border-bottom: 2px solid #999;
}

.slash-row:last-child {
  border-bottom: none;
}

.note {
  margin-top: 1em;
  font-size: 13px;
  color: #333;
}

/* =========================================
   Console Styles
========================================= */
#section5 a,
#section5 a:visited {
  color: #333;
  text-decoration: underline;
}

#section5 a:hover,
#section5 a:active {
  color: #2f5d50;
}

#mnemo-console {
  padding: 16px;
  max-width: 800px;
  margin: 20px auto;
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#console-output {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  overflow-y: auto;
  height: 240px;
  color: #333;
  background: #f9f9f9;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

#console-output::-webkit-scrollbar {
  display: none;
}

/* =========================================
   Input Area
========================================= */
#input-area {
  text-align: center;
  margin-top: 20px;
}

#mnemo-id {
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #666;
  background: #fff;
  color: #222;
  font-size: 14px;
  outline: none;
}

#mnemo-id:focus {
  border-color: #999;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

#input-area button {
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #555;
  background: #555;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}

#input-area button:hover {
  background: #777;
  border-color: #777;
}

/* =========================================
   Toggle Block
========================================= */

.toggle-block {
  margin: 1em 0;
  border: 1px solid #bbb;
  border-radius: 4px;
}

.toggle-header {
  padding: 0.6em 0.8em;
  background: #eee;
  cursor: pointer;
  font-weight: bold;
  user-select: none;
}

.toggle-header:hover {
  background: #ddd;
}

.toggle-content {
  display: none;
  padding: 0.8em;
  border-top: 1px solid #ccc;
  white-space: pre-wrap;
}

/* 開いている状態 */
.toggle-block.open .toggle-content {
  display: block;
}

.toggle-block.open .toggle-header {
  background: #ddd;
}

/* =========================================
   Responsive（スマホレイアウト）
========================================= */
@media (max-width: 768px) {

  .main {
    flex-direction: column;
  }

  nav#menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: 70%;
    max-width: 300px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  nav#menu.active {
    display: block;
    transform: translateX(0);
  }

  .hamburger {
    display: flex;
  }

  .close-btn {
    display: block;
  }

  section img,
  .contents img {
    padding-left: 0.5em;
    padding-right: 0.5em;
    box-sizing: border-box;
  }

  .slash-row {
    grid-template-columns: 1fr;
  }

  .slash-row.header {
    display: none;
  }

  .slash-row > div {
    border-right: none;
    border-bottom: 1px dashed #ccc;
  }

  .hidden-string {
    color: transparent;
    text-shadow: 0 0 0 transparent;
    background: transparent;
    user-select: text;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    display: inline;
  }
}
