*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #3d0f14;
  color: #1a1a2e;
}

html::-webkit-scrollbar, 
body::-webkit-scrollbar {
  display: none;
}

/* Firefox */
html, body {
  scrollbar-width: none;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transform: scale(1.15) translate(0px, -30px);
}

.logo {
  width: 500px;
  margin-top: -120px;
  z-index: 999;
}

.wc-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: #f0f4fa;
}

/* Home page only: hide chrome text (submit uses .submit-main) */
main:not(.submit-main) > .nav-back,
main:not(.submit-main) > h1 {
  display: none;
}

.hint {
  font-size: 0.875rem;
  color: #555;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.hint code {
  font-size: 0.8125rem;
  background: #e8ecf4;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.nav-back {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.nav-back a {
  color: #a8c4e8;
}

.nav-back a:hover {
  color: #d4e4ff;
}

.submit-main {
  max-width: 36rem;
}

.submit-hint {
  color: #b0b8c8;
}

.submit-hint code {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

#word-form label {
  display: block;
  font-size: 0.9rem;
  color: #c5d0e0;
  margin-bottom: 0.35rem;
}

.form-row {
  margin-bottom: 1rem;
}

.form-row--two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 520px) {
  .form-row--two {
    grid-template-columns: 1fr;
  }
}

.form-field {
  min-width: 0;
}

#word-form input[type="text"],
#word-form input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #f0f4fa;
}

#word-form input[type="text"]:focus,
#word-form input[type="number"]:focus {
  outline: 2px solid rgba(255, 200, 100, 0.45);
  outline-offset: 2px;
}

#word-form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #f0f4fa;
  resize: vertical;
  min-height: 8rem;
}

#word-form textarea:focus {
  outline: 2px solid rgba(255, 200, 100, 0.45);
  outline-offset: 2px;
}

.submit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

#word-form button[type="submit"] {
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(145deg, #ffe082, #e6ac00);
  color: #1a1204;
}

#word-form button[type="submit"]:hover {
  filter: brightness(1.05);
}

.button-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  color: #a8c4e8;
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid rgba(168, 196, 232, 0.4);
}

.button-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #d4e4ff;
}

.form-status {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #f0b0b0;
}

.server-banner {
  background: rgba(255, 180, 80, 0.14);
  border: 1px solid rgba(255, 200, 120, 0.4);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
  color: #ffe8c8;
  font-size: 0.9rem;
  line-height: 1.55;
}

.server-banner strong {
  color: #fff;
}

.server-banner--ok {
  display: none;
}

.server-banner__cmd {
  display: block;
  margin-top: 0.55rem;
  background: rgba(0, 0, 0, 0.28);
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.45;
}

#cloud .setup-error {
  color: #f5d4a6;
  font-size: 0.95rem;
  line-height: 1.55;
  max-width: 32rem;
  white-space: pre-line;
  margin: 0;
}

html.embed,
html.embed body {
  min-height: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  overflow: hidden;
  background: #3d0f14;
}

html.embed main {
  position: relative;
  max-width: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  transform: none;
  justify-content: flex-start;
  align-items: stretch;
  overflow: hidden;
}

html.embed .wc-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 800px;
  height: 640px;
  flex-shrink: 0;
  transform-origin: 0 0;
}

html.embed #cloud {
  transform: none;
}

html.embed .logo {
  display: block;
  position: absolute;
  left: 50%;
  bottom: 0.35rem;
  width: 500px;
  margin: 0;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
}

#cloud {
  position: relative;
  margin: 0 auto;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
}

/* Position + blur/fade-in; inner .word keeps gold text without filter clash */
#cloud .word-slot {
  position: absolute;
  transform: translate(-50%, -50%);
  opacity: 0;
  filter: blur(16px);
  transition: opacity 0.8s ease, filter 0.8s ease;
  pointer-events: none;
}

#cloud .word-slot.word-slot--visible {
  opacity: 1;
  filter: blur(0);
}

