@font-face {
  font-family: "ZenzaiItacha";
  src: url("../fonts/ZenzaiItacha-vElZ.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

:root {
  --bg-paper: #ffffff;
  --bg-cream: #fbfbf8;
  --ink: #0b1220;
  --accent: #e23b3b;
  --scrollbar-thumb: #e23b3b;
  --scrollbar-thumb-hover: #e55600;
  --muted: #58606a;
  --white: #ffffff;
  --radius: 12px;
  --paper-grain: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="6" height="6"><circle cx="1.5" cy="1.5" r="0.5" fill="%23f3f3f1"/></svg>');
}


html {
  scrollbar-width: thin;
  scrollbar-color: #e23b3b #ffffff;
}

html.invert,
html:has(body.invert),
body.invert {
  scrollbar-color: #e23b3b #000000;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #ffffff;
}

::-webkit-scrollbar-thumb {
  background-color: #e23b3b;
  border-radius: 9999px;
  border: 2px solid #ffffff;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #e55600;
}

::-webkit-scrollbar-thumb:active {
  background-color: #cc4d00;
}

::-webkit-scrollbar-corner {
  background: #ffffff;
}

html.invert::-webkit-scrollbar-track,
body.invert::-webkit-scrollbar-track,
html:has(body.invert)::-webkit-scrollbar-track,
body.invert *::-webkit-scrollbar-track {
  background: #000000;
}

html.invert::-webkit-scrollbar-thumb,
body.invert::-webkit-scrollbar-thumb,
html:has(body.invert)::-webkit-scrollbar-thumb,
body.invert *::-webkit-scrollbar-thumb {
  background-color: #ff6000;
  border: 2px solid #000000;
}

html.invert::-webkit-scrollbar-thumb:hover,
body.invert::-webkit-scrollbar-thumb:hover,
html:has(body.invert)::-webkit-scrollbar-thumb:hover,
body.invert *::-webkit-scrollbar-thumb:hover {
  background-color: #ff7722;
}

html.invert::-webkit-scrollbar-thumb:active,
body.invert::-webkit-scrollbar-thumb:active,
html:has(body.invert)::-webkit-scrollbar-thumb:active,
body.invert *::-webkit-scrollbar-thumb:active {
  background-color: #ff8c44;
}

html.invert::-webkit-scrollbar-corner,
body.invert::-webkit-scrollbar-corner,
html:has(body.invert)::-webkit-scrollbar-corner,
body.invert *::-webkit-scrollbar-corner {
  background: #000000;
}

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

html,
body {
  height: 100%;
  width: 100%;
}

@media (min-width: 721px) and (min-height: 650px) {
  html,
  body {
    overflow-x: hidden;
  }
}

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Noto Sans JP",
    sans-serif;
  background: linear-gradient(180deg, var(--bg-paper) 0%, var(--bg-cream) 100%);
  color: var(--ink);
  line-height: 1.5;
  position: relative;
  user-select: none;
}

html,
body,
* {
  cursor: none !important;
}

.cursor,
.cursor-dot {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  will-change: transform, width, height, opacity;
}

.cursor {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  mix-blend-mode: difference;
  transition:
    width 160ms cubic-bezier(0.2, 0.9, 0.2, 1),
    height 160ms cubic-bezier(0.2, 0.9, 0.2, 1),
    transform 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.cursor-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  mix-blend-mode: difference;
}

.cursor.hover {
  width: 30px;
  height: 30px;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 8% 12%, rgba(0, 0, 0, 0.015), transparent 6%),
    radial-gradient(circle at 88% 88%, rgba(0, 0, 0, 0.01), transparent 6%),
    var(--paper-grain);
  background-repeat: repeat;
  opacity: 0.9;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 0;
}

nav {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
  justify-content: space-between;
  padding: 0 36px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.9),
    rgba(250, 250, 248, 0.85)
  );
  border-bottom: 1px solid rgba(3, 7, 16, 0.05);
  backdrop-filter: blur(4px);
  position: relative;
  z-index: 100;
}

