/* ============================================================
   吐槽星図 — Global Styles
   ============================================================ */

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Background */
  --bg-deep:   #0a0e1a;
  --bg-mid:    #0f1628;

  /* Accent palette */
  --accent-pink:   #f6d9e1;
  --accent-blue:   #dceef8;
  --accent-yellow: #fcdda3;
  --accent-cream:  #fbf2d2;
  --accent-gray:   #f1f1f2;

  /* Text */
  --text-primary: rgba(241, 241, 242, 0.92);
  --text-muted:   rgba(241, 241, 242, 0.45);

  /* Frosted glass */
  --glass-bg:     rgba(15, 22, 40, 0.58);
  --glass-border: rgba(246, 217, 225, 0.18);
  --glass-blur:   14px;

  /* Typography */
  --font-base: 'Noto Sans JP', sans-serif;

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-pill: 999px;

  /* Z-index stack */
  --z-canvas:  0;
  --z-svg:     10;
  --z-tooltip: 50;
  --z-header:  100;
  --z-search:  150;
  --z-modal:   200;
  --z-warp:    300;
}

html, body {
  width: 100%;
  height: auto;
  overflow-y: auto;
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-base);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

/* --- Hero text --------------------------------------------- */
#hero-text {
  position: fixed;
  top: 116px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 15;
  pointer-events: none;
  white-space: nowrap;
}

.hero-line {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  line-height: 2;
}

/* --- Post CTA: floating bottom-right ----------------------- */

/* --- Site footer ------------------------------------------- */
#site-footer {
  position: relative;
  z-index: 50;
  padding: 80px 0 44px;
  background: rgba(10, 14, 26, 0.97);
}


.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 70vw;
  margin: 24px auto 0;
  text-align: center;
  padding-bottom: 8px;
}

.footer-line {
  font-size: 0.72rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.38);
  letter-spacing: 0.08em;
  line-height: 1.6;
  margin: 0;
}

.footer-poka-link {
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(241, 241, 242, 0.32);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  transition: color 0.25s ease;
}

.footer-poka-link:hover {
  color: rgba(241, 241, 242, 0.70);
}

/* Tooltip: "↗ POKAとは？" */
.footer-poka-link::after {
  content: '↗ POKAとは？';
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 22, 40, 0.92);
  border: 1px solid rgba(241, 241, 242, 0.15);
  border-radius: var(--radius-pill);
  color: rgba(241, 241, 242, 0.80);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.10em;
  padding: 4px 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.footer-poka-link:hover::after {
  opacity: 1;
}

/* Bottom bar */
.footer-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 36px;
  max-width: 900px;
  margin: 0 auto;
  padding-top: 24px;
  position: relative;
}

.footer-bottom::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(241, 241, 242, 0.07) 20%,
    rgba(241, 241, 242, 0.07) 80%,
    transparent 100%
  );
}

.footer-legal-btn {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-base);
  font-size: 0.8rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.35);
  letter-spacing: 0.1em;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(241, 241, 242, 0.15);
  text-underline-offset: 4px;
  transition: color 0.25s ease, text-decoration-color 0.25s ease;
}

.footer-legal-btn:hover {
  color: rgba(241, 241, 242, 0.65);
  text-decoration-color: rgba(241, 241, 242, 0.35);
}

/* --- Sidebar: constellation navigation -------------------- */
#constellation-sidebar {
  position: fixed;
  left: 16px;
  top: 90px;
  width: 160px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-lg);
  padding: 14px 8px;
  z-index: 30;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.3);
}

.sidebar-title {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0 12px 10px;
  border-bottom: 1px solid rgba(246, 217, 225, 0.08);
  margin-bottom: 6px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  text-align: left;
  width: 100%;
  letter-spacing: 0.04em;
}

.sidebar-item:hover {
  background: rgba(246, 217, 225, 0.08);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(246, 217, 225, 0.12);
  color: var(--accent-pink);
}

.sidebar-icon {
  font-size: 0.7rem;
  width: 14px;
  flex-shrink: 0;
  text-align: center;
  opacity: 0.8;
}

