:root {
  /* the dino's dusk palette: night, slate-violet, mauve, peach, warm, paper */
  --bg: #292b47;
  --fg: #eceae3;
  --dim: #8d8aa6;
  --line: #3f4168;
  --box: #23243d;
  --accent: #f5a885;
  --mauve: #b37385;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

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

html { background: var(--bg); color: var(--fg); font: 15px/1.7 var(--mono); -webkit-text-size-adjust: 100%; }
body { margin: 0; }
main {
  min-height: 100vh; max-width: 38rem; margin: 0 auto; padding: 4rem 1.25rem 11rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
p { margin: 0 0 1rem; }
a { color: inherit; }
::selection { background: var(--mauve); color: var(--fg); }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }
.dim { color: var(--dim); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* title: the ASCII logo (same one as the welcome email). It fills exactly the width of the text
   column below it: the font size is the column width divided by the logo's width in characters
   (68 columns × 0.6em per monospace character = 40.8em). */
.title, .copy { width: 100%; max-width: 36rem; }
.title { margin: 0 0 2.5rem; font-weight: 400; line-height: 0; container-type: inline-size; }
.title pre {
  margin: 0; text-align: left; color: var(--fg);
  font: 400 calc(100cqw / 40.8) / 1.15 var(--mono);
  text-shadow: 1px 1px 0 var(--mauve), 2px 2px 0 #545480;
}
.title:hover pre { animation: flicker .5s steps(2) 1; }
@keyframes flicker { 25% { opacity: .6; } 50% { opacity: 1; } 75% { opacity: .75; } }

.tag { color: var(--dim); margin-bottom: 2.5rem; }
.big { font-size: 1.4rem; margin-bottom: .5rem; }
/* homepage text: plain terminal output, left-aligned */
.copy { text-align: left; color: #cbc8d9; margin-bottom: 2.5rem; }
.copy p { margin-bottom: .7rem; }
.cursor { display: inline-block; width: .6em; height: 1.15em; margin-left: 1px; vertical-align: text-bottom; background: var(--fg); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.crumb { color: var(--dim); margin-bottom: 2.5rem; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--fg); }

/* the matetra-style command box */
.box {
  display: inline-block; font: inherit; color: var(--fg); text-decoration: none; cursor: pointer;
  background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: .55rem 1rem;
  transition: border-color .15s;
}
.box:hover { border-color: var(--mauve); }

/* connect → conquer */
.scramble { color: var(--fg); border-bottom: 1px dashed var(--dim); cursor: default; }
.scramble.is-conquer { color: var(--accent); border-color: var(--accent); }

/* evil definition */
.def { position: relative; display: inline-block; }
.def-term { font: inherit; color: var(--fg); background: none; border: 0; border-bottom: 1px dashed var(--dim); padding: 0; cursor: help; }
.def-card {
  position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 10;
  transform: translateX(calc(-50% + var(--shift, 0px)));
  white-space: nowrap; font-size: .85rem; color: var(--fg); text-align: left;
  background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem;
  opacity: 0; visibility: hidden; transition: opacity .12s, visibility 0s .12s;
}
.def-card i { color: var(--dim); }
.def:hover .def-card, .def:focus-within .def-card, .def.open .def-card { opacity: 1; visibility: visible; transition-delay: 0s; }

/* form */
.evil-form { width: 100%; text-align: left; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 30rem) { .row { grid-template-columns: 1fr; } }
.field { margin: 0 0 1.4rem; border: 0; padding: 0; min-width: 0; }
.field label, .field legend { display: block; color: var(--dim); margin-bottom: .35rem; padding: 0; }
.evil-form input[type=text], .evil-form input[type=email], .evil-form input[type=date] {
  width: 100%; font: inherit; color: var(--fg); background: var(--box);
  border: 1px solid var(--line); border-radius: 6px; padding: .55rem .75rem; color-scheme: dark;
}
.evil-form input:focus { outline: none; border-color: var(--mauve); }
.evil-form input[aria-invalid=true] { border-color: var(--accent); }
.err { color: var(--accent); font-size: .85rem; margin: .3rem 0 0; }
p.err[role=alert] { margin-bottom: 1.5rem; }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.rank-item {
  display: grid; grid-template-columns: 1.5rem 1fr auto auto; gap: .4rem; align-items: center;
  background: var(--box); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .4rem .3rem .75rem;
  user-select: none;
}
.rank-item.dragging { border-color: var(--mauve); opacity: .6; }
.rank-btn {
  font: inherit; color: var(--fg); background: none; border: 1px solid var(--line); border-radius: 4px;
  width: 2rem; height: 2rem; cursor: pointer;
}
.rank-btn:hover:not(:disabled) { border-color: var(--mauve); }
.rank-btn:disabled { opacity: .25; cursor: default; }

.evil-name { display: block; color: var(--accent); margin-top: .15rem; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 1.6rem; background: transparent; margin: 0; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 1px; background: var(--line); }
input[type=range]::-moz-range-track { height: 1px; background: var(--line); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; background: var(--fg); border: 0; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--fg); border: 0; }
.ends { display: flex; justify-content: space-between; font-size: .8rem; margin: 0; }
.evil-form .box { margin-top: .6rem; }

/* admin */
.page-admin main { max-width: 64rem; justify-content: flex-start; }
.admin-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; margin-bottom: 2rem; color: var(--dim); }
.admin-nav a { color: var(--fg); text-decoration: none; }
.admin-nav a:hover { color: var(--accent); }
.admin-nav form { margin-left: auto; }
.admin-stats { color: var(--dim); }
.admin-stats b { color: var(--fg); font-weight: 400; }
.admin-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; align-items: center; margin: 1rem 0; }
.admin-actions.left { justify-content: flex-start; }
.admin-actions form { margin: 0; }
.admin-form { width: 100%; max-width: 40rem; text-align: left; margin-bottom: 2.5rem; }
.admin-h { font-size: 1rem; font-weight: 400; margin: 1.8rem 0 .8rem; }
.admin-h .small { font-size: .8rem; text-decoration: none; margin-left: .4rem; }
.evil-form textarea {
  width: 100%; font: inherit; font-size: .9rem; line-height: 1.6; color: var(--fg); background: var(--box);
  border: 1px solid var(--line); border-radius: 6px; padding: .6rem .75rem; resize: vertical;
}
.evil-form textarea:focus { outline: none; border-color: var(--mauve); }
.ok { color: var(--accent); }
.box.danger { border-color: var(--mauve); }
.box.danger:hover { border-color: var(--accent); color: var(--accent); }
.email-frame { display: block; width: 100%; height: 34rem; border: 1px solid var(--line); border-radius: 6px; background: #292b47; margin: 1rem 0; }
.recipients { margin: 0; padding-left: 2rem; font-size: .85rem; }
.sent-list { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.sent-list li { margin-bottom: .3rem; }
.sent-list a { color: var(--fg); }
.table-scroll { width: 100%; overflow-x: auto; margin-top: 1.5rem; text-align: left; }
.admin-table { border-collapse: collapse; font-size: .8rem; min-width: 72rem; width: 100%; }
.admin-table th, .admin-table td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--dim); font-weight: 400; text-align: left; }
.admin-table a { color: var(--fg); text-decoration: none; }
.admin-table a:hover { color: var(--accent); }
.admin-table td.long { min-width: 14rem; max-width: 22rem; white-space: pre-wrap; }

