:root {
  --bg-main: #0a0f1c;
  --bg-gradient: linear-gradient(120deg, #0a0f1c 60%, #1a1a2f 100%);
  --bg-panel: rgba(18,22,38,0.97);
  --color-text: #eaf6fb;
  --color-title: #ffe082;
  --color-accent: #00ffe7;
  --color-accent2: #ff2d7a;
  --color-accent3: #ffd700;
  --color-link: #ff2d7a;
  --color-link-hover: #00ffe7;
  --color-blockquote: #ffe082;
  --color-blockquote-bg: rgba(0,255,231,0.08);
  --color-entry-bg: rgba(18,22,38,0.97);
  --color-entry-text: #eaf6fb;
  --color-border: #00ffe7;
  --shadow-glow: 0 0 32px #00ffe799, 0 0 16px #ff2d7a55, 0 0 8px #ffd70033;
  --city-neon: url('city-neon-silhouette.png');
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-gradient), #0a0f1c;
  color: var(--color-text);
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  letter-spacing: 0.01em;
  position: relative;
  overflow-x: hidden;
  transition: background 0.5s;
}

.main-bg {
  position: fixed;
  z-index: 0;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  background:
    linear-gradient(to top, #0a0f1c 60%, transparent 100%),
    var(--city-neon) bottom center repeat-x,
    repeating-linear-gradient(
      to bottom,
      rgba(0,255,231,0.04) 0px,
      rgba(0,255,231,0.04) 2px,
      transparent 2px,
      transparent 16px
    ),
    radial-gradient(circle at 80% 90%, #ff2d7a33 0%, transparent 60%),
    radial-gradient(circle at 20% 80%, #00ffe733 0%, transparent 60%);
  background-size:
    100% 100%,
    1200px 180px,
    auto,
    100% 100%,
    100% 100%;
  background-repeat: no-repeat, repeat-x, repeat, no-repeat, no-repeat;
  background-position: bottom center, bottom center, top left, bottom right, bottom left;
  opacity: 1;
  animation: city-fade 12s linear infinite alternate;
}
@keyframes city-fade {
  0% { opacity: 1; }
  100% { opacity: 0.93; }
}

.particles {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: 1;
}

.container {
  display: flex;
  max-width: 1200px;
  margin: 64px auto 0 auto;
  background: var(--bg-panel);
  border-radius: 22px;
  box-shadow: var(--shadow-glow);
  min-height: 700px;
  position: relative;
  z-index: 2;
  border: 2.5px solid var(--color-accent3);
  transition: box-shadow 0.3s;
}

.sidebar {
  width: 270px;
  background: linear-gradient(180deg, #181c2b 60%, #1a1a2f 100%);
  border-right: 3px solid var(--color-accent);
  border-radius: 22px 0 0 22px;
  padding: 38px 18px 18px 18px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  box-shadow: 0 0 24px var(--color-accent) inset;
  min-width: 220px;
}

.profile {
  text-align: left;
  margin-bottom: 18px;
  width: 100%;
  animation: fadein 1.2s;
}
.avatar {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 3px solid var(--color-accent2);
  margin-bottom: 10px;
  background: #222;
  box-shadow: 0 0 18px var(--color-accent2) inset, 0 0 8px var(--color-accent3);
  transition: box-shadow 0.3s;
}
.profile h2 {
  margin: 0 0 6px 0;
  color: var(--color-title);
  font-size: 1.25em;
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px var(--color-accent3), 0 0 2px #fff;
}
.bio {
  font-size: 1em;
  color: #b0c4d4;
  margin: 0;
  font-style: italic;
  text-shadow: 0 0 6px var(--color-accent2);
}

.sidebar nav {
  width: 100%;
}
.sidebar nav h3 {
  color: var(--color-accent2);
  font-family: 'Noto Sans JP', 'Orbitron', 'Segoe UI', Arial, sans-serif;
  font-size: 1.15em;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
  text-shadow: 0 0 8px var(--color-accent2), 0 0 2px #fff;
  border-bottom: 1.5px dashed var(--color-accent);
  padding-bottom: 3px;
  letter-spacing: 0.12em;
  letter-spacing: 0.12em;
}

#entries-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(18,22,38,0.98);
  border: 2px solid var(--color-accent);
  border-radius: 12px;
  box-shadow: 0 0 8px var(--color-accent);
  font-size: 1.02em;
  max-height: 600px;
  overflow-y: auto;
  overflow-x: hidden; /* <-- evita scroll horizontal siempre */
  scrollbar-width: thin;
  scrollbar-color: #00ffe7 #181c2b;
  transition: box-shadow 0.2s;
}
#entries-menu a {
  display: block;
  padding: 13px 16px;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: bold;
  text-shadow: 0 0 8px var(--color-accent);
  border-bottom: 1px dotted var(--color-accent);
  transition: color 0.2s, text-shadow 0.2s, background 0.2s;
  font-family: 'Noto Sans JP', 'Orbitron', 'Segoe UI', Arial, sans-serif;
  letter-spacing: 0.04em;
  border-radius: 0;
}
#entries-menu a:last-child {
  border-bottom: none;
}
#entries-menu a:hover {
  text-decoration: underline;
  color: var(--color-accent2);
  text-shadow: 0 0 16px var(--color-accent2), 0 0 4px #fff;
  background: rgba(255,45,122,0.08);
  border-radius: 8px;
  transform: scale(1.03);
}
.new-badge {
  display: inline-block;
  background: linear-gradient(90deg, #ff2d7a 60%, #ffd700 100%);
  color: #181c2b;
  font-size: 0.82em;
  font-weight: bold;
  border-radius: 8px;
  padding: 2px 10px 2px 8px;
  margin-left: 10px;
  letter-spacing: 0.06em;
  box-shadow: 0 0 8px #ff2d7a99;
  vertical-align: middle;
  animation: newblink 1.2s steps(2, start) infinite;
}
@keyframes newblink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.sidebar-footer {
  margin-top: auto;
  text-align: center;
  width: 100%;
}
.admin-link {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 20px;
  background: linear-gradient(90deg, var(--color-accent) 60%, var(--color-accent2) 100%);
  color: #181c2b;
  border-radius: 10px;
  text-decoration: none;
  font-weight: bold;
  box-shadow: 0 2px 16px var(--color-accent), 0 0 8px var(--color-accent2) inset;
  letter-spacing: 0.08em;
  border: none;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
}
.admin-link:hover {
  background: linear-gradient(90deg, var(--color-accent3) 60%, var(--color-accent2) 100%);
  color: #fff;
  box-shadow: 0 0 24px var(--color-accent3), 0 0 8px var(--color-accent2) inset;
}

.content {
  flex: 1;
  padding: 38px 48px 38px 48px;
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadein 1.2s;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(30px);}
  to { opacity: 1; transform: none;}
}

