@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@300;400&family=Noto+Sans+JP:wght@300;400&family=DotGothic16&display=swap');

/* ========================================
   RESET & BASE
======================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

* {
  font-family: 'DotGothic16', 'Courier New', Courier, monospace !important;
}

body {
  position: relative;
  background-color: #f8f8f8;
  color: #555;
  font-family: 'DotGothic16', 'Courier New', Courier, monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ========================================
   HEADER / GLOBAL NAV
======================================== */

header {
  padding: 1rem 2rem;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
}

.site-logo {
  display: none;
}

.global-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: flex-start;
  list-style: none;
}

.global-nav a {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #555;
  display: flex;
  align-items: center;
}

.nav-icon {
  display: inline-block;
  min-width: 2.5em;
  margin-right: 0.4em;
  white-space: nowrap;
}

/* ========================================
   SUBMENU
======================================== */

.sub-nav {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease, margin-top 0.6s ease;
  padding-left: 0.8rem;
  margin-top: 0;
  border-left: 1px solid #bbb;
  margin-left: 0.6rem;
}

.has-submenu.open .sub-nav {
  margin-top: 0.3rem;
}

.sub-nav li {
  position: relative;
}

.sub-nav li::before {
  content: '';
  position: absolute;
  left: -0.8rem;
  top: 50%;
  width: 0.5rem;
  height: 1px;
  background: #bbb;
}

.sub-nav a {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: #555;
  display: flex;
  align-items: center;
  padding: 0.2rem 0;
}

/* ========================================
   RESPONSIVE
======================================== */

/* ========================================
   MAIN CONTENT
======================================== */

main {
  flex: 1;
  padding: 1rem 2rem;
  display: flex;
  flex-direction: column;
}

/* ========================================
   EVENTS
======================================== */

.events {
  padding: 0;
}

.game {
  flex: 1;
  min-height: 300px;
  display: flex;
}

.game-field {
  position: relative;
  flex: 1;
  cursor: crosshair;
}

.game-ladder {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: auto;
  height: 64px;
  pointer-events: none;
}

/* ========================================
   B1F
======================================== */

body.b1f,
body.tsw-page {
  background: #c5e467;
}

body.tsw-page,
body.tsw-page * {
  font-family: 'DotGothic16', monospace !important;
}

