/* ===================================================
   青春異常論 — style.css
   =================================================== */

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

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

:root {
  --bg:          #07071a;
  --bg-card:     #0d0d24;
  --bg-input:    #11112a;
  --border:      rgba(79, 195, 247, 0.18);
  --border-glow: rgba(79, 195, 247, 0.45);
  --text:        #dde6f5;
  --text-muted:  #7a8db0;
  --text-dim:    #3a4a6a;
  --blue:        #4fc3f7;
  --blue-dim:    rgba(79, 195, 247, 0.12);
  --purple:      #b39ddb;
  --purple-dim:  rgba(179, 157, 219, 0.12);
  --danger:      #ef5350;
  --font:        'Noto Sans JP', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 300;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, textarea { font-family: var(--font); }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ---------- Noise overlay ---------- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: .025;
  pointer-events: none;
  z-index: 9998;
}

/* =============================================
   NAVIGATION
   ============================================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: rgba(7, 7, 26, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.nav-logo {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .3em;
  color: var(--blue);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  font-size: .72rem;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  transition: color .2s, background .2s;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--blue);
  background: var(--blue-dim);
}

/* Navigation Hamburger */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 26px;
  height: 20px;
  position: relative;
  z-index: 1000;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--blue);
  position: absolute;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
  left: 0;
  transform-origin: center;
}
.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 9px; }
.nav-toggle span:nth-child(3) { bottom: 0; }

.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}
.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: rgba(7, 7, 26, 0.95);
    backdrop-filter: blur(14px);
    flex-direction: column;
    padding: 24px 20px;
    gap: 12px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border-bottom: 1px solid var(--border);
  }
  .nav-open .nav-links {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav-links li {
    width: 100%;
    text-align: center;
  }
  .nav-links a {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
  }
}

/* =============================================
   PAGE WRAPPER
   ============================================= */