#cloud .word-slot .word {
  position: relative;
  display: inline-block;
  white-space: pre-line;
  text-align: center;
  font-family: Georgia, "Times New Roman", Times, "Noto Serif", "Liberation Serif",
    serif;
  font-weight: 600;
  line-height: 1.12;
  user-select: none;
  transform: rotate(var(--rot, 0deg));
  transform-origin: center center;
  /* Bright gold only — no dark brown stops (they dominated when clipped + shimmered) */
  background-image: linear-gradient(
    145deg,
    #fffef5 0%,
    #fff8dc 12%,
    #ffeeb8 28%,
    #ffe566 40%,
    #ffd633 52%,
    #ffc93a 58%,
    #ffe566 72%,
    #fff3c4 88%,
    #f8eba2 100%
  );
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  /* Warm gold tint only — avoid dark brown / near-black shadows */
  filter: drop-shadow(0 -0.5px 0 rgba(255, 255, 255, 0.95))
    drop-shadow(0 0.5px 0 rgba(255, 220, 140, 0.55))
    drop-shadow(0 1.5px 3px rgba(200, 150, 60, 0.22));
  animation:
    drift var(--dur, 5s) ease-in-out infinite,
    gold-shimmer 14s ease-in-out infinite;
  animation-delay: var(--delay, 0s), var(--shimmer-delay, 0s);
  will-change: transform;
}

@keyframes drift {
  0%,
  100% {
    transform: rotate(var(--rot, 0deg)) translate(0, 0);
  }
  50% {
    transform: rotate(var(--rot, 0deg)) translate(3px, -4px);
  }
}

@keyframes gold-shimmer {
  0%,
  100% {
    background-position: 0% 40%;
  }
  50% {
    background-position: 100% 60%;
  }
}

/* —— Admin moderation —— */
main.admin-main {
  max-width: 72rem;
  align-items: stretch;
}

.admin-main {
  margin: 0 auto;
  padding: 1.5rem;
}

.admin-lead {
  color: #b0b8c8;
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
  max-width: 42rem;
}

.admin-lead code {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
}

.admin-subheading {
  font-size: 1rem;
  font-weight: 600;
  color: #f0f4fa;
  margin: 0 0 0.65rem;
}

.admin-panel {
  margin-bottom: 2rem;
}

.admin-hint {
  font-size: 0.82rem;
  color: #8a96a8;
  margin: 0 0 0.65rem;
  line-height: 1.45;
}

.admin-token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.75rem;
  align-items: flex-end;
}

.admin-token-row label {
  width: 100%;
  font-size: 0.9rem;
  color: #c5d0e0;
}

.admin-token-row input[type="password"],
.admin-token-row input[type="text"] {
  flex: 1 1 12rem;
  min-width: 10rem;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #f0f4fa;
}

.admin-token-row input:focus {
  outline: 2px solid rgba(255, 200, 100, 0.45);
  outline-offset: 2px;
}

.admin-btn {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: linear-gradient(145deg, #ffe082, #e6ac00);
  color: #1a1204;
}

.admin-btn:hover {
  filter: brightness(1.05);
}

.admin-btn--secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #e8eef8;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-btn--secondary:hover {
  filter: none;
  background: rgba(255, 255, 255, 0.16);
}

.admin-btn--danger {
  background: linear-gradient(145deg, #f48fb1, #c2185b);
  color: #1a0a10;
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
}

.admin-btn--danger:hover {
  filter: brightness(1.06);
}

.admin-table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.2);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  color: #e2e8f0;
}

.admin-table th,
.admin-table td {
  padding: 0.55rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

.admin-table th {
  color: #a8c4e8;
  font-weight: 600;
  white-space: nowrap;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.admin-cell-word {
  font-weight: 600;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-cell-text {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-cell-nowrap {
  white-space: nowrap;
}

.admin-main .form-status {
  color: #c5e0d0;
  margin-top: 0.75rem;
}

.admin-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.45;
  max-width: 36rem;
}

.admin-toggle input {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: #e6ac00;
  cursor: pointer;
  flex-shrink: 0;
}