.tsw-grass-field {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

body.tsw-page main,
body.tsw-page header,
body.tsw-page footer {
  position: relative;
  z-index: 1;
}

body.b1f.b2f {
  background: #000;
  margin: 0;
  overflow: hidden;
}

.b1f-field {
  position: relative;
  width: 100%;
  height: 100vh;
  cursor: crosshair;
}

.hoge-ladder-up {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 32px;
  height: 32px;
  pointer-events: none;
}

.msg-box {
  position: absolute;
  transform: translateX(-50%);
  width: max-content;
  max-width: 260px;
  white-space: pre-wrap;
  text-align: center;
  color: #fff;
  font-family: 'DotGothic16', monospace;
  font-size: 1rem;
  letter-spacing: 0.05em;
  line-height: 1.6;
  pointer-events: none;
  z-index: 100;
  display: none;
}

.event-list {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.8;
  color: #555;
}

.event-item {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  width: 100%;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.event-item:hover {
  opacity: 0.6;
}

.event-left-line {
  flex-shrink: 0;
  width: 0;
  border-top: 1px dashed #aaa;
  align-self: center;
}

.event-text {
  flex-shrink: 0;
  white-space: nowrap;
}

.event-right-line {
  flex: 1;
  border-top: 1px dashed #aaa;
  align-self: center;
}

.flyier-preview {
  position: fixed;
  width: 300px;
  height: auto;
  display: none;
  pointer-events: none;
  z-index: 1000;
  object-fit: contain;
}

/* ========================================
   WORKS
======================================== */

.works {
  padding: 2rem 0 1rem;
  position: relative;
}

.work-list {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.8;
  color: #555;
  position: relative;
}

.work-global-header {
  cursor: pointer;
  user-select: none;
  margin-bottom: 0.2rem;
}

.work-global-header:hover {
  opacity: 0.6;
}

.work-group {
  margin-bottom: 1rem;
}

.work-group-header {
  margin-bottom: 0.2rem;
  user-select: none;
}

.work-year {
  visibility: hidden;
}

.works.sorted .work-year {
  visibility: visible;
}

.work-group-items {
  overflow: visible;
}

.work-item {
  display: block;
  width: fit-content;
  white-space: nowrap;
}

/* ========================================
   MSW
======================================== */

.section-label {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #555;
  text-align: center;
  margin: 0 0 1.5rem;
}

.releases {
  padding: 0 0 2rem;
}

.release-list {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.8;
  color: #555;
}

.story {
  padding: 3rem 0 2rem;
}

/* STORY 全開閉ボタン */
.story-all-toggle {
  border: none;
  background: none;
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #555;
  cursor: pointer;
  padding: 0;
  margin-left: 0.5em;
}

.story-section-text {
  cursor: pointer;
}

/* ストーリーリスト（階段計算前は非表示） */
.story-list {
  visibility: hidden;
}

/* 話タイトル行 */
.story-toggle {
  display: flex;
  align-items: baseline;
  gap: 0.75em;
  width: 100%;
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.8;
  color: #555;
}

.story-toggle-name {
  color: #555;
  flex-shrink: 0;
}

.story-toggle-left-line {
  flex-shrink: 0;
  width: 0;
  border-top: 1px dashed #aaa;
  align-self: center;
}

.story-toggle-line {
  flex: 1;
  border-top: 1px dashed #aaa;
  align-self: center;
}

/* パネル開閉 */
.story-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}

.story-panel.open {
  grid-template-rows: 1fr;
}

.story-panel-inner {
  overflow: hidden;
}

.spoiler {
  background: #222;
  color: transparent;
  border-radius: 2px;
  padding: 0 2px;
  user-select: none;
  position: relative;
}
.spoiler.redact-4 {
  display: inline-block;
  width: 4em;
  height: 1em;
  vertical-align: middle;
}

.spoiler.spoiler-shake {
  animation: spoiler-shake 0.4s ease;
  background: #c0392b;
}

@keyframes spoiler-shake {
  0%, 100% { left: 0; }
  20%       { left: -7px; }
  40%       { left: 7px; }
  60%       { left: -4px; }
  80%       { left: 3px; }
}

.spoiler.spoiler-fade {
  background: #222;
  transition: background 1.8s ease 0.4s;
}

.story-synopsis {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  line-height: 2;
  color: #555;
  text-align: center;
  padding: 1.5rem 0 2rem;
  max-width: 80%;
  margin: 0 auto;
}

.characters {
  padding: 3rem 0;
}

/* アコーディオン行 */
.char-toggle {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  width: 100%;
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.8;
  color: #555;
}

.char-section-text {
  cursor: pointer;
}

.char-toggle-name {
  color: #555;
  flex-shrink: 0;
}

/* CHARACTER 全開閉ボタン */
.char-all-toggle {
  border: none;
  background: none;
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #555;
  cursor: pointer;
  padding: 0;
  margin-left: 0.5em;
}

.char-toggle-left-line {
  flex-shrink: 0;
  width: 0;
  border-top: 1px dashed #aaa;
  align-self: center;
}

.char-toggle-line {
  flex: 1;
  border-top: 1px dashed #aaa;
  align-self: center;
}

/* パネル（grid trick でスムーズに開閉） */
.char-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}

.char-panel.open {
  grid-template-rows: 1fr;
}

.char-panel-inner {
  overflow: hidden;
}

.char-content {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
  padding: 2rem 0;
  max-width: 80%;
  margin: 0 auto;
}

.char-img {
  width: 40%;
  height: auto;
  display: block;
}

.char-info {
  flex: 1;
  min-width: 0;
}

.char-desc {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  line-height: 2;
  color: #555;
}