/* --- SVG fade transition for constellation zoom ------------ */
#constellation-svg {
  transition: opacity 0.3s ease-in-out;
}

#constellation-svg.fading {
  opacity: 0 !important;
}

/* --- Canvas: deep space background ------------------------- */
#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  width: 100vw;
  height: 100vh;
  display: block;
}

/* --- SVG: constellation overlay ---------------------------- */
#constellation-svg {
  position: fixed;
  left: 176px;
  top: 72px;
  width: calc(100vw - 176px);
  height: calc(100vh - 72px);
  z-index: var(--z-svg);
  overflow: visible;
  pointer-events: none;
}

/* --- Tooltip ----------------------------------------------- */
#star-tooltip {
  position: fixed;
  z-index: var(--z-tooltip);
  pointer-events: none;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.72rem;
  font-family: var(--font-base);
  font-weight: 400;
  color: var(--text-primary);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  letter-spacing: 0.02em;
}

#star-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Header ------------------------------------------------ */
#main-header {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, 90vw);
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  padding: 13px 36px;
  border-radius: var(--radius-pill);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.04);
}

.header-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-pink);
  text-shadow: 0 0 18px rgba(246, 217, 225, 0.5);
  white-space: nowrap;
  flex-shrink: 0;
}

.header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 52px;
  flex: 1;
}

.nav-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  transition: color 0.2s ease, text-shadow 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--accent-pink);
  text-shadow: 0 0 14px rgba(246, 217, 225, 0.6);
}

/* nav 内の <button> をリンク見た目に正規化 */
.nav-link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-base);
}

/* 主推目的地 — 永久的な薄い下線 */
.nav-link-primary {
  color: var(--accent-pink);
  text-decoration: underline;
  text-decoration-color: rgba(246, 217, 225, 0.45);
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.nav-link-primary:hover {
  text-decoration-color: rgba(246, 217, 225, 0.85);
  text-shadow: 0 0 14px rgba(246, 217, 225, 0.45);
}

/* --- Modal ------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 24, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-card {
  position: relative;
  z-index: 1;
  background: rgba(12, 18, 34, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 36px 36px 28px;
  max-width: 460px;
  width: 90vw;
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.65);
  animation: modal-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.9) translateY(16px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* --- Post modal: posts-style inner layout ------------------- */
.modal-star-key {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.star-key-label {
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  opacity: 0.6;
}

.star-key-value {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--accent-yellow, #fcdda3);
}

.modal-cat-chip {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 14px;
}

.modal-username {
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
  margin-bottom: 10px;
  letter-spacing: 0.03em;
}

.modal-post-title {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.6;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
}

.modal-post-text {
  font-size: 0.9rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.82);
  line-height: 1.85;
  letter-spacing: 0.03em;
  display: -webkit-box;
  -webkit-line-clamp: 10;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 24px;
}

.modal-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid rgba(241, 241, 242, 0.07);
}

.modal-views {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.65;
  flex: 1;
}

.modal-views svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.pm-btn-resonate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(241, 241, 242, 0.15);
  background: rgba(241, 241, 242, 0.05);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.pm-btn-resonate:hover {
  background: rgba(241, 241, 242, 0.12);
}

.pm-btn-resonate.active {
  background: rgba(220, 238, 248, 0.18);
  border-color: rgba(220, 238, 248, 0.45);
  color: #dceef8;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-category {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 16px;
  opacity: 0.75;
}

.modal-text {
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text-primary);
  word-break: break-all;
}

.modal-meta {
  margin-top: 16px;
}

