:root {
  --hot-pink: #ec407a;
  --pastel-pink: #ffbfd5;
  --uh-oh-red: #b74141;
  --caution-orange: #ff6f00;
  --notice-orange: #ffe2bd;
  --kelly-green: #43a047;
  --dark-cyan: #039be5;
  --pastel-cyan: #81f7ff;
  --mystery-purple: #9b59ec;
  --silver: #b4c7c7;
  --dull-gray: #515151;

  --last-row: var(--hot-pink);
  --this-row: var(--dull-gray);
  --next-row: var(--dark-cyan);
}

@property --spot-color {
  syntax: '<color>';
  initial-value: red;
  inherits: true;
}

.flexH {
  display: flex;
  flex-direction: row;
}

.flexV {
  display: flex;
  flex-direction: column;
}

.flexGrow {
  flex: 1 1 0;
}

.gapped {
  gap: 0.5rem;
}

.alignR {
  text-align: right;
}

.emoji {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

html {
  --w: 24;
  --h: 38;
  background: lightgray;
  font-size: min(100vw / var(--w), 100svh / var(--h));
}

@font-face {
  font-family: "_stampatello_faceto";
  src: url("./stampatello-faceto.otf");
}

@font-face {
  font-family: "_banter_triline";
  src: url("./bantershaviantriline.otf");
}

body {
  --font-text: "_stampatello_faceto", sans-serif;
  --font-display: "_banter_triline", sans-serif;
  font-family: var(--font-text);
  margin: auto;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

section {
  position: relative;
  width: calc(1rem * var(--w));
  height: calc(1rem * var(--h));
}

section:not(.active) {
  display: none;
}

dialog {
  box-sizing: border-box;
  width: calc(1rem * (var(--w) - 3));
  max-height: calc(1rem * (var(--h) - 3));
  border-radius: 0.5rem;
  border: none;
  box-shadow: 0 0.125rem 1rem rgba(0, 0, 0, 0.5);
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

.page {
  position: absolute;
  inset: 0;
  padding: 0.5rem;
  margin: 0.5rem;
  border-radius: 0.25rem;
  background: white;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  overflow: hidden;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
}

h1 {
  font-size: 2rem;
  margin-block: 0.25rem;
}

a {
  color: var(--dark-cyan);
}

a:visited {
  color: var(--mystery-purple);
}

.center {
  text-align: center;
  justify-content: center;
}

button {
  --spot-color: var(--silver);
  font-size: inherit;
  font-family: inherit;
  border-radius: 0;
  border: 0.125rem solid lab(from var(--spot-color) calc(l - 20) a b);
  background: --spot-color;
  color: black;
}

button:hover {
  filter: brightness(125%);
}

button:active {
  filter: brightness(75%);
}

header.homeHeader {
  border-radius: 0.75rem;
  background: var(--hot-pink);
  color: white;
  padding: 0.5rem;
  text-align: center;
}

header.homeHeader h1 {
  letter-spacing: 0.05em;
  margin-block: 1.25rem;
}
header.homeHeader p {
  background: white;
  color: black;
  border-radius: 0.25rem;
  margin-block: 0.25rem 0;
}

.charCountChooser {
  width: 100%;
  display: flex;
  flex-direction: row;
  gap: 0.5rem;
  justify-content: center;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: 1rem;
}

.charCountChooser > div {
  border: 0.125rem solid var(--silver);
  border-radius: 0.5rem;
  position: relative;
}

.charCountChooser > div:has(input[type=radio]:checked) {
  background: var(--notice-orange);
  border-color: var(--caution-orange)
}

.charCountChooser > div > input {
  display: none;
}

.charCountChooser > div > label {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  transition: padding 150ms;
  -webkit-user-select: none;
  user-select: none;
}

.charCountChooser > div > input[type=radio]:checked + label {
  padding: 0.25rem 1rem;
}

.charCountDot {
  position: absolute;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 1rem;
  background: var(--dark-cyan);
  right: -0.25rem;
  top: -0.25rem;
  pointer-events: none;
}

.charCountDot.played {
  display: none;
}

#sectionHome button {
  display: block;
  margin: 0.5rem 0;
  padding: 0.25rem;
  width: 100%;
  color: white;
  background: var(--spot-color);
  border: 0.125rem solid lab(from var(--spot-color) calc(l - 20) a b);
}

#sectionHome button#btnDaily {
  --spot-color: var(--dark-cyan);
}
#sectionHome button#btnFree {
  --spot-color: var(--kelly-green);
}
#sectionHome button#btnDiscord {
  --spot-color: var(--mystery-purple);
}
#sectionHome button#btnRules {
  --spot-color: var(--caution-orange);
}
#sectionHome button#btnCredits {
  --spot-color: var(--hot-pink);
}

