body {
  font-family: Arial, sans-serif;
  text-align: center;
  background-color: #999;
  color: white;
}

form {
  margin-bottom: 20px;
}

form.nav-link {
  display: inline;
  margin: 0;
}

button {
  cursor: pointer;
}

#appTitle {
  color: #666;
  font-size: 2em;
  font-family: "Helvetica Neue", sans-serif;
  position: relative;
  display: inline-block;
  margin-bottom: 0.25rem;
}

#app {
  padding: 10px;
  max-width: 900px;
  margin: 0 auto;
}

#eventForm :is(label, input, textarea) {
  display: block;
  text-align: start;
}

#eventForm {
  max-width: 350px;
  margin: 0 auto;
  background-color: #aaa;
  padding: 1rem;
  box-sizing: border-box;
}

.form-section {
  background-color: #999;
  padding: 0.8rem;
  margin-bottom: 1rem;
  text-align: left;
  box-sizing: border-box;
}

.form-section-header {
  font-family: "Courier New", monospace;
  font-size: 0.85em;
  color: #eceaea;
  margin: 0 0 0.5rem 0;
}

#eventForm :is(#eventDescription) {
  width: 95%;
  text-align: left;
  padding-bottom: 3rem;
}

#eventList {
  padding: 1rem;
  background-color: #aaa;
  align-items: center;
  display: flex;
  flex-direction: column;
}

#eventList :is(p) {
  color: #eceaea;
  margin: 1%;
  align-self: flex-start;
  font-family: "Courier New", monospace;
}

.event-actions {
  display: flex;
  gap: 0.5rem;
  align-self: flex-end;
}

.event-link {
  margin: 0.75rem 0;
}

.event-link a {
  color: #f0efef;
  text-decoration: underline;
  word-break: break-word; /* long URLs wrap instead of overflowing the card */
}

#eventList :is(h4) {
  color: #f0efef;
  margin: 1%;
  align-self: flex-start;
}

.event-image {
  max-width: 350px;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.event-image[hidden] {
  display: none;
}

#event .event-image {
  cursor: pointer;
}

.image-dialog {
  position: relative;
  border: none;
  padding: 0;
  background: transparent;
  max-width: 90vw;
  max-height: 90vh;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.image-dialog img {
  display: block;
  width: 90vw;
  height: 90vh;
  object-fit: contain;
}

.image-dialog-close {
  position: absolute;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #f0efef;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.image-dialog-close:focus-visible {
  outline: 2px solid #f0efef;
  outline-offset: -4px;
}

#eventList .event-image {
  margin-bottom: 3%;
  cursor: pointer;
}

.event-item {
  margin-bottom: 1rem;
  border: 2px solid #333;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  -ms-flex-align: center;
  max-width: 350px;
  width: 100%;
  min-height: 0;
}

.event-header {
  background-color: #666;
  padding: 0.4rem 0.8rem;
}

.event-body {
  background-color: #999;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.event-title {
  font-size: 1.5em;
  margin: 0;
  cursor: pointer;
}

.description {
  min-height: 6rem;
  width: 100%;
  box-sizing: border-box;
}

.form-error {
  color: red;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.required-asterisk {
  color: red;
}

.required-note {
  font-size: 0.8em;
  color: #333;
}

#event {
  max-width: 350px;
  margin: 0 auto;
  text-align: left;
}

#event h1 {
  text-align: center;
}

#editButton:not([hidden]) {
  display: block;
  margin-left: auto; /* right-align the edit button */
}

#backLink {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.9rem; /* larger tap target for mobile */
  border: 1px solid #333;
  background-color: #ccc;
  color: black;
  text-decoration: none;
}

#cancelButton {
  margin-left: 0.5rem;
}

#headerImage {
  position: absolute;
  top: 0;
  right: -3.5rem;
  width: 4.5rem;
  z-index: -1;
}

#footerImage {
  width: 5rem;
  height: auto;
}

/* hit counter as a split-flap airport board: black tiles, white digits */
#visitorCount {
  display: block;
  width: fit-content;
  margin: 1rem auto;
  text-align: center;
  font-family: "Courier New", monospace;
}

.counter-board {
  display: inline-flex;
  gap: 2px;
}

.counter-tile {
  min-width: 1ch;
  padding: 0.12rem 0.2rem;
  color: #fff;
  font-weight: bold;
  font-size: 0.7rem;
  background-color: #333;
}

.event-meta {
  font-family: "Courier New", monospace;
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  padding: 0.5rem 0;
  margin: 0.5rem 0;
  color: #eceaea;
  font-size: 0.9em;
}

.event-meta p {
  margin: 0.2rem 0;
}

/* preserve line breaks + runs of spaces the user typed in the description,
   while still wrapping long lines. .textContent stays, so no XSS risk. */
#description {
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* username colors — keep in sync with COLOR_CLASSES in public/js/usernameColor.js */
.uc-aqua {
  color: aqua;
}
.uc-black {
  color: black;
}
.uc-blue {
  color: blue;
}
.uc-fuchsia {
  color: fuchsia;
}
.uc-gray {
  color: gray;
}
.uc-green {
  color: green;
}
.uc-lime {
  color: lime;
}
.uc-maroon {
  color: maroon;
}
.uc-navy {
  color: navy;
}
.uc-olive {
  color: olive;
}
.uc-purple {
  color: purple;
}
.uc-red {
  color: red;
}
.uc-silver {
  color: silver;
}
.uc-teal {
  color: teal;
}
.uc-white {
  color: white;
}
.uc-yellow {
  color: yellow;
}

/* comments */
#comments {
  margin-top: 1.5rem;
  padding: 1rem;
  background-color: #aaa; /* lighter container, matches #eventList */
}

#comments h2 {
  margin-top: 0;
  font-size: 1.2em;
  color: #f0efef;
}

#commentList {
  list-style: none; /* removes the native bullet dot */
  padding: 0;
  margin: 0;
}

.comment {
  background-color: #999; /* darker box, matches .event-item */
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.6rem;
  display: flex;
  flex-direction: column;
}

.comment-meta {
  font-family: "Courier New", monospace;
  font-size: 0.85em;
  color: #eceaea;
  margin: 0 0 0.3rem 0;
}

.comment-body {
  margin: 0;
  color: white;
  word-wrap: break-word; /* long unbroken text can't overflow the box */
}

.comment button {
  margin-top: 0.4rem;
  font-size: 0.8em;
  align-self: flex-end; /* right-align the delete button */
}

.comment-name-unclaimed {
  color: #555; /* muted relative to a colored username, but still readable against the #999 comment background — "anyone could have typed this" */
}

#commentForm {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* right-align the Post button */
}

#anonymousFields {
  align-self: stretch;
}

.comment-form-links {
  text-align: left;
  margin: 0.4rem 0;
  font-size: 0.85em;
  color: #333;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #f0efef; /* matches .event-link a */
  text-decoration: underline;
  cursor: pointer;
}

#commentForm textarea {
  width: 100%;
  box-sizing: border-box; /* padding doesn't push it past 100% width */
  min-height: 3rem;
  font-family: inherit;
  align-self: stretch; /* stay full-width despite form's flex-end alignment */
}

#commentError {
  color: red;
}
