@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&family=Special+Elite&display=swap');

:root {
  --yellow-wall: #c9b87a;
  --yellow-deep: #a8945c;
  --carpet: #d4b96a;
  --light: #f5f0d8;
  --shadow: #2a2518;
  --blood: #6b1a1a;
  --flicker: #e8d9a0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Courier Prime', 'Courier New', monospace;
  background: 
    linear-gradient(180deg, #3d3625 0%, #2a2518 40%, #1a1710 100%);
  color: var(--light);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

/* Film grain / noise overlay */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  animation: noise 0.4s steps(2) infinite;
}

@keyframes noise {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2%, -3%); }
  20% { transform: translate(3%, 1%); }
  30% { transform: translate(-1%, 4%); }
  40% { transform: translate(2%, -2%); }
  50% { transform: translate(-3%, 1%); }
  60% { transform: translate(1%, 3%); }
  70% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 2%); }
  90% { transform: translate(-1%, -3%); }
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.75) 100%);
}

header {
  text-align: center;
  padding: 3rem 1.5rem 1.5rem;
  position: relative;
  z-index: 1;
}

h1 {
  font-family: 'Special Elite', 'Courier New', monospace;
  font-size: clamp(1.8rem, 6vw, 3.2rem);
  letter-spacing: 0.15em;
  color: var(--yellow-wall);
  text-shadow: 
    0 0 20px rgba(201, 184, 122, 0.4),
    2px 2px 0 var(--shadow);
  margin-bottom: 0.5rem;
}

.glitch {
  position: relative;
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.glitch::before {
  color: #ff6b6b;
  z-index: -1;
  animation: glitch-1 3s infinite linear alternate-reverse;
}

.glitch::after {
  color: #6bffb8;
  z-index: -2;
  animation: glitch-2 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
  0%, 90%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
  92% { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 1px); }
  94% { clip-path: inset(50% 0 20% 0); transform: translate(3px, -1px); }
  96% { clip-path: inset(10% 0 70% 0); transform: translate(-2px, 2px); }
}

@keyframes glitch-2 {
  0%, 88%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
  91% { clip-path: inset(60% 0 10% 0); transform: translate(2px, -1px); }
  93% { clip-path: inset(30% 0 40% 0); transform: translate(-3px, 1px); }
  97% { clip-path: inset(80% 0 5% 0); transform: translate(1px, 2px); }
}

.subtitle {
  font-size: 0.95rem;
  color: var(--yellow-deep);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.85;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
  position: relative;
  z-index: 1;
}

.portrait {
  text-align: center;
  margin: 2rem 0 3rem;
}

.frame {
  position: relative;
  display: inline-block;
  border: 4px solid var(--yellow-deep);
  box-shadow: 
    0 0 0 8px var(--shadow),
    0 20px 60px rgba(0,0,0,0.7),
    inset 0 0 40px rgba(0,0,0,0.3);
  background: #1a1710;
  max-width: 100%;
  overflow: hidden;
}

.frame img {
  display: block;
  max-width: 100%;
  height: auto;
  filter: contrast(1.05) saturate(0.9) brightness(0.95);
  transition: filter 0.8s ease;
}

.frame:hover img {
  filter: contrast(1.15) saturate(0.7) brightness(0.85) hue-rotate(-5deg);
}

.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.12) 2px,
    rgba(0,0,0,0.12) 4px
  );
  pointer-events: none;
  animation: scan 8s linear infinite;
}

@keyframes scan {
  0% { background-position: 0 0; }
  100% { background-position: 0 100px; }
}

.caption {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--yellow-deep);
  font-style: italic;
  letter-spacing: 0.05em;
}

.lore {
  background: rgba(42, 37, 24, 0.7);
  border: 1px solid var(--yellow-deep);
  padding: 1.75rem;
  margin-bottom: 3rem;
  position: relative;
}

.lore::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--yellow-wall), transparent);
}

.lore h2 {
  font-family: 'Special Elite', monospace;
  color: var(--yellow-wall);
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
  letter-spacing: 0.08em;
}

.lore-text p {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: #e0d5b8;
}

