:root {
  color-scheme: dark;
  --bg: oklch(0.08 0 0);
  --surface: oklch(0.22 0 0);
  --ink: oklch(1 0 0);
  --accent: oklch(0.45 0.18 270);
  --accent-pale: oklch(0.88 0.08 285);
  --muted: oklch(0.68 0 0);
  --frame: 3px;
  --frame-offset: 5px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  font-family: "Bahnschrift SemiCondensed", "Franklin Gothic Medium", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--ink);
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

#temple {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
}

.temple-header {
  position: fixed;
  z-index: 2;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  left: max(1rem, env(safe-area-inset-left));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  pointer-events: none;
}

.plaque {
  position: relative;
  margin: var(--frame-offset);
  border: var(--frame) solid currentColor;
  border-radius: 0;
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 var(--frame-offset) currentColor;
}

.plaque::before,
.plaque::after {
  position: absolute;
  width: 7px;
  height: 7px;
  background: currentColor;
  content: "";
}

.plaque::before {
  top: -8px;
  left: -8px;
}

.plaque::after {
  right: -8px;
  bottom: -8px;
}

.plaque--dark {
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  color: var(--ink);
}

.plaque--light {
  background: color-mix(in oklch, white 88%, transparent);
  color: var(--bg);
}

.title-plaque {
  max-width: min(38vw, 29rem);
  padding: 0.75rem 1rem 0.7rem;
  font-size: clamp(0.78rem, 1.4vw, 1.1rem);
  font-stretch: condensed;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
  text-wrap: balance;
}

.contract {
  max-width: min(52vw, 39rem);
  min-height: 44px;
  padding: 0.62rem 0.75rem;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font: inherit;
  cursor: copy;
  transition:
    color 140ms var(--ease-out),
    background-color 140ms var(--ease-out),
    transform 140ms var(--ease-out);
}

.contract:hover {
  background: var(--surface);
}

.contract:active {
  transform: scale(0.985);
}

.contract:focus-visible {
  outline: 3px solid var(--accent-pale);
  outline-offset: 8px;
}

.contract__label,
.contract__status {
  flex: none;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contract__address {
  min-width: 0;
  overflow: hidden;
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(0.64rem, 0.85vw, 0.78rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract__status {
  min-width: 3.5em;
  color: var(--muted);
  text-align: right;
}

.contract[data-copied="true"] {
  color: var(--accent-pale);
}

.contract[data-copied="true"] .contract__status {
  color: var(--accent-pale);
}

.contract__mobile {
  display: none;
}

.devotion {
  position: fixed;
  z-index: 2;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: max(1rem, env(safe-area-inset-left));
  width: min(36rem, calc(100vw - 2rem - (var(--frame-offset) * 2)));
  margin-inline: auto;
  padding: 1rem clamp(1rem, 4vw, 2.25rem);
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(0.72rem, 1.3vw, 0.9rem);
  line-height: 1.6;
  text-align: center;
}

.devotion p {
  margin: 0;
  text-wrap: pretty;
}

.loading {
  position: fixed;
  z-index: 3;
  inset: 50% auto auto 50%;
  margin: 0;
  padding: 0.6rem 0.8rem;
  transform: translate(-50%, -50%);
  background: var(--bg);
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.75rem;
  transition: opacity 300ms var(--ease-out);
}

.loading[hidden] {
  display: block;
  opacity: 0;
  pointer-events: none;
}

noscript {
  position: fixed;
  z-index: 4;
  inset: 50% auto auto 50%;
  width: min(28rem, calc(100vw - 2rem));
  transform: translate(-50%, -50%);
  text-align: center;
}

@media (max-width: 720px) {
  .temple-header {
    align-items: stretch;
    flex-direction: column;
  }

  .title-plaque {
    max-width: max-content;
  }

  .contract {
    align-self: flex-end;
    max-width: 100%;
  }

  .contract__desktop {
    display: none;
  }

  .contract__mobile {
    display: inline;
  }

  .devotion {
    padding-block: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contract,
  .loading {
    transition-duration: 0.01ms;
  }
}