.banner {
  width: 100%;
  max-width: 700px;
  margin: 0 auto 22px auto;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 32px var(--color-accent), 0 0 12px var(--color-accent2) inset;
  border: 3px solid var(--color-accent2);
  background: #181c2b;
  animation: neon-flicker 3s infinite alternate;
}
@keyframes neon-flicker {
  0%, 100% { box-shadow: 0 0 32px var(--color-accent), 0 0 12px var(--color-accent2) inset; }
  50% { box-shadow: 0 0 48px var(--color-accent3), 0 0 24px var(--color-accent2) inset; }
}
.banner img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
  filter: brightness(1.1) contrast(1.2) drop-shadow(0 0 18px var(--color-accent));
}

.site-title {
  text-align: center;
  color: var(--color-title);
  font-size: 2.5em;
  margin: 22px 0 12px 0;
  text-shadow: 0 0 24px var(--color-accent), 0 0 12px var(--color-accent2), 0 0 4px #fff;
  letter-spacing: 0.16em;
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  animation: flickerTitle 2.5s infinite alternate;
}
@keyframes flickerTitle {
  0%, 100% { text-shadow: 0 0 24px var(--color-accent), 0 0 12px var(--color-accent2), 0 0 4px #fff; }
  50% { text-shadow: 0 0 36px var(--color-accent3), 0 0 24px var(--color-accent2), 0 0 8px #fff; }
}

.welcome {
  background: rgba(18,22,38,0.92);
  border: 2px dashed var(--color-accent3);
  border-radius: 12px;
  padding: 22px 28px;
  margin: 0 0 28px 0;
  font-size: 1.18em;
  color: #b0ffe0;
  box-shadow: 0 0 16px var(--color-accent);
  text-align: center;
  max-width: 650px;
  text-shadow: 0 0 8px var(--color-accent);
  font-family: 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  position: relative;
  overflow: hidden;
}
.welcome::after {
  content: "未来はここから始まる";
  display: block;
  font-family: 'Noto Sans JP', 'Orbitron', 'Segoe UI', Arial, sans-serif;
  color: #ffd700;
  font-size: 0.95em;
  margin-top: 14px;
  letter-spacing: 0.18em;
  opacity: 0.7;
  text-shadow: 0 0 8px #ffd700, 0 0 2px #fff;
  animation: blink 2.5s steps(2, start) infinite;
}

.blink {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  color: var(--color-accent2);
  font-weight: bold;
  text-shadow: 0 0 12px var(--color-accent2);
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  /* Ajuste: usa width 100% y padding extra para que la última palabra no se corte */
  width: 100%;
  padding-right: 2em;
  animation: marquee 16s linear infinite;
}

@keyframes marquee {
  0%   { left: 100%; }
  100% { left: -100%; }
}

.decor-stars {
  position: absolute;
  right: 30px;
  top: 30px;
  width: 90px;
  height: 90px;
  background: url('star-decor-neon.png') no-repeat center/contain;
  opacity: 0.9;
  pointer-events: none;
  filter: drop-shadow(0 0 24px var(--color-accent)) drop-shadow(0 0 12px var(--color-accent2));
  animation: stars-move 8s linear infinite alternate;
}
@keyframes stars-move {
  0% { right: 30px; top: 30px; }
  100% { right: 10px; top: 60px; }
}

footer {
  text-align: center;
  margin: 38px 0 14px 0;
  font-size: 1.08em;
  color: var(--color-accent);
  letter-spacing: 0.7px;
  text-shadow: 0 0 12px var(--color-accent);
  font-family: 'Noto Sans JP', 'Orbitron', 'Segoe UI', Arial, sans-serif;
}
footer a {
  color: var(--color-accent2);
  text-decoration: underline;
  text-shadow: 0 0 12px var(--color-accent2);
}

.entry-content {
  font-family: 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  font-size: 1.22em;
  line-height: 1.8;
  color: var(--color-entry-text);
  background: var(--color-entry-bg);
  padding: 32px 38px;
  border-radius: 14px;
  margin: 28px 0 0 0;
  box-shadow: 0 0 24px var(--color-accent)33;
  max-width: 760px;
  width: 100%;
  letter-spacing: 0.01em;
  word-break: break-word;
  text-shadow: 0 1px 2px #181c2b;
  transition: background 0.2s;
  animation: fadein 1.5s;
}
.entry-content p {
  margin: 1em 0;
}
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 {
  color: var(--color-title);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  text-shadow: 0 0 12px var(--color-accent);
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  letter-spacing: 0.09em;
}
.entry-content a {
  color: var(--color-link);
  text-decoration: underline;
  word-break: break-all;
  transition: color 0.2s;
}
.entry-content a:hover {
  color: var(--color-link-hover);
  text-shadow: 0 0 12px var(--color-link-hover);
}
.entry-content ul,
.entry-content ol {
  margin-left: 2em;
  margin-bottom: 1em;
}
.entry-content blockquote {
  border-left: 4px solid var(--color-accent);
  margin: 1em 0;
  padding: 0.5em 1em;
  color: var(--color-blockquote);
  background: var(--color-blockquote-bg);
  font-style: italic;
  font-family: 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  border-radius: 8px;
  box-shadow: 0 0 8px var(--color-accent2)33;
}

.crud-entries {
  margin-top: 36px;
  width: 100%;
  background: rgba(18,22,38,0.92);
  border: 2px solid var(--color-accent);
  border-radius: 12px;
  box-shadow: 0 0 8px var(--color-accent);
  padding: 18px 16px;
  max-width: 700px;
}

.crud-entries h2 {
  color: var(--color-accent2);
  font-size: 1.1em;
  margin: 0 0 10px 0;
  text-shadow: 0 0 8px var(--color-accent2);
  letter-spacing: 0.04em;
}

#crud-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  background: transparent;
}
#crud-table th, #crud-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #222a;
  text-align: left;
  font-size: 1em;
}
#crud-table th {
  color: var(--color-title);
  text-shadow: 0 0 8px var(--color-accent);
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
}
#crud-table tr:last-child td {
  border-bottom: none;
}
#crud-table button {
  background: linear-gradient(90deg, var(--color-accent) 60%, var(--color-accent2) 100%);
  color: #181c2b;
  border: none;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 1em;
  font-family: 'Orbitron', 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  font-weight: bold;
  margin-right: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--color-accent), 0 0 4px var(--color-accent2) inset;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
