:root {
  --bg: #ffffff;
  --fg: #151515;
  --muted: #4e4e4e;
  --card: #ffffff;
  --line: #dddddd;
  --accent: #111111;
  --btn: #fafafa;
  --btnHover: #f0f0f0;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP",
    "Yu Gothic UI", "Yu Gothic", "Meiryo", sans-serif;
  padding-top: 0;
  overflow-x: hidden;
}

body.home-page {
  padding-top: var(--header-h);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.home-page {
  /* Keep header spacing stable on desktop; vh makes the sidebar/menu jump on tall screens. */
  --header-h: 80px;
  --sidebar-w: 18vw;
}

.home-page::before {
  content: "";
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: var(--sidebar-w);
  width: 1px;
  background: #8a8a8a;
  z-index: 12;
  pointer-events: none;
}

.home-page .header {
  left: 0;
}

.header .container {
  max-width: none;
  margin: 0;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.home-page .footer {
  margin-left: var(--sidebar-w);
}

.home-page main.container {
  max-width: none;
  margin: 0;
  padding: 0 20px;
}

.main-layout {
  display: block;
}

.main-content {
  min-width: 0;
  margin-left: calc(var(--sidebar-w) + 3vw);
  max-width: 1100px;
}

.side-menu {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 0;
  border-right: 0;
  border-left: 0;
  border-top: 0;
  border-bottom: 0;
  margin: 0;
  padding: 16px;
  overflow-y: auto;
}

.side-menu-scroll {
  min-height: 0;
}

.side-menu-title {
  font-weight: 800;
  margin-bottom: 2px;
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.side-menu-subtitle {
  font-weight: 700;
  margin: 0 0 2px;
  padding-left: 10px;
}

.side-menu a {
  display: block;
  color: var(--fg);
  text-decoration: none;
  border-left: 3px solid transparent;
  padding: 6px 8px;
  border-radius: 8px;
}

.side-menu a:hover {
  background: #f4f4f4;
  border-left-color: var(--accent);
}

.side-menu a.active {
  background: #ebebeb;
  border-left-color: var(--accent);
  font-weight: 700;
}

.side-menu-item {
  margin-left: 10px;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  backdrop-filter: blur(12px);
  background: #ffffff;
  border-bottom: 2px solid #d6d6d6;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  z-index: 10;
}

.header-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
}

.header-grow {
  flex: 1;
  min-width: 0;
}

.title {
  margin: 0;
  padding: 14px 0;
  font-size: 34px;
  letter-spacing: 0.2px;
  line-height: 1;
}

.title-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.title-link {
  color: inherit;
  text-decoration: none;
}

.site-logo {
  width: 1em;
  height: 1em;
  object-fit: contain;
  border-radius: 0.2em;
}

.title-sm {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-sm-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.site-logo-sm {
  width: 1em;
  height: 1em;
  object-fit: contain;
  border-radius: 0.2em;
}

.subtitle {
  margin: 0;
  padding: 0;
  color: #000000;
  font-size: 15px;
  line-height: 1;
}

.header .title,
.header .title-sm,
.header .muted {
  color: #151515;
}

.header .btn {
  border-color: #cfcfcf;
  background: #fafafa;
  color: #151515;
}

.header .btn:hover {
  background: #f0f0f0;
}

.card {
  margin: 18px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 16px;
}

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

@media (max-width: 760px) {
  :root {
    --mobile-drawer-w: min(82vw, 360px);
    --mobile-drawer-peek: clamp(8px, 1vw, 16px);
    --mobile-toggle-w: 44px;
  }

  .home-page {
    --header-h: 72px;
    --sidebar-w: 0px;
  }

  body.home-page {
    padding-top: var(--header-h);
  }

  .home-page::before {
    display: none;
  }

  .home-page .header {
    left: 0;
  }

  .header .container {
    padding: 8px 12px;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    position: relative;
  }

  .home-page .footer {
    margin-left: 0;
  }

  .home-page main.container {
    padding: 0 12px;
  }

  .main-layout {
    display: block;
  }

  .side-menu {
    position: fixed;
    top: 0;
    left: auto;
    right: 0;
    height: 100vh;
    width: var(--mobile-drawer-w);
    border: 1px solid var(--line);
    border-radius: 0;
    margin: 0;
    padding: 10px;
    max-height: none;
    background: var(--bg);
    z-index: 30;
    transform: translateX(calc(100% - var(--mobile-drawer-peek)));
    transition: transform 0.24s ease;
    box-shadow: -10px 0 26px rgba(0, 0, 0, 0.18);
    visibility: visible;
    pointer-events: auto;
    will-change: transform;
    overflow: visible;
    padding: 0;
  }

  .side-menu-scroll {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .side-menu a {
    padding: 8px 8px;
  }

  .btn.btn-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--mobile-toggle-w);
    height: 36px;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    position: absolute;
    top: -1px;
    left: calc(-1 * var(--mobile-toggle-w));
    right: auto;
    z-index: 31;
    border-radius: 0 !important;
    border: 1px solid var(--line);
    border-right: 0;
    background: var(--bg);
    color: var(--fg);
    box-shadow: none;
    margin: 0;
  }

  body.menu-open .btn-menu-toggle {
    left: calc(-1 * var(--mobile-toggle-w));
  }

  .title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .subtitle {
    flex: 0 0 100%;
    padding-top: 2px;
  }

  .menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    z-index: 20;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open .menu-backdrop {
    display: block;
  }

  body.menu-open .side-menu {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    max-width: none;
  }

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

  .title {
    font-size: 25px;
    padding: 0;
    line-height: 1.1;
  }

  .subtitle {
    font-size: 13px;
    line-height: 1.25;
  }

  .card {
    margin: 10px 0;
    padding: 12px;
  }

  .content {
    font-size: 15px;
    line-height: 1.65;
  }

  .viewer-links {
    flex-wrap: wrap;
  }
}

@media (max-width: 420px) {
  .home-page {
    --header-h: 68px;
  }

  .title {
    font-size: 22px;
  }

  .subtitle {
    font-size: 12px;
  }
}

.tile {
  display: block;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  background: #ffffff;
}

.tile:hover {
  border-color: var(--accent);
}

.tile-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.tile-meta {
  font-size: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.footer {
  border-top: 1px solid var(--line);
  padding: 6px 0;
  margin-top: 8px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.contact-card {
  max-width: 760px;
  width: 100%;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-actions {
  display: flex;
  justify-content: flex-start;
}

.turnstile-wrap {
  min-height: 66px;
}

.contact-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: #151515;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.btn:hover {
  background: var(--btnHover);
  border-color: #bbbbbb;
}

.btn-theme {
  padding: 4px 10px;
  font-size: 12px;
}

.menu-backdrop {
  display: none;
}

@media (min-width: 761px) {
  .btn-menu-toggle {
    display: none;
  }
}

.viewer {
  padding-bottom: 40px;
}

.viewer-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 10px;
}

.viewer-toolbar-right {
  display: flex;
  gap: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.required-mark {
  color: #c50000;
  font-weight: 700;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--fg);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
}

.status {
  font-size: 13px;
  padding: 6px 0 10px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.support-status {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
  color: #c50000;
}

.meta-line {
  font-size: 12px;
  padding: 2px 0 6px;
}

.viewer-links {
  display: flex;
  gap: 8px;
  padding: 2px 0 6px;
}

.content {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 14px;
}

.selected-custom {
  margin: 0;
}

.home-line-hero {
  display: block;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.35;
  color: var(--fg);
}

.home-line-title {
  display: block;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  color: var(--fg);
}

.home-line-title-logo {
  width: 1em;
  height: 1em;
  object-fit: contain;
  vertical-align: -0.12em;
  margin-right: 0.32em;
}

.home-line-strong {
  display: inline;
  font-weight: 800;
  line-height: inherit;
  color: var(--fg);
}

.home-top-ranking {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  white-space: pre-line;
}

.top-support-inline {
  margin: 0;
  padding: 0;
}

.top-support-inline,
.top-support-inline * {
  white-space: normal !important;
}

.top-support-inline p {
  margin: 0 0 6px;
  line-height: 1.55;
}

.top-support-inline .contact-form {
  margin-top: 0;
}

.top-support-inline p + p {
  margin-top: 2px;
  margin-bottom: 6px;
}

.support-cost-status {
  margin: 2px 0 10px;
  line-height: 1.55;
}

.support-balance-neg {
  color: #c01818;
  font-weight: 700;
}

.support-balance-pos {
  color: #0b4fb3;
  font-weight: 700;
}

.support-balance-zero {
  color: var(--fg);
  font-weight: 700;
}

.paypal-wrap {
  margin: 8px 0 14px;
  border-radius: 8px;
  padding: 8px;
}

body.dark .paypal-wrap,
body.dark .paypal-wrap a,
body.dark .paypal-wrap span,
body.dark .paypal-wrap p,
body.dark .paypal-wrap div,
body.dark .paypal-wrap label {
  color: #ffffff !important;
}

body.dark .paypal-wrap {
  background: #ffffff;
  color: #111111 !important;
}

.x-profile-wrap {
  margin: 8px 0 14px;
}

body.dark {
  --bg: #0f1115;
  --fg: #eef1f4;
  --muted: #a4adb7;
  --card: #151a20;
  --line: #2a313a;
  --accent: #e5e8ec;
  --btn: #1d242d;
  --btnHover: #2a333f;
}

body.dark .header {
  background: #11161c;
  border-bottom: 2px solid #2a313a;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

body.dark .header .title,
body.dark .header .title-sm,
body.dark .header .muted {
  color: #f3f5f7;
}

body.dark .subtitle {
  color: #cfd6de;
}

body.dark .header .btn {
  border-color: #3a4654;
  background: #1c2430;
  color: #f3f5f7;
}

body.dark .header .btn:hover {
  background: #2a3340;
}

body.dark .btn {
  border-color: #3a4654;
  color: #f3f5f7;
}

body.dark .side-menu a:hover {
  background: #242d37;
}

body.dark .side-menu a.active {
  background: #313c48;
}

body.dark .side-menu {
  border-right: 0;
}

@media (max-width: 760px) {
  body.dark .menu-backdrop {
    background: rgba(0, 0, 0, 0.48);
  }
}

body.dark.home-page::before {
  background: #4a5563;
}

body.dark .input {
  background: #11161d;
}

body.dark .selection-menu {
  background: #171d25;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

body.dark .content-line:hover {
  background: #232d38;
}

body.dark .content-line.active {
  background: #304052;
}

body.dark .hit {
  background: #304052;
}

.content-line {
  display: block;
  cursor: pointer;
}

.content-line:hover {
  background: #f5f5f5;
}

.content-line.active {
  background: #eaeaea;
}

.translator-note {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  margin: 0 0 2em;
  background: #ffffff;
  white-space: normal;
  line-height: 1.25;
}

.translator-note-title {
  display: block;
  font-weight: 800;
  margin: -6px -8px 6px;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--line) 35%, var(--bg) 65%);
  font-style: italic;
  line-height: 1.25;
}

.translator-note-body {
  display: block;
  line-height: 1.25;
}

body.dark .translator-note {
  background: #11161d;
}

.selection-menu {
  position: absolute;
  display: none;
  gap: 8px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  z-index: 30;
}


.mobile-scroll-nav {
  display: none;
}

@media (max-width: 760px) {
  .mobile-scroll-nav {
    position: fixed;
    right: 10px;
    bottom: 14px;
    z-index: 40;
    display: none;
    flex-direction: column;
    gap: 6px;
  }

  .mobile-scroll-btn {
    min-width: 56px;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 8px;
    opacity: 0.72;
    backdrop-filter: blur(2px);
  }
}

.menu-guide-overlay {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 60;
  pointer-events: none;
}

.menu-guide-bubble {
  position: fixed;
  z-index: 61;
  background: #ffffff;
  color: #111111;
  border: 1px solid #dddddd;
  border-radius: 6px;
  padding: 8px 6px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  pointer-events: none;
  writing-mode: vertical-rl;
  text-orientation: upright;
  line-height: 1.4;
}

.menu-guide-pulse {
  animation: menuGuidePulse 1.05s ease-in-out infinite;
  position: relative;
  z-index: 62 !important;
}

@keyframes menuGuidePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(230, 23, 23, 0.7);
  }
  70% {
    box-shadow: 0 0 0 13px rgba(230, 23, 23, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(230, 23, 23, 0);
  }
}

.hit {
  background: #eaeaea;
  border-radius: 4px;
  padding: 0 2px;
}
