/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

body {
  margin: 0;
  overflow: hidden;
}

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  /* Four arms around an empty center, so the crosshair does not cover the aimed dot. */
  --arm: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8));
  background:
    var(--arm) center top / 1.5px 9px no-repeat,
    var(--arm) center bottom / 1.5px 9px no-repeat,
    var(--arm) left center / 9px 1.5px no-repeat,
    var(--arm) right center / 9px 1.5px no-repeat;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.9));
}

/* Without it, a drag on a touch screen scrolls or zooms the page instead of the look. */
canvas {
  touch-action: none;
}

.prompt {
  position: fixed;
  left: 50%;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  font-family: "Courier New", Courier, monospace;
  color: #fff;
  text-align: center;
}

.prompt[hidden],
.prompt__intro[hidden] {
  display: none;
}

.prompt__intro {
  margin: 0;
  font-size: 14px;
  opacity: 0.7;
}

.prompt__buttons {
  display: flex;
  gap: 12px;
}

.prompt__button {
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 4px;
  background: none;
  font: inherit;
  font-size: 15px;
  color: inherit;
  cursor: pointer;
}

.prompt__button kbd {
  margin-left: 6px;
  font: inherit;
  font-size: 12px;
  opacity: 0.5;
}

@media (pointer: coarse) {
  .prompt__button kbd {
    display: none;
  }
}

/* The button breathes until the first shout, with the same period as the dots. */
.prompt__intro:not([hidden]) + .prompt__buttons .prompt__button--shout {
  animation: prompt-breathe 2.667s ease-in-out infinite;
}

@keyframes prompt-breathe {
  50% { opacity: 0.5; }
}

/* The camera looks at the chosen dot in writing mode, so the dot stays in the center of the screen. */
.shout-form {
  position: fixed;
  left: 50%;
  bottom: calc(50% + 70px);
  width: min(340px, calc(100vw - 32px));
  padding: 12px;
  box-sizing: border-box;
  transform: translateX(-50%);
  font-family: "Courier New", Courier, monospace;
  color: #fff;
  animation: shout-form-appear 0.4s ease-out, shout-form-float 4s ease-in-out 0.4s infinite;
  /* Its own GPU layer moves the form in sub-pixel steps. Without it, the text snaps to whole pixels and the float stutters. */
  will-change: transform;
}

.shout-form[hidden] {
  display: none;
}

@keyframes shout-form-appear {
  from { opacity: 0; transform: translate(-50%, 10px); }
}

@keyframes shout-form-float {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -6px); }
}

.shout-form__content {
  display: block;
  width: 100%;
  box-sizing: border-box;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: inherit;
  text-align: center;
}

.shout-form__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* Twitter-style counter: a ring that fills up, and the remaining characters near the limit. */
.shout-form__error {
  flex: 1;
  font-size: 12px;
  color: #f4212e;
}

.shout-form__counter {
  --counter-color: #1d9bf0;
  opacity: 0.4;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--counter-color);
}

.shout-form__counter[data-state="warning"] {
  --counter-color: #ffd400;
}

.shout-form__counter[data-state="limit"] {
  --counter-color: #f4212e;
}

.shout-form__ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: conic-gradient(var(--counter-color) calc(var(--progress, 0) * 1turn), rgba(255, 255, 255, 0.2) 0);
  mask: radial-gradient(circle, transparent 7px, #000 7.5px);
}

.shout-form__confirm {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1.5px solid #3ddc84;
  border-radius: 8px;
  background: transparent;
  color: #3ddc84;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.shout-form__confirm:disabled {
  cursor: default;
}

.shout-form__confirm:hover:not(:disabled) {
  opacity: 1;
  background: rgba(61, 220, 132, 0.12);
}

/* Below the shout, because the text of the shout shows above it. */
.system-messages {
  position: fixed;
  left: 50%;
  top: calc(50% + 70px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(480px, calc(100vw - 32px));
  transform: translateX(-50%);
  font-family: "Courier New", Courier, monospace;
  font-size: 14px;
  color: #fff;
  text-align: center;
  pointer-events: none;
}

.system-message {
  margin: 0;
}

.system-message[data-type="error"] {
  color: #f4212e;
}