header.gameHeader {
  margin: -0.5rem;
  padding: 0.5rem;
  box-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.125);
}

header.gameHeader button {
  min-width: 2rem;
}

header.gameHeader h3 {
  font-size: 2rem;
  margin-block: 0;
}

header.gameHeader span {
  line-height: 1rem;
  font-size: 0.75rem;
}

#emojiStatus {
  margin-top:0.5rem;
}

#guessVisualizer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

.guessMark {
  display: inline-block;
  text-align: center;
  font-size: 0.5rem;
  line-height: 0.75rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 100%;
  background-color: var(--notice-orange);
  font-family: var(--font-display);
}

.guessMark.empty {
  background-color: var(--silver);
  color: var(--dull-gray);
}

.guessMark.current {
  background-color: var(--caution-orange);
  color: white;
}

.guessMark.gapAfter {
  margin-right: 0.5rem;
}

.playArea {
  position: relative;
  width: 100%;
  height: 10rem;
  align-self: center;
  margin-block: 1rem;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: stretch;
}

.alphabetReminder {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.06rem;
  -webkit-user-select: none;
  user-select: none;
}

.alphabetDisplay {
  background: var(--notice-orange);
  border-radius: 0.25rem;
  text-align: center;
}

.alphabetDisplay.dimmed {
  background: #e7e7e7;
  color: darkgray;
}

.alphabetDisplay.error {
  background: var(--uh-oh-red);
  color: var(--notice-orange);
}

.percentageColumn {
  width: 3rem;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
}

.percentageCaret {
  box-sizing: content-box;
  width: 0;
  height: 0;
  border: 0.5rem solid transparent;
  border-left-color: var(--spot-color);
  position: absolute;
  left: 2.7rem;
}

.percentageCaret:nth-child(1) {
  --spot-color: var(--pastel-pink);
  top: 2.75rem;
}
.percentageCaret:nth-child(2) {
  --spot-color: var(--pastel-cyan);
  bottom: 2.75rem;
}

.percentage {
  background-color: var(--spot-color);
  color: black;
  text-align: center;
  border-radius: 0.5rem;
  width: 2.5rem;
  height: 2rem;
  line-height: 2rem;
  position: absolute;
  left: 0.25rem;
  font-feature-settings: "lnum" 1;
  transform-origin: right;
  will-change: transform, filter;
  animation-play-state: paused;
}

.percentage:nth-child(3) {
  --spot-color: var(--pastel-pink);
  top: 2.25rem;
}

.percentage:nth-child(4) {
  --spot-color: var(--pastel-cyan);
  bottom: 2.25rem;
}

.percentage.wow {
  animation: wow 0.8s cubic-bezier(0.075, 0.82, 0.165, 1) 0s 1 normal forwards;
  animation-play-state: running;
}

@keyframes wow {
  from {
    transform: scale(1.5);
    filter: saturate(2.0);
  }
  to {
    transform: scale(1.0);
    filter: saturate(1.0);
  }
}

.lineColumn {
  position: relative;
  width: 2.8rem;
}

.tile {
  box-sizing: border-box;
  font-size: 2rem;
  line-height: 2.4rem;
  position: absolute;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0.125rem;
  background: var(--spot-color);
  color: white;
  text-align: center;
  border-radius: 0.5rem;
  font-family: var(--font-display);
  text-shadow: 0px 0px 0px transparent;
  box-shadow: 0px 0px 0px transparent;
  -webkit-user-select: none;
  user-select: none;
}

