/* ============================================================
   YOUR NAME IS A? — Cyberpunk Stylesheet
   ============================================================ */

:root {
  /* Palette */
  --bg:           #010508;
  --surface:      #040c12;
  --card:         #060f16;

  --cyan:         #00f7ff;
  --cyan-mid:     rgba(0, 247, 255, 0.45);
  --cyan-low:     rgba(0, 247, 255, 0.12);
  --cyan-dim:     rgba(0, 247, 255, 0.06);

  --purple:       #b000ff;
  --purple-mid:   rgba(176, 0, 255, 0.45);
  --purple-low:   rgba(176, 0, 255, 0.12);
  --purple-dim:   rgba(176, 0, 255, 0.06);

  --red:          #ff003c;
  --yellow:       #f0c000;

  --text:         #b8d8dc;
  --text-mid:     #4d7580;
  --text-dim:     #243640;

  --border:       rgba(0, 247, 255, 0.14);
  --border-hi:    rgba(0, 247, 255, 0.50);

  /* Typography */
  --mono:  'Share Tech Mono', 'Courier New', monospace;
  --title: 'Orbitron', sans-serif;

  /* Easing */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  min-height: 100vh;
  min-height: 100dvh;       /* respect mobile browser chrome */
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%; /* prevent iOS font scaling */
}

/* Remove tap delay and ghost highlight on all interactive elements */
button, input, textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ────────────────────────────────────────────
   ATMOSPHERIC OVERLAYS
──────────────────────────────────────────── */

/* CRT scanlines */
.scanline {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0, 247, 255, 0.013) 3px,
    rgba(0, 247, 255, 0.013) 4px
  );
  pointer-events: none;
  touch-action: none;
  z-index: 9998;
  will-change: transform; /* own compositing layer — no scroll repaint */
}

/* Edge vignette */
.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 50%,
    rgba(0, 0, 0, 0.75) 100%
  );
  pointer-events: none;
  touch-action: none;
  z-index: 9997;
  will-change: transform;
}

/* ────────────────────────────────────────────
   HEADER
──────────────────────────────────────────── */

header {
  position: relative;
  text-align: center;
  padding: 72px 24px 52px;
  overflow: hidden;
}

.header-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 700px 320px at center,   rgba(0, 247, 255, 0.05) 0%, transparent 70%),
    radial-gradient(ellipse 400px 200px at center 65%, rgba(176, 0, 255, 0.04) 0%, transparent 65%);
  pointer-events: none;
}

/* Glitch title */
.title {
  position: relative;
  display: inline-block;
  font-family: var(--title);
  font-size: clamp(1.7rem, 5.5vw, 3.6rem);
  font-weight: 900;
  letter-spacing: 0.09em;
  color: var(--cyan);
  text-shadow:
    0 0 10px var(--cyan),
    0 0 35px var(--cyan-mid),
    0 0 90px rgba(0, 247, 255, 0.12);
  animation: titlePulse 5s ease-in-out infinite;
}

.title .accent {
  color: var(--purple);
  text-shadow:
    0 0 10px var(--purple),
    0 0 35px var(--purple-mid),
    0 0 90px rgba(176, 0, 255, 0.12);
}

/* Glitch layers */
.title::before,
.title::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  color: var(--cyan);
  opacity: 0;
}

.title::before {
  color: var(--purple);
  text-shadow: -3px 0 var(--purple);
  animation: glitchA 10s 1s infinite;
}

.title::after {
  color: #00fff7;
  text-shadow: 3px 0 #00fff7;
  animation: glitchB 10s 1s infinite;
}

@keyframes titlePulse {
  0%, 100% { text-shadow: 0 0 10px var(--cyan), 0 0 35px var(--cyan-mid), 0 0 90px rgba(0,247,255,0.12); }
  50%       { text-shadow: 0 0 16px var(--cyan), 0 0 55px var(--cyan-mid), 0 0 120px rgba(0,247,255,0.18); }
}

@keyframes glitchA {
  0%, 92%, 100% { opacity: 0; transform: translate(0); clip-path: none; }
  93%  { opacity: 0.85; transform: translate(-4px,  1px); clip-path: inset(8%  0 62% 0); }
  94%  { opacity: 0.85; transform: translate( 4px, -1px); clip-path: inset(58% 0 12% 0); }
  95%  { opacity: 0; }
}

@keyframes glitchB {
  0%, 92%, 100% { opacity: 0; transform: translate(0); clip-path: none; }
  93%  { opacity: 0.65; transform: translate( 3px, -2px); clip-path: inset(28% 0 42% 0); }
  94%  { opacity: 0.65; transform: translate(-3px,  2px); clip-path: inset(48% 0 22% 0); }
  95%  { opacity: 0; }
}

