/* Modeled on https://nicholasfiete.com/static/style.css */

:root {
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-bg: #2d2d2d;
  }

  body {
    background: #2d2d2d;
    color: #ffffff;
  }

  a,
  button.link {
    color: #00FF00;
  }

  a:hover,
  button.link:hover {
    color: #009900;
  }

  .page_title {
    border-bottom: double white;
  }

  button:hover {
    background: #fff;
    color: #2d2d2d;
  }

  input[type="text"],
  select {
    background: #2d2d2d;
  }

  .error {
    border-left-color: #ff6666;
  }
}

@media (prefers-color-scheme: light) {
  body {
    color: #080808;
    background: #fff;
  }

  a,
  button.link {
    color: #06c;
  }

  a:hover,
  button.link:hover {
    color: #000000;
  }

  button:hover {
    background: #080808;
    color: #fff;
  }

  input[type="text"],
  select {
    background: #fff;
  }

  .error {
    border-left-color: #c00;
  }
}

body {
  max-width: 40em;
  margin: 1em auto;
  padding: 1rem;
  font: 1.2em/1.5 sans-serif;
}

code {
  overflow-wrap: anywhere;
}

table {
  border-collapse: collapse;
  border: 3px solid;
}

tr td {
  border: 1px solid;
  padding: 5px;
}

th {
  border: 1px solid;
  padding: 5px;
}

.page_title {
  text-align: center;
  font-size: 1.75rem;
  border-bottom: dashed;
  overflow-wrap: anywhere;
}


/* Forms */

input[type="text"],
select,
button {
  font: inherit;
  color: inherit;
}

input[type="text"] {
  box-sizing: border-box;
  width: 100%;
  max-width: 25em;
  padding: 0.2rem 0.4rem;
  border: 1px solid;
}

select {
  padding: 0.1rem 0.2rem;
  border: 1px solid;
}

input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  vertical-align: middle;
}

button {
  background: transparent;
  border: 2px solid;
  padding: 0.2rem 0.8rem;
  cursor: pointer;
}

button.link {
  border: none;
  padding: 0;
  font-size: 0.8em;
  text-decoration: underline;
  background: transparent;
}

button.link:hover {
  background: transparent;
}

form.inline {
  display: inline;
}

.add_option {
  display: flex;
  gap: 0.5rem;
  margin: 1em 0;
}

.add_option input[type="text"] {
  max-width: none;
  flex: 1;
}


/* Vote pages */

.steps {
  text-align: center;
}

.steps .current {
  font-weight: bold;
  border-bottom: 2px solid;
}

.steps .past,
.steps .sep,
.muted {
  opacity: 0.7;
}

.error {
  border-left: 5px solid;
  padding: 0 1rem;
}

ul.plain {
  list-style: none;
  padding-left: 0;
}

ul.plain li {
  margin: 0.4em 0;
}

/* The winner sits in a box with a spinning rainbow border and a soft
   rainbow glow behind it. */

@property --winner-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: true;
}

/* The winner box with a dancing duck on each side. */
.winner_row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
}

.winner_box {
  position: relative;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 5px;
  border-radius: 16px;
  background: conic-gradient(from var(--winner-angle), #ff3b3b, #ff9f1a, #ffe81a, #3ddc5a, #1ac8ff, #5a5cff, #d23cff, #ff3b3b);
  animation: winner-spin 4s linear infinite;
}

/* The glow: the same rainbow, blurred, behind the box. */
.winner_box::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: -1;
  border-radius: inherit;
  background: inherit;
  filter: blur(24px);
  opacity: 0.9;
}

.winner {
  margin: 0;
  padding: 0.75rem 2rem;
  border-radius: 11px;
  background: var(--page-bg, #fff);
  text-align: center;
  font-size: 1.75rem;
  font-weight: bold;
  overflow-wrap: anywhere;
}

@keyframes winner-spin {
  to {
    --winner-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .winner_box {
    animation: none;
  }
}

.table_wrap {
  overflow-x: auto;
}

.matrix td {
  text-align: center;
}

.matrix td.win {
  font-weight: bold;
}


/* Voting systems and ratings */

input[type="radio"] {
  width: 1.1em;
  height: 1.1em;
  vertical-align: middle;
}

fieldset {
  border: 1px solid;
  margin: 1em 0;
  padding: 0.5rem 1rem;
}

legend {
  padding: 0 0.3rem;
  font-weight: bold;
  overflow-wrap: anywhere;
}

.systems .system_info {
  margin: 0 0 1em 1.6em;
  font-size: 0.9em;
}

.systems .system_info p {
  margin: 0.4em 0;
}

.levels dt {
  font-weight: bold;
}

.levels dd {
  margin: 0 0 0.6em 1em;
}

fieldset.rating {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.2rem;
}

fieldset.rating label {
  white-space: nowrap;
}

.scores td.num {
  text-align: center;
}

.level {
  font-size: 1.3em;
  line-height: 1;
}

details.systems summary {
  cursor: pointer;
}

.hint {
  font-size: 0.8em;
}

.bonus {
  border-left: 5px solid;
  padding: 0 1rem;
}


/* Dancing ducks. The whole duck bobs and sways while its head nods, its
   wing flaps and its feet step in time. */

.duck {
  flex: none;
  width: 64px;
  height: 64px;
}

.duck svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.duck_right svg {
  transform: scaleX(-1);
}

.duck_dance,
.duck_head,
.duck_wing,
.duck_foot {
  transform-box: fill-box;
}

.duck_dance {
  transform-origin: 50% 100%;
  animation: duck-dance 0.8s ease-in-out infinite;
}

.duck_head {
  transform-origin: 20% 90%;
  animation: duck-nod 0.4s ease-in-out infinite alternate;
}

.duck_wing {
  transform-origin: 90% 30%;
  animation: duck-flap 0.2s ease-in-out infinite alternate;
}

.duck_foot {
  animation: duck-step 0.4s ease-in-out infinite alternate;
}

.duck_foot_front {
  animation-delay: -0.4s;
}

@keyframes duck-dance {
  0%, 100% {
    transform: translateY(0) rotate(-8deg);
  }
  25% {
    transform: translateY(-7px) rotate(0deg);
  }
  50% {
    transform: translateY(0) rotate(8deg);
  }
  75% {
    transform: translateY(-7px) rotate(0deg);
  }
}

@keyframes duck-nod {
  from {
    transform: rotate(-6deg);
  }
  to {
    transform: rotate(8deg);
  }
}

@keyframes duck-flap {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-30deg);
  }
}

@keyframes duck-step {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-4px);
  }
}

@media (max-width: 30em) {
  .winner_row {
    gap: 0.4rem;
  }

  .duck {
    width: 40px;
    height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .duck_dance,
  .duck_head,
  .duck_wing,
  .duck_foot {
    animation: none;
  }
}