nav ul {
  display: flex;
  gap: 22px;
  list-style: none;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

nav .logo {
  font-family: "ZenzaiItacha", sans-serif;
  font-size: 30px;
  font-weight: 700;
  margin: 0;
  line-height: 1;
  letter-spacing: 0.4px;
}

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

.menu-toggle {
  display: none;
}

.theme-toggle {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  font-size: 18px;
  cursor: pointer;
}

.viewport {
  height: auto !important;
  min-height: calc(100vh - 120px);
  min-height: calc(100dvh - 120px);
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 32px 20px 48px;
  position: relative;
}

.legal-container {
  width: 100%;
  max-width: 840px;
  padding: 38px 36px;
  border-radius: 20px;
  background: radial-gradient(
    circle at 1px 1px,
    rgba(0, 0, 0, 0.05) 0.8px,
    transparent 0
  );
  background-size: 6px 6px;
  border: 1px solid rgba(3, 7, 16, 0.08);
  border-top: 4px solid var(--accent);
  background-color: rgba(255, 255, 255, 0.85);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 1;
  user-select: text;
}

.legal-header {
  margin-bottom: 28px;
  border-bottom: 1px solid rgba(226, 59, 59, 0.25);
  padding-bottom: 18px;
}

.legal-title {
  font-size: clamp(2rem, 3.5vw, 2.4rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.legal-title .title-accent,
.legal-title span {
  color: var(--accent);
  font-family: "Noto Sans JP", "Inter", sans-serif;
  padding: 4px 12px;
  border-radius: 10px;
  background-color: rgba(226, 59, 59, 0.12);
  background-image: radial-gradient(
    circle at 1px 1px,
    rgba(226, 59, 59, 0.35) 0.8px,
    transparent 0
  );
  background-size: 6px 6px;
  display: inline-block;
}

.legal-subtitle {
  font-size: 0.88rem;
  color: var(--muted);
  margin-top: 8px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.legal-content {
  display: flex;
  flex-direction: column;
  gap: 26px;
  color: var(--ink);
  line-height: 1.7;
  font-size: 0.95rem;
}

.legal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legal-section h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.2px;
}

.legal-section h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

.legal-section p {
  margin-bottom: 6px;
  color: var(--ink);
  opacity: 0.92;
  line-height: 1.68;
}

.legal-section strong {
  color: var(--ink);
  font-weight: 700;
}

.legal-section em {
  font-style: italic;
  color: var(--ink);
}

.legal-section ul {
  list-style: none;
  padding-left: 2px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 10px;
}

.legal-section li {
  position: relative;
  padding-left: 20px;
  color: var(--ink);
  opacity: 0.92;
  line-height: 1.6;
}

.legal-section li::before {
  content: "•";
  position: absolute;
  left: 2px;
  top: 0;
  color: var(--accent);
  font-weight: 800;
  font-size: 1.15em;
  line-height: 1.5;
}

.legal-section a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(226, 59, 59, 0.4);
  text-underline-offset: 3px;
  transition: opacity 0.15s ease, text-decoration-color 0.15s ease;
}

.legal-section a:hover {
  text-decoration-color: var(--accent);
  opacity: 0.85;
}

.legal-section code {
  background: rgba(226, 59, 59, 0.08);
  color: var(--accent);
  border: 1px solid rgba(226, 59, 59, 0.2);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 600;
}

html.page-404,
body.page-404,
html:has(body.page-404) {
  height: 100% !important;
  width: 100% !important;
  overflow: hidden !important;
  overflow-x: hidden !important;
  overflow-y: hidden !important;
  touch-action: none;
}

body.page-404 .app {
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
}

body.page-404 nav {
  flex-shrink: 0 !important;
  height: 60px !important;
}

body.page-404 footer {
  flex-shrink: 0 !important;
  height: 60px !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body.page-404 .viewport {
  flex: 1 1 auto !important;
  height: calc(100vh - 120px) !important;
  height: calc(100dvh - 120px) !important;
  min-height: 0 !important;
  max-height: calc(100vh - 120px) !important;
  max-height: calc(100dvh - 120px) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px 20px !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

body.page-404 .not-found {
  padding: 0 !important;
  margin: auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  max-width: 520px !important;
  width: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
}

body.page-404 .error-code {
  font-family: "ZenzaiItacha", sans-serif;
  font-size: clamp(3.8rem, 11vh, 6.5rem) !important;
  font-weight: 800;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 8px !important;
  letter-spacing: 2px;
}

body.page-404 .error-title {
  font-size: clamp(1.2rem, 3.2vh, 1.8rem) !important;
  font-weight: 800;
  margin-bottom: 6px !important;
  color: var(--ink);
}

body.page-404 .error-msg {
  font-size: clamp(0.9rem, 2vh, 1rem) !important;
  color: var(--muted);
  margin-bottom: 20px !important;
  line-height: 1.45;
}

body.page-404 .error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

body.page-404 .corner-art {
  max-height: 28vh !important;
  max-width: 32vw !important;
  right: -20px !important;
  bottom: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

.btn-primary {
  background: var(--ink);
  color: #ffffff;
  padding: 11px 22px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid var(--ink);
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
  padding: 11px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid rgba(3, 7, 16, 0.1);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: rgba(226, 59, 59, 0.1);
  border-color: rgba(226, 59, 59, 0.3);
  color: var(--accent);
  transform: translateY(-1px);
}

.corner-art {
  position: fixed;
  right: -40px;
  bottom: -20px;
  width: 400px;
  opacity: 0.9;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

footer {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.88rem;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 16px;
  margin-top: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.footer-link {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 2px;
  transition: color 0.15s ease;
}

.footer-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.footer-separator {
  color: var(--muted);
  opacity: 0.6;
  user-select: none;
}

body.invert {
  background: #000;
}

body.invert::before {
  display: none;
}

body.invert .app {
  filter: invert(1) hue-rotate(180deg);
}

body.invert .cursor,
body.invert .cursor-dot {
  mix-blend-mode: difference;
  background: #ffffff;
}

body.invert .cursor.hover {
  mix-blend-mode: normal;
  background: #ffffff;
}

body.invert nav a:hover ~ .cursor,
body.invert .cursor.hover {
  mix-blend-mode: exclusion;
}

@media (max-width: 720px), (max-height: 649px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  html.page-404,
  body.page-404 {
    height: 100% !important;
    min-height: 100% !important;
    overflow: hidden !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
  }

  body.page-404 .viewport {
    height: calc(100vh - 120px) !important;
    height: calc(100dvh - 120px) !important;
    min-height: 0 !important;
    max-height: calc(100vh - 120px) !important;
    max-height: calc(100dvh - 120px) !important;
    padding: 10px 16px !important;
    overflow: hidden !important;
  }

  .viewport {
    height: auto !important;
    min-height: calc(100vh - 140px);
    min-height: calc(100dvh - 140px);
    flex: 1 0 auto;
    padding: 24px 16px;
  }

  footer {
    margin-top: auto;
    flex-shrink: 0;
  }
}

@media (max-width: 720px) {
  html,
  body,
  * {
    cursor: auto !important;
  }

  .cursor,
  .cursor-dot {
    display: none !important;
  }

  nav {
    height: 60px;
    padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
    position: relative;
    z-index: 100;
  }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    cursor: pointer;
    padding: 0;
  }

  .hamburger-bar {
    display: block;
    width: 18px;
    height: 2px;
    background-color: var(--ink);
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle[aria-expanded="true"] .hamburger-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  nav ul {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    width: 100%;
    flex-direction: column;
    gap: 0;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid rgba(3, 7, 16, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    padding: 8px 24px 16px;
    z-index: 99;
  }

  nav.menu-open ul {
    display: flex;
  }

  nav ul li {
    width: 100%;
  }

  nav ul li a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 0;
    font-size: 1.05rem;
    color: var(--ink);
    border-bottom: 1px solid rgba(3, 7, 16, 0.05);
  }

  nav ul li:last-child a {
    border-bottom: none;
  }

  .legal-container {
    padding: 24px 18px;
    border-radius: 16px;
  }

  .legal-title {
    font-size: 1.8rem;
  }

  .corner-art {
    max-width: 36vw !important;
    max-height: 28vh !important;
    width: auto !important;
    right: 0 !important;
    bottom: max(65px, calc(60px + env(safe-area-inset-bottom))) !important;
    opacity: 0.9 !important;
    z-index: 0 !important;
    pointer-events: none !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  html,
  body,
  * {
    cursor: auto !important;
  }

  .cursor,
  .cursor-dot {
    display: none !important;
  }
}