.subtitle {
  margin-top: 16px;
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  color: var(--text-mid);
  opacity: 0.75;
}

/* ────────────────────────────────────────────
   LAYOUT
──────────────────────────────────────────── */

main {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px 90px;
}

/* ────────────────────────────────────────────
   TERMINAL BOX (POST FORM)
──────────────────────────────────────────── */

.post-section { margin-bottom: 62px; }

.terminal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.8), inset 0 0 40px rgba(0,0,0,0.4);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.terminal-box:focus-within {
  border-color: var(--border-hi);
  box-shadow:
    0 0 0 1px rgba(0, 247, 255, 0.07),
    0 0 40px rgba(0, 247, 255, 0.10),
    inset 0 0 40px rgba(0, 0, 0, 0.4);
}

/* Title bar */
.terminal-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  background: rgba(0, 247, 255, 0.025);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot.red    { background: #ff5f57; box-shadow: 0 0 5px rgba(255, 95, 87, 0.65); }
.dot.yellow { background: #febc2e; box-shadow: 0 0 5px rgba(254,188, 46, 0.65); }
.dot.green  { background: #28c840; box-shadow: 0 0 5px rgba( 40,200, 64, 0.65); }

.terminal-label {
  margin-left: 8px;
  font-size: 0.70rem;
  letter-spacing: 0.18em;
  color: var(--text-mid);
}

/* Textarea */
#noteInput {
  display: block;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.93rem;
  line-height: 1.75;
  padding: 18px 20px;
  resize: none;
  caret-color: var(--cyan);
  spellcheck: false;
}

#noteInput::placeholder {
  color: var(--text-mid);
  opacity: 0.40;
}

/* Post controls row */
.post-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
}

.char-count {
  font-size: 0.70rem;
  color: var(--text-dim);
  letter-spacing: 0.10em;
  transition: color 0.25s;
}
.char-count.warn   { color: var(--yellow); }
.char-count.danger { color: var(--red); }

/* ────────────────────────────────────────────
   BUTTONS
──────────────────────────────────────────── */

/* Primary */
.btn-primary {
  position: relative;
  overflow: hidden;
  background: transparent;
  border: 1px solid rgba(0, 247, 255, 0.50);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.20em;
  padding: 9px 22px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.15s;
  user-select: none;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0,247,255,0.10), transparent);
  transform: translateX(-130%);
  transition: transform 0.45s var(--ease);
}

.btn-primary:hover {
  border-color: var(--cyan);
  color: #fff;
  text-shadow: 0 0 8px var(--cyan);
  box-shadow: 0 0 18px var(--cyan-mid), inset 0 0 14px var(--cyan-dim);
}

.btn-primary:hover::before { transform: translateX(130%); }
.btn-primary:active         { transform: scale(0.96); }

.btn-primary:disabled {
  opacity: 0.22;
  cursor: not-allowed;
  pointer-events: none;
}

/* Reply */
.btn-reply {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid rgba(176, 0, 255, 0.35);
  color: rgba(176, 0, 255, 0.80);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.22s var(--ease);
  user-select: none;
  white-space: nowrap;
}

.btn-reply:hover {
  background: var(--purple-low);
  border-color: var(--purple);
  color: var(--purple);
  box-shadow: 0 0 12px var(--purple-mid);
  text-shadow: 0 0 6px var(--purple);
}

.btn-reply:active   { transform: scale(0.95); }
.btn-reply:disabled { opacity: 0.20; cursor: not-allowed; pointer-events: none; }

/* ────────────────────────────────────────────
   COOLDOWN BAR
──────────────────────────────────────────── */

.cooldown-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 16px 10px;
  border-top: 1px solid rgba(240, 192, 0, 0.14);
}

.cooldown-label {
  font-size: 0.68rem;
  color: var(--yellow);
  letter-spacing: 0.12em;
  white-space: nowrap;
  flex-shrink: 0;
}

.cooldown-track {
  flex: 1;
  height: 2px;
  background: rgba(240, 192, 0, 0.14);
  border-radius: 1px;
  overflow: hidden;
}

.cooldown-fill {
  height: 100%;
  width: 100%;
  background: var(--yellow);
  box-shadow: 0 0 6px var(--yellow);
  transform-origin: left;
}

.hidden { display: none !important; }

/* ────────────────────────────────────────────
   FEED HEADER
──────────────────────────────────────────── */

