@font-face {
  font-family: "VT323";
  src: url("fonts/vt323.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --desk: #050605;
  --ink: #4a4239;
  --paper: rgba(250, 247, 240, 0.9);
  --green: #00ff41;      /* badweasley.com's greens */
  --green-dim: #2fcf55;
  --strip: 24px;
}

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--desk);
  overscroll-behavior: none;
}

body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  font: 500 12px/1 ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", sans-serif;
  color: var(--ink);
}

button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

#desk {
  position: fixed;
  inset: 0;
}

#sheet, #lift {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: block;
}

#sheet {
  cursor: none;
  touch-action: none;
}

body.paused #sheet {
  cursor: default;
}

/* The old painting, lifted away when a fresh sheet is laid. */
#lift {
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
}

#lift.up {
  visibility: visible;
  opacity: 1;
}

#lift.away {
  visibility: visible;
  opacity: 0;
  transform: translate(-50%, -57%) rotate(-1.2deg);
  transition: transform 1.1s cubic-bezier(0.3, 0, 0.2, 1), opacity 1.1s ease-in;
}

/* The status strip of badweasley.com, the site Blooms lives on. It leaves
   while you paint and takes its time coming back. */
#strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-sizing: content-box;
  height: var(--strip);
  padding: env(safe-area-inset-top) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.86);
  border-bottom: 1px solid #0b5d1e;
  color: var(--green-dim);
  font-family: "VT323", ui-monospace, Menlo, Consolas, monospace;
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.13em;
  white-space: nowrap;
  transition: opacity 0.9s ease 3s;
}

#strip a {
  color: var(--green);
  text-decoration: none;
}

#strip a:hover,
#strip a:focus-visible {
  color: #f2fff4;
  text-shadow: 0 0 5px var(--green), 0 0 10px var(--green);
}

body.painting #strip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0s;
}

body.paused #strip {
  opacity: 1;
  transition-delay: 0s;
}

@media (max-width: 480px) {
  #strip .wide { display: none; }
}

/* The one control: a faint ring that opens pause. */
#mark {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  margin: 0 0 0 -24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.7s ease;
}

#mark::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  margin: -8px 0 0 -8px;
  border: 1.5px solid rgba(74, 66, 57, 0.75);
  border-radius: 50%;
}

#mark:hover {
  opacity: 0.95;
}

#mark:focus-visible {
  outline: 2px solid rgba(74, 66, 57, 0.6);
  outline-offset: -6px;
  border-radius: 50%;
}

body.painting #mark {
  opacity: 0;
  transition-duration: 0.3s;
}

body.paused #mark {
  opacity: 0;
  pointer-events: none;
}

#bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  box-sizing: border-box;
  width: fit-content;
  max-width: calc(100vw - 20px);
  padding: 4px;
  border-radius: 26px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid rgba(74, 66, 57, 0.12);
  box-shadow: 0 8px 30px rgba(40, 30, 20, 0.16);
  animation: rise 0.35s ease both;
}

#bar[hidden], #installBar[hidden], #keep[hidden], button[hidden] {
  display: none;
}

#bar button {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 13px 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  cursor: pointer;
}

#bar button:hover {
  background: rgba(74, 66, 57, 0.08);
}

#bar button:focus-visible,
#installBar button:focus-visible,
#keep button:focus-visible {
  outline: 2px solid rgba(74, 66, 57, 0.6);
  outline-offset: -2px;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  #bar button {
    padding: 13px 11px;
    font-size: 11px;
    letter-spacing: 0.1em;
  }
}

/* The offer to put Blooms on a home screen (phones and tablets only). */
#installBar {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: calc(var(--strip) + env(safe-area-inset-top) + 12px);
  transform: translateX(-50%);
  box-sizing: border-box;
  width: min(520px, calc(100vw - 20px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid rgba(74, 66, 57, 0.12);
  box-shadow: 0 8px 30px rgba(40, 30, 20, 0.16);
  font-size: 13px;
  line-height: 1.35;
  transition: opacity 0.6s ease 1.5s;
}

body.painting #installBar {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0s;
}

#installBar img {
  flex: none;
  border-radius: 9px;
}

.install-text {
  flex: 1 1 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: 400;
}

.install-text strong {
  font-weight: 600;
}

.install-text svg {
  width: 0.85em;
  height: 1em;
  vertical-align: -0.12em;
}

.install-actions {
  flex: 1 1 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px 8px;
}

#installBar button {
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: rgba(74, 66, 57, 0.08);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#installBar #installAdd {
  background: var(--ink);
  color: #faf7f0;
}

#installBar #installNever {
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* The last resort for saving on a phone: the picture by itself. */
#keep {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 16px);
  background: rgba(5, 6, 5, 0.92);
  color: #faf7f0;
  font-size: 14px;
  -webkit-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
}

#keep img {
  max-width: 100%;
  max-height: 70vh;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  -webkit-user-select: auto;
  user-select: auto;
  -webkit-touch-callout: default;
}

#keep p {
  margin: 0;
}

#keep button {
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: #faf7f0;
  color: var(--ink);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

#sorry {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(84vw, 30em);
  height: 3em;
  text-align: center;
  color: var(--green-dim);
  font-family: "VT323", ui-monospace, Menlo, Consolas, monospace;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {
  #lift.away { transition: none; }
  #bar { animation: none; }
  #mark, #strip, #installBar { transition: none; }
}