.page {
  padding-top: 80px;
  padding-bottom: 80px;
  min-height: 100vh;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =============================================
   SECTION LABEL
   ============================================= */
.label {
  font-size: .62rem;
  letter-spacing: .4em;
  color: var(--blue);
  text-transform: uppercase;
  display: block;
  margin-bottom: 16px;
}

/* =============================================
   INDEX PAGE
   ============================================= */
.hero {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  position: relative;
  overflow: hidden;
}

/* flowing text bg */
.hero-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.hero-bg-track {
  position: absolute;
  left: 0;
  white-space: nowrap;
  font-size: .72rem;
  letter-spacing: .12em;
  color: rgba(79, 195, 247, .07);
  animation: flowLeft linear infinite;
}

@keyframes flowLeft {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.hero-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.hero-title {
  font-size: clamp(3rem, 12vw, 6.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.02em;
  background: linear-gradient(160deg, #fff 20%, var(--blue) 65%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-en {
  font-size: clamp(.65rem, 2vw, .9rem);
  letter-spacing: .35em;
  color: var(--text-muted);
}

.hero-catch {
  font-size: clamp(.85rem, 2.5vw, 1.05rem);
  color: var(--text-muted);
  max-width: 440px;
  line-height: 1.9;
  font-weight: 300;
}

.hero-catch em {
  font-style: normal;
  color: var(--blue);
}

/* divider */
.divider {
  width: 60px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--blue), transparent);
}

/* nav cards */
.hero-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin-top: 12px;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color .25s, box-shadow .25s, transform .2s;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.hero-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 24px rgba(79,195,247,.1);
  transform: translateY(-2px);
}
.hero-card-en {
  font-size: .6rem;
  letter-spacing: .25em;
  color: var(--blue);
}
.hero-card-ja {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
}
.hero-card-desc {
  font-size: .7rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* =============================================
   STORY PAGE
   ============================================= */
.story-header {
  text-align: center;
  margin-bottom: 48px;
}

.story-title {
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 700;
  background: linear-gradient(160deg, #fff 30%, var(--blue) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.story-body {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid rgba(79,195,247,.5);
  border-radius: 16px;
  padding: 36px 32px;
  font-size: .95rem;
  line-height: 2.2;
  letter-spacing: .04em;
  color: var(--text);
}

@media (max-width: 600px) {
  .story-body { padding: 24px 18px; }
}

/* =============================================
   TRACKS PAGE
   ============================================= */
.tracks-header {
  text-align: center;
  margin-bottom: 48px;
}

.tracks-title {
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 700;
  background: linear-gradient(160deg, #fff 30%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.tracks-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.track-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color .25s, box-shadow .2s;
  display: flex;
  flex-direction: column;
}
.track-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 20px rgba(79,195,247,.08);
}

.track-num {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .2em;
  color: var(--blue);
}

.track-name {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-actions {
  display: grid;
  grid-template-columns: 120px 75px 170px;
  gap: 8px;
  justify-content: end;
  justify-self: end;
  width: 100%;
}

.track-actions > * {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.empty-btn {
  visibility: hidden;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .1em;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all .2s;
  white-space: nowrap;
}

.btn-blue {
  background: var(--blue-dim);
  border-color: rgba(79,195,247,.3);
  color: var(--blue);
}
.btn-blue:hover {
  background: rgba(79,195,247,.22);
  border-color: var(--blue);
  box-shadow: 0 0 14px rgba(79,195,247,.2);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover {
  border-color: rgba(179,157,219,.5);
  color: var(--purple);
  background: var(--purple-dim);
}

.btn-red {
  background: rgba(239, 83, 80, 0.12);
  border-color: rgba(239, 83, 80, 0.35);
  color: var(--danger);
}
.btn-red:hover {
  background: rgba(239, 83, 80, 0.22);
  border-color: var(--danger);
  box-shadow: 0 0 14px rgba(239, 83, 80, 0.25);
}

.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}


@media (max-width: 768px) {
  .track-card-header {
    grid-template-columns: 40px 1fr 20px;
  }
  .track-name {
    grid-column: 2 / span 2;
  }
  .track-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr 1fr;
    margin-top: 10px;
  }
}

@media (max-width: 560px) {
  .track-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin-top: 10px;
    justify-content: flex-end;
  }
  .track-actions > * {
    flex: 1;
    min-width: 0;
  }
  .track-actions .empty-btn {
    display: none !important;
  }
  .track-actions .btn {
    font-size: 11px;
    padding: 8px 4px;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
    height: 100%;
  }
}

/* =============================================
   AYN PAGE
   ============================================= */
.ayn-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0 16px 80px;
  gap: 24px;
}

.ayn-main-col {
  width: 100%;
  max-width: 400px;
  height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 72px;
}

/* Phone frame */
.ayn-frame {
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #06061a;
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(79,195,247,.08), 0 0 120px rgba(7,7,26,.8);
  display: flex;
  flex-direction: column;
}

/* AYN header */
.ayn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(6,6,26,.96);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.ayn-logo {
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .18em;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ayn-logo-sub {
  font-size: .52rem;
  letter-spacing: .12em;
  color: var(--text-dim);
  display: block;
}

.ayn-time {
  font-size: .75rem;
  letter-spacing: .1em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.ayn-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
  animation: blink 2.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: .2; }
}

/* Feed */
.ayn-feed {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  padding: 0;
}
.ayn-feed::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.ayn-post {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(79,195,247,.07);
  transition: background .2s;
}
.ayn-post:hover { background: rgba(79,195,247,.03); }

.ayn-post-new {
  animation: slideIn .35s cubic-bezier(.22,1,.36,1) forwards;
  background: rgba(79,195,247,.04);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-12px) scaleY(.9); }
  to   { opacity: 1; transform: none; }
}

.ayn-post-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ayn-handle {
  font-size: .7rem;
  letter-spacing: .05em;
  color: var(--blue);
  font-weight: 500;
}