.tileBefore {
  top: 0rem;
  --spot-color: var(--last-row);
}

.tileAfter {
  top: 7rem;
  --spot-color: var(--next-row);
}

.tileNow {
  top: 3.5rem;
  --spot-color: var(--this-row);
  will-change: transform;
}

.tileNow.toBefore {
  transition: all 500ms cubic-bezier(.1,.7,.47,1);
  top: 0rem;
  --spot-color: var(--last-row);
}

.tileNow.toAfter {
  transition: all 500ms cubic-bezier(.1,.7,.47,1);
  top: 7rem;
  --spot-color: var(--next-row);
}

.tileNow.toCorrect {
  transition: all 900ms cubic-bezier(.2,0,0,1);
  transform: rotate(720deg);
  --spot-color: #d7d113;
  text-shadow: 0px 0px 0.5rem #ffffaa;
  box-shadow: 0px 0px 0.5rem #f2ff2e;
}

input {
  font-size: inherit;
  font-family: inherit;
  box-sizing: border-box;
  width: 100%;
  border: 0.125rem solid var(--silver);
}

#keyboardGrid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  row-gap: 0.0625rem;
  column-gap: 0.125rem;
}

button.key {
  border-bottom-width: 0.25rem;
  min-height: 2.5rem;
  font-size: 1.2rem;
  padding-bottom: 0.4rem;
  box-sizing: border-box;
  line-height: 1rem;
}

#gameOver.dailyMode {
  --spot-color: var(--dark-cyan);
}

#gameOver.freeMode {
  --spot-color: var(--kelly-green);
}

#resultHeader {
  background-color: var(--spot-color);
  color: white;
  border-radius: 0.5rem 0.5rem 0.25rem 0.25rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 1.25rem;
  padding: 0.25rem 0 0.125rem;
  margin: 0px 0 0.25rem;
}

#streakTable {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

#streakTable > div {
  background: var(--silver);
  border-radius: 0.375rem;
}

#streakTable > div b {
  margin-inline-start: 0.25rem;
}

#streakTable > div span {
  display: inline-block;
  margin: 0.125rem;
  padding-inline: 0.25rem;
  border-radius: 0.25rem;
  background: white;
  text-align: center;
}

#performanceGraph {
  border: 0.125rem solid var(--silver);
  border-radius: 0.5rem;
  box-sizing: border-box;
  width: 100%;
  margin-block: 0.25rem;
}

#performanceGraph td {
  position: relative;
}

#performanceGraph td .letterCount,
#performanceGraph td .graphScore {
  position: absolute;
  inset: 0.25rem 0.5rem;
  font-feature-settings: "lnum" 1;
  text-shadow: 0.02rem 0.05rem 0.125rem white;
}

#performanceGraph td .letterCount {
  right: auto;
  text-align: left;
}

#performanceGraph td .graphScore {
  left: auto;
  text-align: right;
}

#performanceGraph .barOuter {
  display: flex;
  flex-direction: row;
  justify-content: stretch;
  align-items: stretch;
  flex: 1 1 0;
  box-sizing: border-box;
  border-radius: 0.5rem;
  border: 0.125rem solid var(--dull-gray);
  overflow: hidden;
  min-height: 2rem;
}

#performanceGraph .barFull {
  flex: 1 1 0;
  background: var(--spot-color);
  border-radius: 0 0.125rem 0.125rem 0;
}

#performanceGraph .barEmpty {
  flex: 1 1 0;
}

#performanceGraph .barFull.barFail {
  background: var(--uh-oh-red);
}

#performanceGraph td.graphScore {
  /* I don't want to hard-code widths, but HTML tables have forced my hand */
  width: 2rem;
  text-align: right;
}
#performanceGraph th {
  /* I don't want to hard-code widths, but HTML tables have forced my hand */
  width: 2rem;
  text-align: left;
}
#shareTextBox {
  box-sizing: border-box;
  font-size: 75%;
  width: 100%;
  font-family: inherit;
}

.boxed {
  border: 0.125rem solid var(--silver);
  padding: 0.125rem;
}

