@keyframes glow {
  from {
    border-color: #0f0;
  }
  to {
    border-color: transparent;
  }
}

:root {
  --bg: #000;
  --panel: rgba(0, 20, 0, 0.55);
  --text: #00aa00;
  --bright: #00ff00;
  --dim: #0b4d0b;
  --danger: #ff4d4d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(circle at top, #032003 0%, #000 58%);
  color: var(--text);
  font-family: monospace;
  line-height: 1.4;
}

body::after {
  content: " ";
  display: block;
  height: 100vh;
  width: 100vw;
  position: fixed;
  left: 0;
  top: 0;
  background: linear-gradient(#000700 50%, #777 50%);
  background-size: 100% 2px;
  background-repeat: repeat;
  opacity: 0.18;
  z-index: 999999;
  pointer-events: none;
}

.contact-main,
.guestbook-shell {
  width: 100%;
}

.guestbook-shell {
  width: min(920px, calc(100vw - 32px));
  margin: 120px auto 48px;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--dim);
  box-shadow: inset 0 0 20px rgba(0, 255, 0, 0.04), 0 0 24px rgba(0, 255, 0, 0.04);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
  position: relative;
}

.panel:hover {
  animation: 500ms linear infinite alternate glow;
}

.panel:hover::before,
.panel:hover::after,
.message:hover::before,
.message:hover::after {
  content: " ";
  position: absolute;
  top: -2px;
  height: calc(100% + 2px);
  width: 6px;
  border-color: inherit;
  pointer-events: none;
}

.panel:hover::before,
.message:hover::before {
  left: 0;
  border-top: solid 2px #0f0;
  border-bottom: solid 2px #0f0;
  border-left: solid 2px #0f0;
  filter: drop-shadow(0 0 2px #0f0);
}

.panel:hover::after,
.message:hover::after {
  right: 0;
  border-top: solid 2px #0f0;
  border-bottom: solid 2px #0f0;
  border-right: solid 2px #0f0;
  filter: drop-shadow(0 0 5px #0f0);
}

.kicker,
.panel-title,
.small-note,
.message-time,
#status,
#char-count {
  color: var(--bright);
  text-shadow: 0 0 3px var(--bright);
}

.kicker,
.panel-title {
  font-weight: bold;
  letter-spacing: 0.06em;
}

.hero h1 {
  margin: 6px 0 10px;
  color: var(--bright);
  text-shadow: 0 0 4px var(--bright);
}

.intro,
.small-note {
  margin: 0.3rem 0;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: var(--bright);
}

.guestbook-message-box {
  position: relative;
}

input,
textarea,
.guestbook-form button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  background: #000;
  color: var(--bright);
  border: 1px solid var(--dim);
  border-radius: 8px;
  outline: none;
  padding: 12px;
  resize: vertical;
}

textarea {
  min-height: 140px;
  padding-right: 64px;
}

input:focus,
textarea:focus {
  border-color: var(--bright);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.12);
}

textarea::placeholder,
input::placeholder {
  color: #0b650b;
}

.guestbook-form button[type="submit"],
.sticker-toggle {
  background: transparent;
  color: var(--bright);
  border: 1px solid var(--bright);
  border-radius: 999px;
  cursor: pointer;
}

.guestbook-form button[type="submit"] {
  padding: 10px 14px;
}

.sticker-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  min-width: 40px;
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sticker-panel {
  position: absolute;
  right: 12px;
  bottom: 52px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, 44px);
  gap: 8px;
  justify-content: start;
  width: auto;
  max-width: calc(100% - 24px);
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px;
  border: 1px solid rgba(0, 255, 0, 0.28);
  border-radius: 10px;
  background: rgba(0, 10, 0, 0.95);
  box-shadow: 0 0 18px rgba(0, 255, 0, 0.08);
}

.sticker-panel[hidden] {
  display: none !important;
}

.sticker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 0, 0.2);
  background: rgba(0, 0, 0, 0.4);
  box-sizing: border-box;
}

.sticker-item img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  pointer-events: none;
}

.sticker-item:hover {
  border-color: var(--bright);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.12);
}

.guestbook-form button[type="submit"]:hover,
.sticker-toggle:hover {
  text-shadow: 0 0 5px var(--bright);
  box-shadow: 0 0 12px rgba(0, 255, 0, 0.1);
}

.form-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

#status {
  min-height: 1.4em;
  margin-top: 10px;
}

#status.error {
  color: var(--danger);
  text-shadow: 0 0 3px var(--danger);
}

.messages {
  display: grid;
  gap: 12px;
}

.message {
  position: relative;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.68);
  padding: 14px;
  color: var(--text);
  text-shadow: 1px 1px 3px #0a0;
}

.message:hover {
  animation: 500ms linear infinite alternate glow;
}

.message-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.message-name {
  color: var(--bright);
  font-weight: bold;
  text-shadow: 0 0 3px var(--bright);
  max-width: 45%;
  overflow-wrap: anywhere;
}

.message-time {
  font-size: 0.9rem;
  opacity: 0.9;
}

.message-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-state {
  color: var(--bright);
  opacity: 0.8;
}

.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.guestbook-honeypot {
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.message-sticker {
  width: 32px;
  height: 32px;
  object-fit: contain;
  vertical-align: middle;
  margin: 0 3px;
  image-rendering: auto;
}

@media (max-width: 640px) {
  .guestbook-shell {
    width: min(100vw - 16px, 920px);
    margin: 96px auto 28px;
  }

  .panel {
    padding: 14px;
    border-radius: 8px;
  }

  .form-meta,
  .message-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .guestbook-form button[type="submit"] {
    width: 100%;
  }

  .sticker-toggle {
    right: 10px;
    bottom: 10px;
    width: auto;
    min-width: 38px;
    height: 30px;
    padding: 0 9px;
  }

  .sticker-panel {
    right: 8px;
    bottom: 40px;
    grid-template-columns: repeat(4, 40px);
    gap: 8px;
    max-width: calc(100% - 16px);
    max-height: 160px;
    padding: 8px;
  }

  .sticker-item {
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 4px;
  }

  .sticker-item img {
    width: 24px;
    height: 24px;
  }
}
