.iframe-top {
    position: absolute;
    outline: none;
}
.text-top {
    white-space: nowrap;
    position: relative;
    user-select: none;
    line-height: 1;
    box-sizing: border-box;
    --half-line: calc(.5rem + var(--variant-margin));
    --full-line: calc(1rem + var(--variant-margin));
    --line-height: 1.2;
    --il-line-height: 1.2rem;

    /* these are filled in dynamically */
    --text-lineno-left: unset;
    --text-lineno-width: unset;
    --text-glossref-left: unset;
    --text-notation-left: unset;
    --text-collapse-left: unset;
    --text-gutter-width: unset;
    --text-text-left: unset;
}

.commentary-top {
    width: 100%;
    user-select: text;
}

.il-stack {
    display: inline-flex;
    flex-direction: column;
    text-align: center;
    user-select: none;
    overflow: visible;
}
.il-stack>div[data-il-type] {
    line-height: var(--il-line-height);
    height: var(--il-line-height);
    white-space: nowrap;
}
.il-stack>div[data-il-type="identity"] {
    line-height: var(--line-height);
    user-select: text;
}
.il-stack.il-stack-selected>div[data-il-type="identity"] {
    background-color: #eef;
}
.il-stack>div[data-il-type="text"] {
    color: blue;
    user-select: none;
}
/* Padding and margins are based on a .5em draggable edge, and must be coordinated among il-edit-xxx's */
.il-edit-outer {
    position: absolute;
    background-color: white;
    padding: 0 .25em;
    margin-left: -.5em;
}
.il-edit-outer:not(.il-edit-hover) {
    z-index: 1;
}
.il-edit-middle {
    margin: -1px;
    border: 1px solid #8bf;
    border-radius: 2px;
    pointer-events: none;
    line-height: 0;
}
.il-edit-inner {
    display: inline-block;
    outline: none;
    padding: 0 .25em;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: all;
    line-height: var(--il-line-height);
    user-select: text;      /* NOTE: without turning this back on, left/right keys skip over extra character */
}
.il-edit-hover>.il-edit-middle {
    margin: -1px;
    border: 1px solid pink;
    border-radius: 1px;
}
/*
 Insert 0-width space in front; otherwise, weird layout things happen
 */
.il-stack>div[data-il-type="text"]::before,.il-edit-inner::before {
    content: "\00200b";
    line-height: var(--line-height);
}

.il-audio-speaker {
    font: var(--font-fa-solid);
    font-size: 1rem;
    vertical-align: text-top;
}
.il-audio-speaker:hover {
    color: magenta;
    cursor: pointer;
}
.il-audio-speaker-parent {
    position: relative;
    z-index: 1;         /* required to bring speaker icon to foreground when it appears over subsequent stack item in phrase */
}
.il-audio-speaker-parent:hover {
    cursor: text;
}
.line, .e-line {
    position: relative;
}

.box-through {
    position: absolute;
    display: flex;
    flex-direction: column;
    border-right: thin solid #cccccc;
    height: 100%;
    background-color: #eeeeee;
    box-sizing: border-box;
    user-select: none;
    width: var(--text-gutter-width);
}
.collapse-hover >.box-through {
    border-right: thin solid black;
}
.collapse, .expand {
    display: inline-block;
    user-select: none;
    text-align: center;
    line-height: 1;
    color: #6666ff;
    background-color: transparent;
    box-sizing: border-box;
    position: absolute;
    padding-left: .25rem;
    padding-right: .25rem;
    left: var(--text-collapse-left);
}
.collapse:hover, .expand:hover {
    color: black;
}
.collapse::before {
    font: var(--font-fa-solid);
    content: "\f0d7";
}
.expand::before {
    font: var(--font-fa-solid);
    content: "\f0da";
}
.box-child {
    position: absolute;
    width: var(--text-gutter-width);
    bottom: 0;
    height: 1rem;
    border-right: thin solid black;
    box-sizing: border-box;
}
.content {
    position: relative;
    padding-top: var(--variant-margin);
    padding-bottom: var(--variant-margin);
    box-sizing: border-box;
    user-select: none;
}
.variant-lineno {
    display: inline-block;
    user-select: none;
    margin-left: -6rem;
    text-align: right;
    width: 2.5rem;
    margin-right: 3rem;
    font-size: .8rem;
    font-weight: bold;
    color: #aaaaaa;
}
.lineno {
    display: inline-block;
    user-select: none;
    text-align: right;
    font-size: .8rem;
    font-weight: bold;
    color: #aaaaaa;
    position: absolute;
    white-space: nowrap;
    overflow: visible;
    box-sizing: border-box;
    bottom: 0;
    margin-bottom: var(--variant-margin);
    line-height: var(--line-height);
    height: var(--line-height);
    padding-left: .5rem;
    padding-right: .25rem;
    left: var(--text-lineno-left);
    width: var(--text-lineno-width);
}
.glossref, .text-notation {
    display: inline-block;
    user-select: none;
    padding-left: .25rem;
    padding-right: .25rem;
    text-align: center;
    font-size: 1rem;
    line-height: var(--line-height);
    height: var(--line-height);
    color: #aaaaaa;
    outline: thin solid transparent;
    box-sizing: border-box;
    position: absolute;
    margin-bottom: var(--variant-margin);
    bottom: 0;
}
.glossref {
    visibility: hidden;
    left: var(--text-glossref-left);
}
.glossref-active {
    visibility: inherit;
}
.glossref:before {
    font: var(--font-fa-solid);
    content: "\00f128";
}
.glossref:hover {
    background-color: #eeeeee;
    color: #444444;
    outline: thin solid #444444;
}
.glossref:active {
    background-color: #cccccc;
}

