/* =========================================
   index.css
========================================= */
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-bottom: 70px;
}

.main {
  flex: 1;
  display: flex;
  overflow: hidden;
  margin-top: 70px;
  height: calc(100vh - 140px);
}

nav#menu {
  width: 200px;
  background: #333;
  color: white;
  padding: 1em;
  flex-shrink: 0;
  min-height: 100%;
}

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 {
  flex: 1;
  overflow-y: auto;
  height: 100%;
  background: #f9f9f9;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.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 {
  padding: 2em;
  padding-bottom: 140px;
}

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

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

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;
}

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

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

.img-block img {
  display: block;
  margin: 0;
  margin-bottom: 0;
  vertical-align: bottom;
}

.img-caption {
  margin-top: 0;
  margin-bottom: 0.2em;
  line-height: 1.1;
}

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

.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;
}

#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 {
  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 {
  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: normal;
  text-align: left;
}

.toggle-block.open .toggle-content {
  display: block;
}

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

@media (max-width: 768px) {

  #mnemo-id {
    font-size: 16px;
  }

  .main {
    flex-direction: column;
    margin-top: 70px;
    height: calc(100vh - 140px);
  }

  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;
  }

}

.glitch-text {
  position: relative;
  display: inline-block;
  color: #111;
  animation: glitch-flicker 8s infinite;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.glitch-text::before {
  color: rgba(190, 20, 35, 0.65);
  transform: translateX(-1px);
}

.glitch-text::after {
  color: rgba(0, 120, 150, 0.65);
  transform: translateX(1px);
}

@keyframes glitch-flicker {
  0%,
  88%,
  90%,
  92%,
  94%,
  100% {
    transform: none;
    filter: none;
    text-shadow: none;
  }

  88.2% {
    transform: translate(-1px, 0);
    text-shadow:
      -2px 0 rgba(190, 20, 35, 0.75),
      2px 0 rgba(0, 120, 150, 0.75);
  }

  88.4% {
    transform: translate(2px, -1px);
    filter: blur(0.35px);
  }

  88.6% {
    transform: translate(-2px, 1px);
  }

  88.8% {
    transform: none;
    filter: none;
  }

  91.2% {
    text-shadow:
      1px 0 rgba(190, 20, 35, 0.6),
      -1px 0 rgba(0, 120, 150, 0.6);
  }

  91.4% {
    transform: translateY(1px);
    filter: blur(0.25px);
  }

  91.6% {
    transform: none;
    filter: none;
    text-shadow: none;
  }

  93.2% {
    opacity: 0.82;
    letter-spacing: 0.03em;
  }

  93.4% {
    opacity: 1;
    letter-spacing: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .glitch-text {
    animation: none;
  }
}

/* =========================================
   基点周波数：文字化け変換演出
========================================= */

.hidden-string.frequency-glitch {
  position: relative;
  display: inline-block;
  max-width: 100%;
  color: #333;
  font-family: Consolas, "Courier New", monospace;
  letter-spacing: 0.04em;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: text;
}

.frequency-glitch.is-glitching {
  animation: frequency-shake 90ms steps(2, end) infinite;
  text-shadow:
    2px 0 rgba(255, 0, 0, 0.75),
    -2px 0 rgba(0, 180, 255, 0.75);
  filter: contrast(1.4);
}

.frequency-glitch.is-glitching::before,
.frequency-glitch.is-glitching::after {
  content: attr(data-current);
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.frequency-glitch.is-glitching::before {
  color: rgba(190, 20, 35, 0.75);
  transform: translate(2px, -1px);
  clip-path: inset(8% 0 58% 0);
  opacity: 0.75;
}

.frequency-glitch.is-glitching::after {
  color: rgba(0, 120, 150, 0.75);
  transform: translate(-2px, 1px);
  clip-path: inset(58% 0 12% 0);
  opacity: 0.65;
}

@keyframes frequency-shake {
  0% {
    transform: translate(0, 0) skewX(0deg);
  }

  25% {
    transform: translate(-1px, 1px) skewX(2deg);
  }

  50% {
    transform: translate(2px, 0) skewX(-3deg);
  }

  75% {
    transform: translate(-2px, -1px) skewX(1deg);
  }

  100% {
    transform: translate(0, 0) skewX(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .frequency-glitch.is-glitching {
    animation: none;
  }
}
