body {
  background: #fff;
  font-family: Georgia, serif;
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

@keyframes moveDiagonal {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 422px 140px;
  }
}

header {
  width: 100%;
  padding: 0.6em;
  background: #191919;
  color: #fff;
  font-size: 1.1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1.5px 6px #ccc;
  box-sizing: border-box;
  gap: 1em;
}

.header-left,
.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: fit-content;
}

.header-right {
  justify-content: flex-end;
}

.header-favicon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.3s;
  padding-right: 10px;
}

.header-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 1.5em;
  justify-content: center;
}

.header-link {
  text-decoration: none;
  font-size: 0.9em;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.header-link:hover {
  opacity: 0.8;
}

.info-btn {
  background: transparent;
  border: 1.5px solid #fff;
  color: #fff;
  border-radius: 5px;
  font-size: 0.75em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  transition: background 0.2s, transform 0.15s;
  font-weight: bold;
  line-height: 1;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

.share-container {
  position: relative;
  display: flex;
  align-items: center;
}

.copy-toast {
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.7em;
  font-family: sans-serif;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  white-space: nowrap;
  z-index: 100;
}

.copy-toast.show {
  opacity: 1;
}

/* Layout */
.main-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 1200px;
  padding: 0 16px;
  box-sizing: border-box;
  margin-top: 1.6em;
  transition: all 0.3s ease;
}

.about-panel {
  width: 300px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 12px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
  transform: translateX(0);
  margin-right: 0;
  height: fit-content;
  position: relative;
  flex-shrink: 0;
}

.about-panel.closed {
  width: 0;
  opacity: 0;
  margin-right: -20px;
  /* Compensate for grid gap */
  padding: 0;
  transform: translateX(-20px);
  pointer-events: none;
}

.about-content {
  padding: 24px;
  width: 300px;
  /* Force width to prevent reflow */
  box-sizing: border-box;
}

.about-content h3 {
  margin: 0 0 1em;
  color: #191919;
  font-size: 1.2em;
}

.about-content p {
  margin: 0.8em 0;
  line-height: 1.5;
  color: #333;
  font-size: 0.95em;
}

.about-content a {
  color: #191919;
  text-decoration: underline;
  font-weight: 600;
}

.panel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 1.8em;
  color: #999;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.panel-close:hover {
  color: #333;
}

/* Header Right Styles */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.8em;
  flex-shrink: 0;
}

header .creator {
  font-size: 0.85em;
  font-style: italic;
  white-space: nowrap;
  flex-shrink: 0;
}

.donate-btn {
  font-size: 0.85em;
  padding: 5px 12px;
  background: #fff;
  color: #191919;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  font-family: Georgia, serif;
  font-weight: 600;
  white-space: nowrap;
}

.donate-btn:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

.donate-btn:active {
  background: #e0e0e0;
}

main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container {
  flex: 1;
  max-width: 700px;
  width: 100%;
  text-align: center;
  border-radius: 12px;
  box-shadow: 0 2px 12px 3px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.8);
  padding: 26px 16px 20px 16px;
  transition: all 0.3s ease;
}

.game-container::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('graphic.png');
  background-repeat: repeat;
  background-size: 422px 140px;
  animation: moveDiagonal 30s linear infinite;
  opacity: 0.2;
  z-index: 0;
  pointer-events: none;
  display: none;
}

.game-container>* {
  position: relative;
  z-index: 1;
}

.game-container.has-background::before {
  display: block;
}

.story {
  font-size: 1.2em;
  line-height: 1.55;
  color: #181818;
  margin-bottom: 3px;
  word-break: break-word;
}

.first-sentence {
  font-weight: 500;
  display: block;
  margin-bottom: 7px;
}

.censor-block {
  font-style: italic;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  display: inline;
}

.censor-highlight {
  background: #101010;
  color: #101010;
  border-radius: 3px;
  padding: 2px 4px;
  transition: background 0.15s, color 0.15s;
  display: inline;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.upvotes {
  display: block;
  font-size: 14px;
  color: #6c6c4e;
  font-style: italic;
  margin-top: 7px;
  margin-bottom: 1px;
  letter-spacing: 0.1em;
}

.loading {
  font-size: 18px;
  color: #999;
  margin: 1em 0;
}

.selectors {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 15px;
  flex-wrap: wrap;
}

select,
button {
  font-family: inherit;
  padding: 7px 9px;
  font-size: 15px;
  border-radius: 4px;
  border: 1.3px solid #aaa;
  background: #fcfcfc;
  margin-bottom: 0;
}

button {
  font-size: 16px;
  border: none;
  background: #191919;
  color: #fff;
  border-radius: 5px;
  cursor: pointer;
  margin-left: 12px;
  font-family: Georgia, serif;
  transition: background 0.18s, transform 0.15s;
  padding: 7px 18px;
  display: inline-block;
}

button:hover {
  transform: scale(1.06);
}

button:active {
  background: #444;
}

a {
  color: #777;
  text-decoration: none;
  transition: transform 0.15s;
  display: inline-block;
}

a:hover {
  transform: scale(1.05);
}

@media (max-width: 900px) {
  .main-layout {
    flex-direction: column;
    align-items: center;
  }

  .about-panel {
    width: 100%;
    max-width: 700px;
    margin-right: 0;
    margin-bottom: 20px;
  }

  .about-panel.closed {
    margin-bottom: -300px;
    margin-right: 0;
    transform: translateY(-20px);
    opacity: 0;
  }

  .about-content {
    width: 100%;
  }
}

@media (max-width: 500px) {

  .header-left,
  .header-right,
  .header-center {
    flex: 1 1 100%;
    justify-content: center;
    text-align: center;
  }

  header .creator {
    font-size: 0.75em;
  }

  .donate-btn {
    font-size: 0.75em;
    padding: 4px 10px;
  }

  .header-favicon {
    width: 24px;
    height: 24px;
  }

  .header-title {
    font-size: 0.9em;
  }
}