html,
body {
  min-height: 100%;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 18px 8px;
  color: #000;
  font-family: "Times New Roman", Times, serif;
  font-size: 16px;
  background-color: #808080;
  background-image:
    linear-gradient(45deg, #707070 25%, transparent 25%),
    linear-gradient(-45deg, #707070 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #707070 75%),
    linear-gradient(-45deg, transparent 75%, #707070 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

center {
  display: block;
}

a {
  color: #0000ee;
  text-decoration: underline;
}

.page-table {
  width: min(1060px, calc(100vw - 32px));
  max-width: 100%;
  table-layout: fixed;
  border-color: #ffffff #333333 #333333 #ffffff;
  background: #c0c0c0;
}

.page-table > tbody > tr > td {
  padding: 7px;
}

.form-col {
  width: 34%;
}

.result-col {
  width: 66%;
}

.masthead {
  text-align: center;
  background: #ffffcc;
}

h1 {
  margin: 0;
  color: #000080;
  font-size: 36px;
  line-height: 1;
  text-decoration: underline;
}

.tagline {
  margin: 3px 0 7px;
  color: #800000;
  font-weight: bold;
}

marquee {
  display: block;
  padding: 3px;
  color: #ffff00;
  background: #000080;
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
}

.badges {
  text-align: center;
  background: #ffffff;
}

.button88,
.counter {
  display: inline-block;
  margin: 2px;
  padding: 3px 8px;
  border: 2px outset #fff;
  color: #000;
  background: #ffcc00;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: bold;
}

.counter {
  color: #00ff00;
  background: #000;
}

.box {
  border: 2px inset #fff;
  background: #eeeeee;
}

.form-box {
  background: #e0e0e0;
}

.form-box table {
  table-layout: fixed;
}

.result-box {
  text-align: center;
  background: #ffffff;
}

.result-grid {
  display: block;
}

input,
select,
button {
  width: 100%;
  box-sizing: border-box;
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
}

input,
select {
  border: 2px inset #fff;
  padding: 4px;
  color: #000080;
  background: #ffffcc;
  font-weight: bold;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #000080 50%),
    linear-gradient(135deg, #000080 50%, transparent 50%),
    linear-gradient(to right, #c0c0c0, #c0c0c0);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%,
    100% 0;
  background-size:
    5px 5px,
    5px 5px,
    28px 100%;
  background-repeat: no-repeat;
  padding-right: 32px;
}

#period {
  padding-right: 24px;
  background-position:
    calc(100% - 13px) 50%,
    calc(100% - 8px) 50%,
    100% 0;
  background-size:
    5px 5px,
    5px 5px,
    24px 100%;
}

button {
  border: 3px outset #fff;
  padding: 5px;
  color: #000080;
  background: #ffff00;
  font-weight: bold;
  cursor: pointer;
}

button:active {
  border-style: inset;
}

.small,
.small-title,
.footer {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
}

.small-title {
  margin: 0 0 5px;
  color: #800080;
  font-weight: bold;
}

.percent {
  margin: 0 auto 6px;
  border: 3px inset #fff;
  padding: 7px 4px;
  color: #00ff00;
  background: #000;
  font-family: "Courier New", Courier, monospace;
  font-size: 34px;
  font-weight: bold;
}

.meter {
  height: 16px;
  margin: 8px 0;
  border: 2px inset #fff;
  background: #ff0000;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: #00ff00;
}

.stats {
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  text-align: left;
  background: #f8f8f8;
}

.stats td:last-child {
  text-align: right;
  font-weight: bold;
}

.reaction-box {
  margin: 8px auto 0;
  border: 2px inset #fff;
  padding: 5px;
  background: #c0c0c0;
  text-align: center;
}

.reaction-gif {
  display: block;
  width: 170px;
  max-width: 100%;
  max-height: 115px;
  margin: 0 auto;
  border: 3px inset #fff;
  object-fit: contain;
  image-rendering: pixelated;
  background: #000;
}

@media (min-width: 900px) {
  .result-grid {
    display: grid;
    grid-template-columns: minmax(245px, 0.72fr) minmax(420px, 1.28fr);
    align-items: start;
    gap: 8px;
  }

  .reaction-box {
    margin: 0;
    min-height: 338px;
  }

  .reaction-box .small-title {
    margin: 0 0 6px;
    text-align: center;
  }

  .reaction-gif {
    width: 100%;
    height: clamp(240px, 24vw, 300px);
    max-height: none;
  }
}

.footer {
  text-align: center;
  background: #ffffcc;
}

.blink {
  animation: blink 0.8s steps(2) infinite;
}

@keyframes blink {
  50% {
    visibility: hidden;
  }
}

@media (max-width: 640px) {
  body {
    padding: 6px;
    font-size: 14px;
  }

  .page-table {
    width: calc(100vw - 12px);
    max-width: 430px;
    border-width: 2px;
  }

  .page-table > colgroup,
  .page-table > colgroup > col {
    display: none;
  }

  .page-table > tbody,
  .page-table > tbody > tr {
    display: block;
    width: 100%;
  }

  .page-table > tbody > tr > td {
    display: block;
    width: auto !important;
    box-sizing: border-box;
  }

  .masthead,
  .badges,
  .box,
  .footer {
    padding: 6px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.05;
  }

  .tagline {
    font-size: 14px;
  }

  marquee {
    font-size: 13px;
  }

  .button88,
  .counter {
    margin: 2px 1px;
    padding: 3px 6px;
    font-size: 11px;
  }

  .counter {
    max-width: 100%;
    overflow: hidden;
  }

  .form-box table {
    table-layout: auto;
  }

  .form-box form table td {
    display: table-cell;
    width: 50%;
    box-sizing: border-box;
  }

  .form-box form table td[colspan="2"] {
    width: 100%;
  }

  input,
  select,
  button {
    min-height: 30px;
    font-size: 15px;
  }

  .percent {
    font-size: 32px;
    padding: 6px 4px;
  }

  .stats {
    table-layout: fixed;
    font-size: 12px;
  }

  .stats td {
    overflow-wrap: anywhere;
  }

  .reaction-box {
    max-width: 210px;
  }

  .reaction-gif {
    width: 160px;
    max-height: 110px;
  }

  .footer {
    overflow-wrap: anywhere;
  }
}
