:root {
  color-scheme: dark;
  --bg: #09090b;
  --text: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.66);
  --line: rgba(244, 241, 234, 0.16);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Outfit", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100svh;
  background:
    radial-gradient(ellipse 60% 36% at 50% 8%, rgba(58, 68, 78, 0.18), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

button,
a {
  font: inherit;
  color: inherit;
}

.back {
  position: fixed;
  z-index: 5;
  top: 18px;
  left: 22px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}

.back:hover,
.back:focus-visible {
  color: var(--text);
}

.app {
  width: min(880px, calc(100% - 48px));
  margin: 0 auto;
  padding: 88px 0 56px;
}

.intro {
  text-align: center;
}

.kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 560;
  letter-spacing: -0.03em;
}

.field {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 28px 18px;
  min-height: 46vh;
  margin-top: 96px;
}

.word {
  margin: 0;
  padding: 0.08em 0.12em;
  border: 0;
  border-radius: 0.2em;
  background: transparent;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 560;
  letter-spacing: -0.04em;
  cursor: pointer;
}

.word[data-word="glass"] {
  justify-self: start;
  align-self: start;
}

.word[data-word="harbor"] {
  justify-self: end;
  align-self: start;
}

.word[data-word="lamps"] {
  justify-self: start;
  align-self: end;
}

.word[data-word="rim"] {
  justify-self: end;
  align-self: end;
}

.word[aria-pressed="true"] {
  background: rgba(244, 241, 234, 0.14);
  anchor-name: --mark;
}

.label {
  position: fixed;
  position-anchor: --mark;
  position-area: top center;
  position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  position-visibility: always;
  width: min(220px, calc(100vw - 32px));
  margin: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #14120e;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
  z-index: 4;
}

.label.is-fallback {
  position: fixed;
  margin: 0;
}

.word:focus-visible,
.back:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.hint {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

@media (max-width: 560px) {
  .back {
    top: 14px;
    left: 14px;
  }

  .app {
    width: calc(100% - 28px);
    padding-top: 72px;
  }

  .field {
    min-height: 58vh;
    gap: 18px 10px;
  }
}