.modal-timestamp {
  font-size: 0.68rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn-resonate {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-family: var(--font-base);
  font-size: 0.78rem;
  font-weight: 400;
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.04em;
}

.btn-resonate:hover {
  background: rgba(252, 221, 163, 0.1);
  border-color: rgba(252, 221, 163, 0.35);
  color: var(--accent-yellow);
}

.btn-resonate.active {
  background: rgba(252, 221, 163, 0.12);
  border-color: rgba(252, 221, 163, 0.5);
  color: var(--accent-yellow);
}

.btn-icon {
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-resonate.pulse .btn-icon {
  animation: icon-pulse 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes icon-pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.modal-detail-link {
  margin-left: auto;
  color: var(--accent-cream);
  font-size: 0.72rem;
  text-decoration: none;
  opacity: 0.7;
  letter-spacing: 0.04em;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.modal-detail-link:hover {
  opacity: 1;
}

/* --- Search widget ----------------------------------------- */
#search-widget {
  position: fixed;
  bottom: 36px;
  right: 36px;
  z-index: var(--z-search);
}

.search-inner {
  display: flex;
  align-items: center;
  flex-direction: row-reverse;
  gap: 0;
}

#search-trigger {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  transition: box-shadow 0.3s ease, color 0.3s ease;
  flex-shrink: 0;
}

#search-trigger svg {
  width: 18px;
  height: 18px;
}

#search-trigger:hover {
  box-shadow: 0 0 22px rgba(220, 238, 248, 0.3);
  color: var(--accent-pink);
}

#search-input {
  width: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-primary);
  font-family: var(--font-base);
  font-size: 0.82rem;
  font-weight: 300;
  letter-spacing: 0.04em;
  outline: none;
  transition: width 0.38s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.28s ease,
              padding 0.28s ease,
              border-color 0.28s ease,
              margin-right 0.28s ease;
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-widget.expanded #search-input {
  width: 230px;
  opacity: 1;
  padding: 12px 20px;
  border-color: var(--glass-border);
  margin-right: 10px;
}

/* --- Warp overlay ------------------------------------------ */
#warp-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-warp);
  pointer-events: none;
  opacity: 0;
  background: transparent;
}

/* warp animation is JS-driven — no CSS keyframes needed */

.search-notfound {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 2px solid var(--accent-pink);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 7px 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 10;
}

.search-notfound.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Drifting Thoughts section ----------------------------- */
#drifting-thoughts {
  position: relative;
  z-index: 50;
  margin-top: 100vh;
  padding: 0 48px 80px 196px;
  background: linear-gradient(to bottom,
    transparent 0,
    rgba(10, 14, 26, 0.92) 70px,
    rgba(10, 14, 26, 0.97) 140px
  );
  min-height: 400px;
}

.drifting-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 56px;
  margin-bottom: 28px;
}

.drifting-title {
  font-size: 1.3rem;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

.drifting-see-all {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.drifting-see-all:hover {
  color: var(--accent-pink);
}

.drifting-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.drifting-grid::-webkit-scrollbar {
  display: none;
}

.thought-card {
  display: flex;
  flex-direction: column;
  flex: 0 0 280px;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  padding: 24px 24px 20px;
  cursor: pointer;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
  min-height: 200px;
}

.thought-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(224, 195, 139, 0.15);
}

.thought-category {
  display: inline-block;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  margin-bottom: 12px;
  align-self: flex-start;
}

.thought-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.55;
  letter-spacing: 0.03em;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.thought-text {
  font-size: 0.82rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.72);
  line-height: 1.75;
  letter-spacing: 0.02em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  margin-bottom: 20px;
}

.thought-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}