.feed-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.feed-label {
  font-size: 0.76rem;
  color: var(--text-mid);
  letter-spacing: 0.18em;
}

.badge {
  font-size: 0.68rem;
  color: var(--cyan);
  opacity: 0.60;
  letter-spacing: 0.10em;
}

/* ────────────────────────────────────────────
   NOTES FEED
──────────────────────────────────────────── */

.notes-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Loading ── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 80px 20px;
  color: var(--text-mid);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  opacity: 0.55;
}

.loader-ring {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 247, 255, 0.15);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty ── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-mid);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  line-height: 2.4;
  opacity: 0.48;
}

.empty-glyph {
  display: block;
  font-size: 2.2rem;
  margin-bottom: 14px;
  opacity: 0.28;
  color: var(--cyan);
}

/* ────────────────────────────────────────────
   NOTE CARD
──────────────────────────────────────────── */

.note-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--cyan);
  border-radius: 2px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.2s var(--ease);
  animation: cardIn 0.38s var(--ease);
}

/* Top edge glow line */
.note-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--cyan), transparent 55%);
  opacity: 0.18;
  pointer-events: none;
}

.note-card:hover {
  border-color: rgba(0, 247, 255, 0.32);
  border-left-color: var(--cyan);
  box-shadow: -2px 0 14px rgba(0, 247, 255, 0.14), 0 0 24px rgba(0, 247, 255, 0.04);
  transform: translateX(2px);
}

/* Slide-in for initial load */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Live new-note flash */
.note-card.is-new {
  border-left-color: var(--purple);
  animation: newCardFlash 0.55s var(--ease);
}

@keyframes newCardFlash {
  0%   { opacity: 0; transform: translateY(-18px); box-shadow: 0 0 50px rgba(176,0,255,0.45); }
  55%  { box-shadow: 0 0 14px rgba(176,0,255,0.18); }
  100% { opacity: 1; transform: translateY(0); box-shadow: none; }
}

/* Meta row */
.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.note-id { font-size: 0.66rem; color: var(--text-dim); letter-spacing: 0.14em; }

.note-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.note-time { font-size: 0.66rem; color: var(--text-mid); letter-spacing: 0.06em; }

/* Erase button */
.btn-erase {
  background: transparent;
  border: 1px solid rgba(255, 0, 60, 0.25);
  color: rgba(255, 0, 60, 0.4);
  font-family: var(--mono);
  font-size: 0.72rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
  line-height: 1;
}

.btn-erase:hover {
  background: rgba(255, 0, 60, 0.1);
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 8px rgba(255, 0, 60, 0.25);
}

.btn-erase.armed {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255, 0, 60, 0.12);
  animation: eraseArmedPulse 0.5s ease-in-out infinite alternate;
}

@keyframes eraseArmedPulse {
  from { box-shadow: 0 0 6px rgba(255, 0, 60, 0.2); }
  to   { box-shadow: 0 0 14px rgba(255, 0, 60, 0.5); }
}

/* Body */
.note-body {
  font-size: 0.92rem;
  line-height: 1.78;
  color: var(--text);
  word-break: break-word;
  white-space: pre-wrap;
  margin-bottom: 16px;
}

/* ────────────────────────────────────────────
   REPLIES
──────────────────────────────────────────── */

.replies-wrap {
  border-top: 1px solid rgba(0, 247, 255, 0.07);
  padding-top: 14px;
}

.replies-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.reply-item {
  padding: 9px 13px;
  background: rgba(176, 0, 255, 0.035);
  border-left: 2px solid rgba(176, 0, 255, 0.28);
  border-radius: 1px;
  animation: replyIn 0.28s var(--ease);
}

@keyframes replyIn {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

.reply-body {
  font-size: 0.84rem;
  color: rgba(184, 216, 220, 0.82);
  line-height: 1.65;
  word-break: break-word;
  white-space: pre-wrap;
}

.reply-time {
  display: block;
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 0.06em;
}

/* Reply input row */
.reply-form {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.reply-input {
  flex: 1;
  min-width: 0;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid rgba(176, 0, 255, 0.24);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.80rem;
  padding: 8px 12px;
  outline: none;
  caret-color: var(--purple);
  transition: border-color 0.24s, box-shadow 0.24s;
}

.reply-input::placeholder { color: var(--text-mid); opacity: 0.36; }

.reply-input:focus {
  border-color: rgba(176, 0, 255, 0.60);
  box-shadow: 0 0 10px rgba(176, 0, 255, 0.18);
}

/* ────────────────────────────────────────────
   FOOTER
──────────────────────────────────────────── */

footer {
  text-align: center;
  padding: 28px 20px;
  border-top: 1px solid var(--border);
  font-size: 0.66rem;
  letter-spacing: 0.20em;
  color: var(--text-dim);
  opacity: 0.45;
}

/* ────────────────────────────────────────────
   TOAST
──────────────────────────────────────────── */

#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(255, 0, 60, 0.15);
  border: 1px solid rgba(255, 0, 60, 0.5);
  color: #ff4466;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  padding: 10px 22px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
  box-shadow: 0 0 20px rgba(255, 0, 60, 0.2);
  white-space: nowrap;
}

#toast.toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ────────────────────────────────────────────
   SCROLLBAR
──────────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(0,247,255,0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,247,255,0.36); }