.autosaveBanner {
  background: var(--spot-color);
  display: inline-block;
  border-radius: 0.5rem;
  padding: 0.125rem 0.5rem;
  margin-bottom: 0.25rem;
  color: white;
}

#autosaveBannerMode.daily {
  --spot-color: var(--dark-cyan);
}
#autosaveBannerMode.free {
  --spot-color: var(--kelly-green);
}
#autosaveBannerCharCount {
  --spot-color: var(--caution-orange);
}
#autosaveBannerGuessCount {
  --spot-color: var(--hot-pink);
}

/* replays page */

#replayBox {
  position: relative;
  z-index: 0;
  border: 0.125rem solid var(--silver);
  padding: 0.5rem;
}

.replayChosenWords {
  display: flex;
  flex-direction: row;
  gap: 0.1rem;
  align-items: stretch;
}

.replayTranscripts,
.replayIndices {
  font-size: 0.6rem;
  line-height: 0.7rem;
  font-feature-settings: "lnum" 1, "case" 1;
  flex: 1 1 0;
}

.replayIndices {
  text-align: right;
}

.replayWords {
  flex: 0 0 auto;
}

.replayTranscripts,
.replayIndices,
.replayWords {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  justify-content: space-evenly;
}

.replayWord {
  display: flex;
  flex-direction: row;
  gap: 0.05rem;
}

.replayWord > div {
  display: inline-block;
  color: white;
  border-radius: 0.25rem;
  font-family: var(--font-display);
  background: var(--dull-gray);
  width: 2rem;
  height: 2rem;
  font-size: 1.5rem;
  line-height: 2rem;
  text-align: center;
}

.replayWord:first-child > div {
  background: var(--hot-pink);
}

.replayWord.highlighted.victory > div {
  background: #b5ae24;
}

.replayWord.highlighted:first-child > div {
  box-shadow: 0 0 0.5rem var(--hot-pink);
}

.replayWord:last-child > div {
  background: var(--dark-cyan);
}

.replayWord.highlighted:last-child > div {
  box-shadow: 0 0 0.5rem var(--dark-cyan);
}

.replayWord.highlighted.victory > div {
  box-shadow: 0 0 0.5rem goldenrod;
}

.replayWord.highlighted.defeat > div {
  box-shadow: 0 0 0.5rem rgb(53, 62, 115);
}

.flexRange {
  display: flex;
  flex-direction: row;
  justify-content: stretch;
  align-items: stretch;
  min-height: 1.5rem;
  border: 0.125rem solid black;
  border-radius: 0.125rem;
  margin: 0.125rem 0;
  background: var(--dull-gray);
}

.flexRangeOOB, .flexRangeOuter, .flexRangeInner {
  flex: 0 0 0px;
  position: relative;
}

.flexRangeOOB {
  background: var(--silver);
}

.flexRangeOuter {
  background: linear-gradient(
    to right,
    white,
    var(--hot-pink)
  );
}

.flexRangeInner + .flexRangeOuter {
  background: linear-gradient(
    to right,
    var(--dark-cyan),
    white
  );
}

.flexRangeInner {
  background: var(--dull-gray);
}

.flexRangeLabel {
  font-feature-settings: "lnum" 1;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
}

.flexRangeOOB .flexRangeLabel,
.flexRangeOuter .flexRangeLabel {
  color: black;
}

.flexRangeLabel.tiny {
  z-index: 2;
  color: white;
  background: var(--mystery-purple);
  border-radius: 0.25rem;
  padding: 0.25rem 0.5rem;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -3rem);
}

.flexRangeLabel.tiny::before {
  box-sizing: border-box;
  content: "";
  width: 0.7rem;
  height: 1rem;
  border: 0.5rem solid transparent;
  border-top-color: var(--mystery-purple);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-0.5rem, 0.8rem);
}

.flexRangeOuter .flexRangeLabel.tiny {
  transform: translate(-50%, 1.25rem);
}

.flexRangeOuter .flexRangeLabel.tiny::before {
  border-top-color: transparent;
  border-bottom-color: var(--mystery-purple);
  transform: translate(-0.5rem, -1.8rem);
}