/* ambient: fire + axolotl */
#fire {
  position: fixed; left: 0; bottom: 0; width: 100%; height: 96px; z-index: 5; pointer-events: none;
  image-rendering: pixelated; opacity: .85;
  -webkit-mask-image: linear-gradient(to top, #000 50%, transparent); mask-image: linear-gradient(to top, #000 50%, transparent);
}
.axolotl {
  position: fixed; left: 0; bottom: 22px; z-index: 6; background: none; border: 0; padding: 0;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.axolotl.held { cursor: grabbing; z-index: 30; }
.axolotl canvas { display: block; image-rendering: pixelated; transition: transform .12s; transform-origin: 50% 100%; }
.axolotl.land canvas { transform: scale(1.08, .86); }

/* konami sticker */
.sticker-pop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(21, 22, 42, .85); }
.sticker-card {
  background: var(--box); border: 1px solid var(--line); border-radius: 8px; padding: 1.5rem 2rem; text-align: center;
  animation: pop .35s cubic-bezier(.2, 1.3, .4, 1) both;
}
.sticker-card canvas { display: block; width: 240px; height: auto; margin: 0 auto .5rem; image-rendering: pixelated; }
.sticker-card p { margin: 0 0 1rem; }
@keyframes pop { from { transform: scale(.85) rotate(-4deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; image-rendering: pixelated; }
main { position: relative; z-index: 1; }

.contact { margin: 1.6rem 0 0; font-size: .8rem; }
.contact a, .tag a { color: var(--dim); text-decoration: none; border-bottom: 1px dashed var(--line); }
.contact a:hover, .tag a:hover { color: var(--accent); border-color: var(--accent); }

.login-form { max-width: 20rem; }
.evil-form input[type=password] {
  width: 100%; font: inherit; color: var(--fg); background: var(--box);
  border: 1px solid var(--line); border-radius: 6px; padding: .55rem .75rem;
}
.admin-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin: 0 0 1rem; }
.logout { font: inherit; font-size: .8rem; color: var(--dim); background: none; border: 0; cursor: pointer; }
.logout:hover { color: var(--accent); }

/* phones and touch screens */
@media (max-width: 40rem) {
  /* iOS zooms into any field with text under 16px; keep them at 16px */
  .evil-form input[type=text], .evil-form input[type=email], .evil-form input[type=date],
  .evil-form input[type=password], .evil-form textarea { font-size: 16px; }
}
@media (pointer: coarse) {
  .rank-btn { width: 2.75rem; height: 2.75rem; }
  input[type=range] { height: 2.75rem; }
  input[type=range]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -13px; }
  input[type=range]::-moz-range-thumb { width: 26px; height: 26px; }
  .contact a { display: inline-block; padding: .6rem .2rem; }
  .box { padding: .75rem 1.1rem; }
}