.thought-username {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thought-star-key {
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  color: rgba(252, 221, 163, 0.6);
  flex-shrink: 0;
  white-space: nowrap;
}

.thought-stats {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.thought-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.thought-stat-icon {
  font-size: 0.68rem;
  opacity: 0.7;
}

.thought-detail-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(246, 217, 225, 0.08);
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1;
}

.thought-detail-btn:hover {
  background: rgba(246, 217, 225, 0.18);
  color: var(--accent-pink);
}

/* ============================================================
   Mobile — Vertical Galaxy Journey
   ============================================================ */
@media (max-width: 599px) {
  html, body {
    overflow-y: auto;
    height: auto;
  }

  #stars-canvas {
    position: fixed;
    height: 100vh;
  }

  #constellation-svg {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
  }

  #constellation-sidebar {
    position: sticky;
    top: 58px;
    left: 0;
    width: 100%;
    border-radius: 0;
    padding: 8px 12px;
    z-index: 110;
    border-left: none;
    border-right: none;
    border-top: none;
    margin-top: calc(100vh - 58px);
  }

  .sidebar-title {
    display: none;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-item {
    white-space: nowrap;
    padding: 6px 14px;
    flex-shrink: 0;
  }

  .sidebar-icon {
    display: none;
  }

  #main-header {
    top: 12px;
    width: 96vw;
    padding: 9px 14px;
    gap: 8px;
  }

  .header-logo {
    font-size: 0.78rem;
    letter-spacing: 0.04em;
  }

  .header-nav {
    gap: 8px;
  }

  .nav-link {
    font-size: 0.6rem;
    letter-spacing: 0.02em;
  }

  #hero-text {
    position: absolute;
  }

  #search-widget {
    bottom: 24px;
    right: 20px;
  }

  #search-widget.expanded #search-input {
    width: 180px;
  }

  #drifting-thoughts {
    margin-top: 0;
    padding: 20px 16px 60px;
    background: rgba(10, 14, 26, 0.97);
  }

  .drifting-grid {
    gap: 12px;
  }

  .thought-card {
    flex: 0 0 240px;
  }

  .drifting-header {
    padding-top: 24px;
  }
}

/* ============================================================
   Welcome Modals
   ============================================================ */
.welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* hidden 属性が display:flex に上書きされないよう明示的に非表示 */
.welcome-modal[hidden] {
  display: none;
}

.welcome-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.welcome-card {
  position: relative;
  z-index: 1;
  width: min(560px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  background: rgba(10, 16, 32, 0.82);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}

/* --- Close button (link-triggered only) --- */
.welcome-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s ease;
  padding: 6px;
  line-height: 1;
  z-index: 2;
}
.welcome-close:hover { opacity: 1; }

/* --- Scrollable body --- */
.welcome-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 40px 44px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(246, 217, 225, 0.18) transparent;
}
.welcome-scroll::-webkit-scrollbar { width: 4px; }
.welcome-scroll::-webkit-scrollbar-thumb {
  background: rgba(246, 217, 225, 0.18);
  border-radius: 4px;
}

/* --- Footer with confirm button --- */
.welcome-footer {
  padding: 18px 44px 32px;
  text-align: center;
  flex-shrink: 0;
}

.welcome-confirm-btn {
  padding: 11px 38px;
  border-radius: var(--radius-pill);
  background: rgba(246, 217, 225, 0.08);
  border: 1px solid rgba(246, 217, 225, 0.28);
  color: var(--accent-pink);
  font-family: var(--font-base);
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.welcome-confirm-btn:hover {
  background: rgba(246, 217, 225, 0.16);
  border-color: rgba(246, 217, 225, 0.48);
  box-shadow: 0 0 26px rgba(246, 217, 225, 0.12);
}

/* --- Modal typography --- */
.wm-eyebrow {
  font-size: 0.58rem;
  letter-spacing: 0.26em;
  color: var(--text-muted);
  opacity: 0.55;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.wm-title {
  font-size: 1.35rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text-primary);
  margin-bottom: 10px;
  line-height: 1.4;
}

.wm-tagline {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--accent-pink);
  letter-spacing: 0.06em;
  margin-bottom: 28px;
  line-height: 1.75;
}

.wm-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  color: var(--accent-pink);
  margin: 26px 0 10px;
  opacity: 0.88;
}

.wm-body {
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.95;
  letter-spacing: 0.03em;
  margin-bottom: 12px;
}

.wm-body strong {
  font-weight: 500;
  color: var(--text-primary);
}