/* ────────────────────────────────────────────
   RESPONSIVE — TABLET
──────────────────────────────────────────── */

@media (max-width: 768px) {
  main { padding: 0 14px 80px; }
}

/* ────────────────────────────────────────────
   RESPONSIVE — MOBILE
──────────────────────────────────────────── */

@media (max-width: 540px) {

  /* Header */
  header {
    padding: 40px 16px 28px;
  }

  .subtitle {
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    line-height: 1.6;
  }

  /* Post section */
  .post-section { margin-bottom: 40px; }

  /* CRITICAL: prevent iOS zoom on input focus (must be >= 16px) */
  #noteInput {
    font-size: 16px;
    padding: 14px 16px;
  }

  .reply-input {
    font-size: 16px;
    padding: 11px 13px;
  }

  /* Post controls — stack vertically */
  .post-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }

  .btn-primary {
    width: 100%;
    min-height: 48px;         /* comfortable touch target */
    font-size: 0.82rem;
    text-align: center;
    justify-content: center;
  }

  /* Cooldown bar — prevent label overflow */
  .cooldown-bar {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 14px 10px;
  }

  .cooldown-label {
    font-size: 0.62rem;
  }

  /* Note cards */
  .note-card {
    padding: 14px 14px 14px 13px;
  }

  /* Note meta — wrap gracefully if needed */
  .note-meta {
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 8px;
  }

  /* Erase button — larger touch target on mobile */
  .btn-erase {
    width: 32px;
    height: 32px;
    font-size: 0.82rem;
  }

  /* Note body */
  .note-body {
    font-size: 0.88rem;
    margin-bottom: 12px;
  }

  /* Replies */
  .reply-item {
    padding: 8px 11px;
  }

  .reply-body {
    font-size: 0.82rem;
  }

  /* Reply form — always stack on mobile */
  .reply-form {
    flex-direction: column;
    gap: 7px;
    margin-top: 8px;
  }

  .btn-reply {
    width: 100%;
    text-align: center;
    min-height: 44px;         /* comfortable touch target */
    padding: 10px;
  }

  /* Feed header */
  .feed-header {
    flex-wrap: wrap;
    gap: 4px;
  }

  /* Toast — full-width on small screens, no overflow */
  #toast {
    width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
    font-size: 0.72rem;
    bottom: 20px;
  }

  /* Loading / empty */
  .loading-state,
  .empty-state {
    padding: 50px 16px;
  }
}


/* ── Credit flicker ── */
.credit-flicker {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-top: 6px;
  opacity: 0.75;
  animation: creditFlicker 6s infinite;
  text-shadow: 0 0 6px var(--cyan), 0 0 14px var(--cyan);
}

@keyframes creditFlicker {
  0%   { opacity: 0.75; text-shadow: 0 0 6px var(--cyan), 0 0 14px var(--cyan); }
  4%   { opacity: 0.2;  text-shadow: none; }
  6%   { opacity: 0.85; text-shadow: 0 0 8px var(--cyan), 0 0 20px var(--cyan); }
  8%   { opacity: 0.3;  text-shadow: none; }
  10%  { opacity: 0.8;  text-shadow: 0 0 6px var(--cyan), 0 0 14px var(--cyan); }
  50%  { opacity: 0.75; text-shadow: 0 0 6px var(--cyan), 0 0 14px var(--cyan); }
  52%  { opacity: 0.15; text-shadow: none; }
  54%  { opacity: 0.75; text-shadow: 0 0 6px var(--cyan), 0 0 14px var(--cyan); }
  100% { opacity: 0.75; text-shadow: 0 0 6px var(--cyan), 0 0 14px var(--cyan); }
}


/* ── Visitor counter ── */
.visitor-count {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: var(--cyan);
  margin-top: 10px;
  text-shadow: 0 0 8px var(--cyan), 0 0 20px var(--cyan);
  min-height: 1.2em;
}