.lore-text .warning {
  color: #c47a7a;
  border-left: 3px solid var(--blood);
  padding-left: 1rem;
  margin-top: 1.5rem;
  font-weight: 700;
}

.notes-section {
  margin-bottom: 3rem;
}

.notes-section h2 {
  font-family: 'Special Elite', monospace;
  color: var(--yellow-wall);
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.08em;
}

.notes-intro {
  color: var(--yellow-deep);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
}

#note-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

#note-form label {
  font-size: 0.8rem;
  color: var(--yellow-deep);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#note-form input,
#note-form textarea {
  background: rgba(26, 23, 16, 0.9);
  border: 1px solid var(--yellow-deep);
  color: var(--light);
  padding: 0.75rem 1rem;
  font-family: 'Courier Prime', monospace;
  font-size: 1rem;
  border-radius: 0;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

#note-form input:focus,
#note-form textarea:focus {
  border-color: var(--yellow-wall);
  box-shadow: 0 0 12px rgba(201, 184, 122, 0.25);
}

#note-form textarea {
  resize: vertical;
  min-height: 100px;
}

#submit-btn {
  align-self: flex-start;
  background: var(--shadow);
  color: var(--yellow-wall);
  border: 2px solid var(--yellow-wall);
  padding: 0.7rem 1.6rem;
  font-family: 'Special Elite', monospace;
  font-size: 1rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-top: 0.5rem;
}

#submit-btn:hover {
  background: var(--yellow-wall);
  color: var(--shadow);
  box-shadow: 0 0 20px rgba(201, 184, 122, 0.4);
}

#submit-btn:active {
  transform: scale(0.98);
}

#submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  min-height: 1.5rem;
  font-size: 0.9rem;
  color: var(--yellow-deep);
  margin-bottom: 1.5rem;
  font-style: italic;
}

.status.waiting {
  color: #a0c0a0;
  animation: pulse 1.5s ease-in-out infinite;
}

.status.replied {
  color: #c47a7a;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.notes-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.notes-list-header h3 {
  font-family: 'Special Elite', monospace;
  color: var(--yellow-deep);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

.ghost-btn {
  background: transparent;
  border: 1px solid #5a5040;
  color: #8a7a60;
  padding: 0.3rem 0.7rem;
  font-family: 'Courier Prime', monospace;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.ghost-btn:hover {
  border-color: var(--blood);
  color: #c47a7a;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.note-card {
  background: rgba(26, 23, 16, 0.85);
  border: 1px solid #4a4030;
  padding: 1.25rem;
  position: relative;
  animation: fadeIn 0.6s ease;
}

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

.note-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--yellow-deep);
}

.note-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #7a6a50;
  margin-bottom: 0.6rem;
  letter-spacing: 0.03em;
}

.note-author {
  color: var(--yellow-wall);
  font-weight: 700;
}

.note-body {
  color: #d8cdb0;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.reply {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: rgba(60, 20, 20, 0.35);
  border-left: 3px solid var(--blood);
  position: relative;
}

.reply-label {
  font-size: 0.7rem;
  color: #a06060;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.4rem;
}

.reply-text {
  color: #e0b0b0;
  font-size: 0.92rem;
  font-style: italic;
  white-space: pre-wrap;
}

.reply.pending {
  border-left-color: #5a6a50;
  background: rgba(30, 40, 25, 0.3);
}

.reply.pending .reply-label {
  color: #7a8a70;
}

.reply.pending .reply-text {
  color: #9aaa90;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #6a5a40;
  font-style: italic;
  border: 1px dashed #4a4030;
}

footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  color: #5a5040;
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

footer .small {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Subtle light flicker on the whole page occasionally */
body.flicker {
  animation: page-flicker 0.15s ease;
}

@keyframes page-flicker {
  0%, 100% { filter: brightness(1); }
  30% { filter: brightness(0.7); }
  60% { filter: brightness(1.15); }
}

/* Responsive */
@media (max-width: 520px) {
  header {
    padding-top: 2rem;
  }
  .lore {
    padding: 1.25rem;
  }
  #submit-btn {
    width: 100%;
  }
}
