:root {
  color-scheme: dark;
  --bg: #09090b;
  --text: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.66);
  --line: rgba(244, 241, 234, 0.16);
  --mark: 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(980px, calc(100% - 64px));
  margin: 0 auto;
  padding: 88px 0 64px;
}

.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;
}

.sheet {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 40rem) 230px;
  column-gap: 40px;
  width: fit-content;
  max-width: 100%;
  margin: 36px auto 0;
}

.essay {
  max-width: none;
  font-family: var(--font-display);
  font-size: 1.34rem;
  font-weight: 560;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.essay p {
  margin: 0 0 1.35em;
}

.gloss {
  display: inline;
}

.phrase {
  display: inline;
  margin: 0;
  padding: 0.04em 0.14em;
  border: 0;
  border-radius: 0.2em;
  background: transparent;
  box-decoration-break: clone;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
}

.phrase[aria-pressed="true"] {
  background: var(--mark);
}

.note {
  position: absolute;
  left: calc(100% - 230px);
  width: 230px;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
}

.note-toggle {
  display: block;
  width: 100%;
  margin: 0;
  padding: 2px 0 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  line-height: 1.3;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.note.is-open .note-toggle {
  color: var(--text);
}

.note-body {
  display: block;
  margin: 8px 0 0;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.note-body[hidden] {
  display: none;
}

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

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

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

  .app {
    width: min(640px, calc(100% - 32px));
    padding-top: 72px;
  }

  .sheet {
    display: block;
    margin-top: 28px;
  }

  .essay {
    font-size: 1.2rem;
  }

  .note {
    position: static;
    display: block;
    width: auto;
    margin: 12px 0 2px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
  }

  .note-body {
    border-left: 0;
    padding-left: 0;
  }
}