.ayn-post-time {
  font-size: .62rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.ayn-post-text {
  font-size: .88rem;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Composer */
.ayn-composer {
  flex-shrink: 0;
  padding: 14px 18px;
  border-top: 1px solid var(--border);
  background: rgba(6,6,26,.97);
  backdrop-filter: blur(12px);
}

.ayn-composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.ayn-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: .85rem;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.6;
  transition: border-color .2s;
  max-height: 90px;
  overflow-y: auto;
}
.ayn-input::placeholder { color: var(--text-dim); }
.ayn-input:focus { border-color: rgba(79,195,247,.4); }

.ayn-send {
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(79,195,247,.2), rgba(179,157,219,.2));
  border: 1px solid rgba(79,195,247,.35);
  border-radius: 10px;
  color: var(--blue);
  font-size: .78rem;
  letter-spacing: .1em;
  padding: 9px 16px;
  transition: all .2s;
  font-weight: 500;
}
.ayn-send:hover:not(:disabled) {
  background: rgba(79,195,247,.25);
  box-shadow: 0 0 16px rgba(79,195,247,.2);
}
.ayn-send:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.ayn-char {
  font-size: .6rem;
  color: var(--text-dim);
  text-align: right;
  margin-top: 6px;
  letter-spacing: .05em;
  transition: color .2s;
}
.ayn-char.warn { color: #fbbf24; }
.ayn-char.over { color: var(--danger); }

/* Actions */
.ayn-post-actions {
  display: flex;
  gap: 18px;
  margin-top: 10px;
}
.ayn-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .68rem;
  color: var(--text-dim);
  background: none;
  border: none;
  transition: color .2s;
  cursor: pointer;
  padding: 4px 6px;
  margin: -4px -6px;
}
.ayn-action-btn:hover { color: var(--blue); }
.ayn-action-btn.delete-btn:hover { color: var(--danger); }
.ayn-action-btn svg { width: 14px; height: 14px; fill: currentColor; }

/* Tabs */
.ayn-tabs {
  display: flex;
  border-bottom: 1px solid rgba(79,195,247,.1);
}
.ayn-tab-btn {
  width: 50%;
  padding: 12px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  border-bottom: 2px solid transparent;
}
.ayn-tab-btn:hover {
  color: var(--text);
  background: rgba(79,195,247,.03);
}
.ayn-tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.ayn-composer-handle {
  font-size: .75rem;
  color: var(--blue);
  margin-bottom: 6px;
  font-weight: 600;
}


/* Side panel (desktop) */
.ayn-side {
  width: 220px;
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}
@media (min-width: 700px) {
  .ayn-side { display: flex; }
}

.ayn-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.ayn-panel-title {
  font-size: .62rem;
  letter-spacing: .3em;
  color: var(--blue);
  margin-bottom: 10px;
}
.ayn-panel-body {
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.8;
}

/* =============================================
   FOOTER
   ============================================= */
.footer {
  text-align: center;
  padding: 32px 20px;
  font-size: .65rem;
  letter-spacing: .15em;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* =============================================
   UTILITIES
   ============================================= */
.mt-4  { margin-top: 16px; }
.mt-8  { margin-top: 32px; }
.mt-16 { margin-top: 64px; }
.mb-2  { margin-bottom: 8px; }

/* =============================================
   ANIMATIONS
   ============================================= */
.fade-in {
  animation: fadeIn .7s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Animations */
.ayn-post-new {
  animation: postFadeIn 0.8s ease forwards;
}
.ayn-post-new-glow {
  animation: newPostGlow 4s ease-out forwards;
}

@keyframes postFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes newPostGlow {
  0% { box-shadow: inset 0 0 0 rgba(79, 195, 247, 0); background: rgba(79, 195, 247, 0); }
  10% { box-shadow: inset 0 0 15px rgba(79, 195, 247, 0.4); background: rgba(79, 195, 247, 0.08); }
  80% { box-shadow: inset 0 0 15px rgba(79, 195, 247, 0.4); background: rgba(79, 195, 247, 0.08); }
  100% { box-shadow: inset 0 0 0 rgba(79, 195, 247, 0); background: transparent; }
}
