/* Paul's Air. Layers are absolute inside the stage. */

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #e7f3ff;
  overscroll-behavior: none;
}

body {
  color: #1b2a4a;
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

[hidden] {
  display: none !important;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: linear-gradient(180deg, #e7f3ff 0%, #f6fbff 46%, #ffffff 100%);
  touch-action: none;
}

#sky {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.frost,
.heat {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
}

.frost {
  background:
    radial-gradient(closest-side at 50% 50%, rgba(255, 255, 255, 0) 52%, rgba(186, 220, 245, 0.2) 70%, rgba(226, 242, 255, 0.94) 100%);
  box-shadow: inset 0 0 0 0 rgba(214, 236, 252, 0);
}

.frost.show {
  animation: frost-creep 5s ease forwards;
}

.heat {
  z-index: 3;
  background:
    radial-gradient(120% 70% at 50% 100%, rgba(227, 38, 47, 0.16), transparent 58%),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 196, 150, 0.2) 0 3px,
      rgba(255, 255, 255, 0) 3px 16px
    );
}

.heat.show {
  animation: heat-wave 4.6s linear forwards;
}

@keyframes frost-creep {
  0% {
    opacity: 0;
    background-size: 170% 170%;
    box-shadow: inset 0 0 0 0 rgba(214, 236, 252, 0);
  }
  18% {
    opacity: 1;
  }
  42% {
    background-size: 118% 118%;
    box-shadow: inset 0 0 70px 26px rgba(214, 236, 252, 0.95);
  }
  100% {
    opacity: 0;
    background-size: 100% 100%;
    box-shadow: inset 0 0 12px 0 rgba(214, 236, 252, 0);
  }
}

@keyframes heat-wave {
  0% {
    opacity: 0;
    transform: translateY(0);
  }
  14% {
    opacity: 0.95;
  }
  70% {
    opacity: 0.8;
    transform: translateY(-10px);
  }
  100% {
    opacity: 0;
    transform: translateY(-16px);
  }
}

.brand {
  position: absolute;
  z-index: 6;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 58%;
  pointer-events: none;
}

.star {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
}

.star img {
  width: 40px;
  height: 40px;
  display: block;
}

.brand h1,
.brand p,
.breath p {
  margin: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1f3fbf;
}

.brand p {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.3;
  color: #5c6d88;
}

.breath {
  position: absolute;
  z-index: 6;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  max-width: min(240px, 46vw);
  text-align: right;
  font-size: 12px;
  line-height: 1.35;
  color: #3d5270;
  pointer-events: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.warnings {
  position: absolute;
  inset: 0;
  /* Above the thermostat (7) and vent (6) so their messages are not hidden; below dialogs (9). */
  z-index: 8;
  pointer-events: none;
  overflow: hidden;
}

.warn {
  position: absolute;
  max-width: min(280px, calc(100% - 24px));
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 63, 191, 0.22);
  color: #1f3fbf;
  font-size: 14px;
  line-height: 1.3;
  box-shadow: 0 6px 18px rgba(27, 42, 74, 0.08);
  animation: warn-fade 2.15s ease forwards;
}

@keyframes warn-fade {
  0% { opacity: 1; }
  68% { opacity: 1; }
  100% { opacity: 0; }
}

.vent {
  position: absolute;
  z-index: 6;
  right: 0;
  top: 44%;
  width: 112px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.vent img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

.thermo {
  position: absolute;
  z-index: 7;
  left: calc(10px + env(safe-area-inset-left, 0px));
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  width: 148px;
  height: 185px;
}

.thermo-art,
.thermo-art img {
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* Number box in the 160x200 thermostat viewBox: x 28-132, y 51-128.
   Arrow hits: x 30-70 and 90-130, y 150-190. */
.thermo-read {
  position: absolute;
  left: 17.5%;
  width: 65%;
  top: 25.5%;
  height: 38.5%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #14213d;
  pointer-events: none;
}

.thermo button {
  position: absolute;
  top: 75%;
  height: 20%;
  width: 25%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.thermo button.down,
#thermo-down {
  left: 18.75%;
}

.thermo button.up,
#thermo-up {
  left: 56.25%;
}

.cookie {
  position: absolute;
  z-index: 8;
  left: 168px;
  right: calc(12px + env(safe-area-inset-right, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #d5e3f3;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(31, 63, 191, 0.1);
}

.cookie p {
  margin: 0;
  font-size: 14px;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cookie button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #1f3fbf;
  background: #1f3fbf;
  color: #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

#cookie-also {
  background: #fff;
  color: #1f3fbf;
}

.dialogs {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  overflow: hidden;
}

.dialog {
  position: absolute;
  width: min(360px, calc(100% - 28px));
  pointer-events: auto;
  background: #d4d0c8;
  color: #000;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  box-shadow: 2px 2px 0 #000;
  font-family: Tahoma, "Segoe UI", sans-serif;
  transform: translate(-50%, -50%);
}

.dialog-title {
  margin: 2px;
  padding: 3px 8px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.dialog-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 6px;
}

.dialog-body img {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.dialog-body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  padding: 8px 10px 12px;
}

.dialog button {
  min-width: 92px;
  min-height: 28px;
  padding: 4px 18px;
  background: #d4d0c8;
  color: #000;
  border: 2px solid;
  border-color: #fff #404040 #404040 #fff;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.dialog button:focus {
  outline: 1px dotted #000;
  outline-offset: -5px;
}

button:focus-visible {
  outline: 2px solid #1f3fbf;
  outline-offset: 2px;
}

@media (max-width: 420px) {
  .brand h1 {
    font-size: 17px;
  }
  .brand p,
  .breath {
    font-size: 11px;
  }
  .star,
  .star img {
    width: 32px;
    height: 32px;
  }
  .cookie {
    left: 118px;
  }
  .vent {
    width: 92px;
    height: 40px;
  }
}

@media (max-height: 430px) {
  .thermo {
    width: 104px;
    height: 130px;
  }
  .thermo-read {
    font-size: 16px;
  }
  .cookie {
    left: 122px;
    padding: 6px 8px;
  }
  .brand h1 {
    font-size: 16px;
  }
  .vent {
    top: 28%;
  }
}

@media (max-width: 479px) {
  .thermo {
    width: 96px;
    height: 120px;
  }
  .thermo-read {
    font-size: 16px;
  }
  .cookie {
    left: 118px;
  }
}

@media (min-width: 1100px) {
  .thermo {
    width: 168px;
    height: 210px;
  }
  .cookie {
    left: 190px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .frost.show,
  .heat.show,
  .warn {
    animation: none;
  }
  .warn {
    opacity: 1;
  }
}