.text-notation {
    left: var(--text-notation-left);
    visibility: hidden;
}
.text-notation:before {
    font: var(--font-fa-regular);
    font-size: .8rem;
    content: "\00f075";
}
.text-notation:hover {
    background-color: #eeeeee;
    color: #444444;
    outline: thin solid #444444;
}
.text-notation:active {
    background-color: #cccccc;
}

/* For each notation type, enable gutter icon if type is listed in top div */
.text-top[data-text-notation-types*="speaker"] .text-notation[data-text-notation-types*="speaker"] {
    visibility: inherit;
}
.text-top[data-text-notation-types*="gap"] .text-notation[data-text-notation-types*="gap"] {
    visibility: inherit;
}
.text-top[data-text-notation-types*="subst"] .text-notation[data-text-notation-types*="subst"] {
    visibility: inherit;
}
.text-top[data-text-notation-types*="add"] .text-notation[data-text-notation-types*="add"] {
    visibility: inherit;
}
.text-top[data-text-notation-types*="del"] .text-notation[data-text-notation-types*="del"] {
    visibility: inherit;
}

.prose, .verse {
    text-indent: -1rem;
}
.speaker {
}
.space {
    display: inline-block;
    width: 1em;
}
.e-line {
    color: lightblue;
    font-style: italic;
}
.stage, .stage-entrance, .stage-inspeech, .stage-entrance-inspeech {
    display: inline-block;
    margin-left: -1rem;
    margin-right: 0;
    white-space: normal;    /* TODO: we wrap these stage directions, as they have no <br>'s in TEI */
}
.head, .trailer {
    display: inline-block;
    margin-left: -1rem;
    box-sizing: border-box;
}

/* Standard text formatting */
.head, .trailer {
    text-align: center;
    width: 25rem;
    font-size: 1rem;
    font-weight: bold;
}
.head[level="0"] {
    font-size: 1.25rem;
    font-weight: bold;
}
.text-format .stage, .text-format .stage-pretext, .text-format .stage-inline, .text-format .stage-entrance, .text-format .stage-inspeech, .text-format .stage-entrance-inspeech {
    font-style: italic;
}
.text-format .stage {
    text-align: right;
}
.text-format .stage-inspeech {
    text-align: right;
    flex: 1 1 auto;
}
.text-format .stage-entrance, .text-format .stage-entrance-inspeech {
    text-align: center;
    flex: 1 1 auto;
}
.text-format .quoted {
    font-style: italic;
}
.text-format .line-group {
    font-style: italic;
}
.text-format .speaker {
    font-variant: all-small-caps;
}


/* Handle explicit rendering */
[data-rend~="italic"] {
    font-style: italic;
}
[data-text-align="center"] {
    text-align: center;
    flex: 1 1 auto;
}

.l-head .content {
    padding-top: var(--half-line);
}
.l-trailer .content {
    padding-top: var(--half-line);
}
.l-stage-entrance-inspeech .content {
    padding-top: var(--half-line);
}
.l-stage-entrance .content {
    padding-top: var(--half-line);
}
.l-stage .content {
    padding-top: var(--half-line);
}
.l-speaker .content {
    padding-top: var(--half-line);
}
.l-stage-entrance + .l-stage-entrance .content {
    padding-top: unset;
}


.text {
    user-select: text;
    display: inline-flex;
    padding-left: .5rem;
    margin-left: var(--text-text-left);
    width: 25rem;
}
::selection {
    background-color: #ddeeff;
    text-decoration: underline;
}
.text > span {
    margin-left: 0;
}
.text > span:first-child {
    margin-left: .5rem;
}
.text > span.speaker {
    margin-left: 0;
}
.line-highlight .text {
    background-color: #ffdddd;
}