#crud-table button:hover {
  background: linear-gradient(90deg, var(--color-accent3) 60%, var(--color-accent2) 100%);
  color: #fff;
  box-shadow: 0 0 12px var(--color-accent3), 0 0 4px var(--color-accent2) inset;
}

/* Modal edición */
#edit-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 2000;
  display: none;
}
#edit-modal[style*="display: block"] {
  display: block;
}
#edit-modal .modal-bg {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(18,22,38,0.97);
  backdrop-filter: blur(2px);
  z-index: 2001;
}
#edit-modal .modal-content {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #181c2b;
  border-radius: 16px;
  box-shadow: 0 0 32px var(--color-accent), 0 0 12px var(--color-accent2) inset;
  padding: 36px 28px 22px 28px;
  min-width: 320px;
  max-width: 95vw;
  color: #e0e0ff;
  z-index: 2002;
}
#edit-modal h3 {
  color: var(--color-title);
  margin-top: 0;
  text-shadow: 0 0 12px var(--color-accent);
}
#edit-modal label {
  color: #b0ffe0;
  font-size: 1em;
}
#edit-modal input[type="text"],
#edit-modal input[type="date"],
#edit-modal input[type="color"],
#edit-modal textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--color-accent);
  background: #222;
  color: #e0e0ff;
  font-size: 1em;
  margin-top: 4px;
  margin-bottom: 10px;
  box-sizing: border-box;
  outline: none;
  transition: border 0.2s;
}
#edit-modal input[type="color"] {
  padding: 0;
  height: 32px;
  width: 50px;
  border: none;
  margin-left: 8px;
  vertical-align: middle;
}
#edit-modal textarea {
  min-height: 80px;
  font-family: 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
  resize: vertical;
}
#edit-modal button {
  margin-right: 8px;
  margin-top: 6px;
}
#edit-result {
  margin-top: 10px;
  min-height: 20px;
  color: var(--color-title);
  text-shadow: 0 0 8px var(--color-accent);
  text-align: center;
}
.admin-form .label-title {
  display: block;
  margin-bottom: 18px;
}
.admin-form .label-title input[type="text"] {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--color-accent);
  background: #181c2b;
  color: #e0e0ff;
  font-size: 1.3em;
  font-weight: bold;
  box-sizing: border-box;
}
.admin-form .row-fields {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.admin-form .row-fields label {
  display: flex;
  flex-direction: column;
  font-size: 1.08em;
  color: #b0ffe0;
  letter-spacing: 0.03em;
  min-width: 160px;
}
.admin-form textarea#story-content {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  margin-top: 8px;
}
.admin-form .form-actions {
  display: flex;
  gap: 18px;
  margin-top: 18px;
  align-items: center;
}
#preview-area {
  background: rgba(18,22,38,0.97);
  border-radius: 14px;
  box-shadow: 0 0 16px var(--color-accent);
  padding: 18px 24px;
  max-width: 700px;
}
#preview-content {
  font-family: 'Noto Sans JP', 'Segoe UI', Arial, sans-serif;
}
@media (max-width: 1200px) {
  .container { max-width: 98vw; }
}
@media (max-width: 900px) {
  .container { flex-direction: column; }
  .sidebar { width: 100%; border-radius: 22px 22px 0 0; border-right: none; border-bottom: 3px solid var(--color-accent); flex-direction: row; justify-content: space-between; min-width: 0; }
  .content { padding: 24px 10px; }
  .banner { max-width: 100%; }
}
@media (max-width: 700px) {
  .admin-form .row-fields { flex-direction: column; gap: 8px; }
  .admin-form textarea#story-content { min-height: 180px; }
  .sidebar { padding: 14px 2vw; }
  .profile { margin-bottom: 8px; }
  .banner { margin-bottom: 10px; }
  .site-title { font-size: 1.5em; }
  .welcome { padding: 12px 4vw; font-size: 1em; }
  .entry-content { padding: 16px 4vw; font-size: 1em; }
}
@media (max-width: 600px) {
  .container { margin: 0; border-radius: 0; }
  .sidebar { padding: 8px 2px; }
  .content { padding: 8px 1px; }
  .banner { border-radius: 0; }
  .entry-content { border-radius: 0; }
}
.entry-date {
  display: inline-block;
  font-family: 'Fira Mono', 'Consolas', 'Menlo', monospace;
  font-size: 1.08em;
  color: #00ffe7;
  background: rgba(10, 15, 28, 0.75);
  border: 1.5px solid #ff2d7a;
  border-radius: 8px;
  padding: 6px 18px 6px 18px;
  margin: 18px 0 18px 0;
  letter-spacing: 0.18em;
  box-shadow: 0 0 18px #00ffe7, 0 0 8px #ff2d7a;
  text-shadow: 0 0 8px #00ffe7, 0 0 2px #fff;
  position: relative;
  z-index: 2;
  transition: background 0.2s, color 0.2s;
  animation: fadein 1.5s;
}
.entry-date::before {
  content: "🕒 ";
  font-size: 1em;
  color: #ffd700;
  margin-right: 6px;
  filter: drop-shadow(0 0 4px #ffd700);
}