/* ========================================
   CONTACT
======================================== */

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-7px); }
  40%       { transform: translateX(7px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(3px); }
}

@keyframes redFadeBorder {
  from { border-bottom-color: #c0392b; }
  to   { border-bottom-color: #555; }
}
@keyframes redFadeColor {
  from { color: #c0392b; }
  to   { color: #555; }
}
@keyframes redFadeButton {
  from { color: #c0392b; }
  to   { color: #555; }
}

.field-error-border {
  animation: redFadeBorder 1.8s ease 0.4s backwards;
}
.field-error-color {
  animation: redFadeColor 1.8s ease 0.4s backwards;
}
.field-error-button {
  animation: redFadeButton 1.8s ease 0.4s backwards;
}

#contactContent.fading-out {
  opacity: 0;
  transition: opacity 1s ease;
}

.contact-thanks {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #555;
}

.contact {
  padding: 0;
  max-width: 560px;
  width: 100%;
  margin: 5rem auto 0;
}

.contact-field.shaking {
  animation: shake 0.4s ease;
}

.contact-note {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: #555;
  margin-bottom: 1.6rem;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.contact-field label {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #555;
}

.contact-field input,
.contact-field textarea {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  color: #555;
  background: transparent;
  border: none;
  border-bottom: 1px solid #555;
  outline: none;
  padding: 0.4rem 0;
  resize: none;
}

.contact-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.contact-status {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.7rem;
  color: #999;
  letter-spacing: 0.05em;
}

.contact-submit {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #555;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.form-icon {
  display: inline-block;
  min-width: 2.5em;
  margin-right: 0.4em;
  white-space: nowrap;
}

.contact-submit:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ========================================
   TSW
======================================== */

.tsw-characters {
  padding: 3rem 0;
  text-align: center;
}

.tsw-char-list {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem 4rem;
}

.tsw-char-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.tsw-char-img {
  width: 80px;
  height: auto;
  image-rendering: pixelated;
}

.tsw-char-name {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 2;
  color: #555;
}

.tsw-char-desc {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 2;
  color: #555;
  text-align: center;
}

.tsw-story {
  padding: 3rem 0 2rem;
  text-align: center;
}

.tsw-story-text {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.8rem;
  line-height: 2;
  color: #555;
}

.screenshots {
  padding: 3rem 0;
}

.screenshot-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  max-width: 800px;
  margin: 0 auto;
}

.screenshot-img {
  width: 100%;
  height: auto;
  display: block;
  cursor: default;
  -webkit-touch-callout: none;
  user-select: none;
}

.screenshot-preview {
  position: fixed;
  width: 480px;
  height: auto;
  display: none;
  pointer-events: none;
  z-index: 1000;
  object-fit: contain;
  image-rendering: pixelated;
}

/* ========================================
   GOODS
======================================== */

.goods-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3rem;
  padding: 3rem 0;
}

.goods-item {
  display: block;
  max-width: 600px;
  width: 100%;
  transition: opacity 0.2s;
}

.goods-item:hover {
  opacity: 0.8;
}

.goods-img {
  width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   FOOTER
======================================== */

footer {
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copyright {
  font-family: 'Roboto Mono', 'Noto Sans JP', monospace;
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: #555;
}

/* ========================================
   RESPONSIVE
======================================== */

@media (max-width: 600px) {
  header {
    padding: 1rem 1.2rem;
  }

  main {
    padding-left: 0;
    padding-right: 0;
  }

  .events,
  .releases,
  .contact,
  .game,
  .char-toggle,
  .char-info,
  .story-toggle,
  .story-synopsis,
  .section-label {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
  }

  .char-content {
    flex-direction: column;
    max-width: 100%;
    margin: 0;
    padding: 1rem 0;
    gap: 1rem;
  }

  .char-img {
    width: 75%;
    margin: 0 auto;
  }

  .screenshot-list {
    max-width: 100%;
  }

  .tsw-char-list {
    grid-template-columns: repeat(2, 1fr);
  }



}