/* Steps list */
.wm-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  counter-reset: wm-steps;
}
.wm-steps li {
  counter-increment: wm-steps;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 300;
  color: var(--text-primary);
  line-height: 1.9;
  letter-spacing: 0.03em;
}
.wm-steps li::before {
  content: counter(wm-steps) ".";
  font-size: 0.68rem;
  color: var(--accent-pink);
  opacity: 0.7;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Closing line */
.wm-closing {
  font-size: 0.86rem;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: 0.07em;
  line-height: 2;
  margin-top: 22px;
  opacity: 0.82;
  text-align: center;
}

/* Promise rules (modal 2) */
.promise-rule {
  margin-bottom: 22px;
}
.promise-rule-title {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
  line-height: 1.6;
}
.promise-rule-num {
  color: var(--accent-pink);
  font-size: 0.72rem;
  opacity: 0.75;
  margin-right: 3px;
}
.promise-rule-body {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-muted);
  line-height: 1.85;
  letter-spacing: 0.03em;
}

/* Mobile */
@media (max-width: 599px) {
  .welcome-scroll {
    padding: 28px 24px 16px;
  }

  .welcome-footer {
    padding: 14px 24px 24px;
  }

  .wm-title {
    font-size: 1.15rem;
  }
}

/* ============================================================
   Legal Modals (利用規約 / プライバシーポリシー)
   ============================================================ */
.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.legal-modal[hidden] {
  display: none;
}

.legal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 16, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.legal-card {
  position: relative;
  z-index: 1;
  width: min(640px, 94vw);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  background: rgba(8, 11, 22, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5);
}

.legal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 20px;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(241, 241, 242, 0.07);
}

.legal-title {
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(241, 241, 242, 0.82);
  letter-spacing: 0.18em;
}

.legal-close {
  background: none;
  border: none;
  color: rgba(241, 241, 242, 0.35);
  font-size: 0.68rem;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
  font-family: var(--font-base);
  transition: color 0.2s ease;
}

.legal-close:hover {
  color: rgba(241, 241, 242, 0.75);
}

.legal-scroll {
  overflow-y: auto;
  padding: 28px 32px 40px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(241, 241, 242, 0.1) transparent;
}

.legal-scroll::-webkit-scrollbar {
  width: 3px;
}

.legal-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.legal-scroll::-webkit-scrollbar-thumb {
  background: rgba(241, 241, 242, 0.1);
  border-radius: 2px;
}

.legal-intro {
  font-size: 0.75rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.5);
  line-height: 1.95;
  letter-spacing: 0.04em;
  margin-bottom: 28px;
}

.legal-article {
  margin-bottom: 22px;
}

.legal-article-title {
  font-size: 0.72rem;
  font-weight: 500;
  color: rgba(241, 241, 242, 0.68);
  letter-spacing: 0.1em;
  margin-bottom: 7px;
}

.legal-article-body {
  font-size: 0.73rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.44);
  line-height: 1.95;
  letter-spacing: 0.03em;
}

.legal-article-list {
  font-size: 0.73rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.44);
  line-height: 1.95;
  letter-spacing: 0.03em;
  padding-left: 1.5em;
  margin-top: 7px;
}

.legal-article-list li {
  margin-bottom: 3px;
}

.legal-article-sublist {
  list-style: none;
  padding-left: 1em;
  margin: 5px 0 8px;
}

.legal-article-sublist li::before {
  content: '· ';
  color: rgba(241, 241, 242, 0.3);
}

.legal-meta {
  margin-top: 32px;
  padding-top: 20px;
  position: relative;
}

.legal-meta::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(241, 241, 242, 0.07);
}

.legal-meta-line {
  font-size: 0.65rem;
  font-weight: 300;
  color: rgba(241, 241, 242, 0.3);
  letter-spacing: 0.1em;
  line-height: 2.1;
}

/* Footer mobile */
@media (max-width: 599px) {
  #site-footer {
    padding: 52px 0 36px;
  }

  .footer-inner {
    max-width: 92vw;
    gap: 12px;
  }

  .footer-line { font-size: 0.78rem; }
  .footer-poka-link { font-size: 0.7rem; }

  .footer-bottom {
    gap: 24px;
    margin-top: 36px;
  }

  /* Legal modal mobile */
  .legal-head {
    padding: 18px 22px 16px;
  }

  .legal-scroll {
    padding: 22px 22px 32px;
  }
}
