html {
    --colour-background: #000;
    --colour-primary: #F80;
    --colour-primary-variant: #FF8800;
    --colour-primary-alpha: rgba(255, 136, 0, 0.3);
    --colour-secondary: #0CC;
    --colour-tertiary: #FDA;
    --colour-text: #eff;
    --colour-text-muted: #cdd;
    --colour-text-extra-muted: #788;
    --colour-surface: #344;
    --colour-surface-seethrough: #3448;
    --colour-surface-variant: #455;
    --colour-surface-bright: #677;
    --colour-surface-primary: #864;
    --colour-surface-tertiary: #664;
    --colour-outline: #9aa;
    --colour-outline-bright: #bcc;
    --colour-surface-tint: rgba(255, 255, 255, 0.3);
    --colour-hn-background: rgb(246, 246, 239);
    --colour-hn-text: #000;
    --colour-hn-grey: #828282;
    --colour-hn-link: #828282;
    --font-family-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: Verdana, Geneva, sans-serif;
    font-size: 85%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--colour-background);
    width: 100vw;
    height: 100vh;
    position: relative;
    touch-action: none;
}

a {
    text-decoration: none;
    color: var(--colour-text);
}

a:hover {
    text-decoration: underline;
}

use {
    fill: var(--colour-text);
    stroke: var(--colour-text);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        translate: 0 1rem;
    }

    to {
        opacity: 1;
        translate: 0 0rem;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        translate: 0 0rem;
    }

    to {
        opacity: 0;
        translate: 0 0rem;
    }
}

@keyframes zoomButtonFadeIn {
    from {
        opacity: 0;
    }

    66% {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.fade-enter-active {
    animation: fadeIn 0.2s ease-in;
}

.fade-leave-active {
    display: none;
}

.zoom-button-fade-enter-from {
    opacity: 0;
}

.zoom-button-fade-enter-active {
    animation: zoomButtonFadeIn 0.75s ease-in forwards;
}

.zoom-button-fade-enter-to {
    opacity: 1;
}

.zoom-button-fade-leave-active {
    opacity: 0;
}

canvas {
    position: absolute;
    inset: 0;
    display: block;
}

#outer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#app {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 2;
}

#button-container {
    flex: 0 0 2rem;
    background: var(--colour-surface);
    padding: .5rem;
    border-radius: 3rem;
    pointer-events: auto;
}

button {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--colour-background);
    color: var(--colour-text);
    border-color: var(--colour-primary);
    border-width: 3px;
    border-style: solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

button:active {
    background: var(--colour-primary)
}

button.special {
    border: var(--colour-secondary) 3px solid;
}

button:active.special {
    background: var(--colour-secondary)
}

button.extra-special {
    border: var(--colour-tertiary) 3px solid;
}

button:active.extra-special {
    background: var(--colour-tertiary)
}

button.blackness {
    border: none;
}

button:active.blackness {
    background: var(--colour-primary)
}

button.greyness {
    border: none;
    background: var(--colour-surface)
}

button:active.greyness {
    background: var(--colour-primary)
}


button svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: var(--colour-primary);
}

button use {
    width: 1.25rem;
    height: 1.25rem;
}

button.blackness use {
    stroke: var(--colour-primary);
    fill: var(--colour-primary);
}

button:active.blackness use {
    stroke: var(--colour-background);
    fill: var(--colour-background);
}

button.always-large {
    width: 3rem;
    height: 3rem;
    font-size: 150%;
}

button.always-large svg {
    width: 1.75rem;
    height: 1.75rem;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(50%);
    transition: opacity 0.2s ease, filter 0.2s ease;
}

button.textual {
    border-radius: 0rem;
    background: var(--colour-surface-variant);
    border-radius: 1rem;
    border: none;
    padding: .5rem 1rem;
    width: auto;
    font-weight: bolder;
    color: var(--colour-text);
}

button.textual:hover {
    background: var(--colour-surface-primary);
}

button.textual.slim {
    background: var(--colour-surface-bright);
    padding: 0.25rem 0.5rem;
    height: auto;
}

button.textual.extra-special {
    background: var(--colour-surface-tertiary);
    color: var(--colour-text);
    border: 1px solid var(--colour-tertiary);
}

button.shadow {
    box-shadow: 0 0 8px var(--colour-background), 0 0 16px var(--colour-background);
}

button.textual.extra-special:hover {
    background: var(--colour-tertiary);
    color: var(--colour-background);
}

button.textual.extra-special:hover use {
    fill: var(--colour-background);
}

.suppress {
    pointer-events: none !important;
    cursor: auto !important;
}

.top-stories {
    z-index: 2;
    position: absolute;
    width: unset;
    color: var(--colour-text-muted);
    font-family: var(--font-family-sans);
}

.top-stories-text {
    font-size: 85%;
}

#submission-range {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--colour-surface);
    border-radius: .5rem;
    color: var(--colour-text);
    height: 5.25rem;
}

#details-container {
    position: absolute;
    inset-inline: 1rem;
    bottom: 1rem;
    gap: .5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#details-outer {
    width: 100%;
    max-width: 30rem;
    min-width: 10rem;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: .5rem;
}

.touch-device>#details-outer {
    align-items: flex-start;
}

#buttons {
    display: flex;
    flex-direction: column-reverse;
    gap: .25rem;
}

#details {
    background: var(--colour-surface-variant);
    color: var(--colour-text);
    pointer-events: auto;
    border-radius: .5rem;
    z-index: 3;
}

#details a:visited {
    color: var(--colour-tertiary);
}


#details-card {
    position: relative;
    padding: 1rem;
    min-height: 10rem;
    display: flex;
    flex-direction: column;
}

#details-card.comment-view {
    min-height: 12rem;
}

#details-rank {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

#details-rank> :nth-child(1) {
    margin-top: 0rem;
    margin-bottom: .5rem;
}

#details-inner {
    align-self: stretch;
    flex: 1 1 auto;
    display: flex;
    flex-direction: row;
    gap: 1rem;
}

#details-inner> :nth-child(2) {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

#details-stats {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

#details-stats> :last-child {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.return-indicator {
    color: var(--colour-tertiary);
    text-decoration: none !important;
}

.touch-device .return-indicator {
    display: none;
}

button.textual:hover .return-indicator {
    color: var(--colour-background);
}

#title {
    display: block;
    height: 2.4rem;
    max-height: 2.4rem;
    line-height: 1.2rem;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#details-rollover-card {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

#details-rollover-card div {
    display: flex;
    flex-direction: row;
    gap: .5rem;
    align-items: center;
}

#rollover-title {
    display: block;
    line-height: 1.2rem;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#hostname {
    color: var(--colour-text-muted);
    font-size: 80%;
    text-decoration: none;
}

#hostname:hover {
    text-decoration: underline;
}

#story-text {
    display: block;
    height: 1.2rem;
    max-height: 1.2rem;
    line-height: 1.2rem;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 1;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

#comment-text {
    display: block;
    max-height: 8.4rem;
    line-height: 1.2rem;
    overflow: hidden;
    display: -webkit-box;
    line-clamp: 7;
    -webkit-line-clamp: 7;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

/* code blocks inside comments seem to explode the div width */
#comment-text>pre {
    max-width: 10rem;
    margin: 0;
}

#comment-text>p {
    margin-top: 1.2rem;
    margin-bottom: 0rem;
}

#comment-text-expand {
    position: absolute;
    background: linear-gradient(to top, var(--colour-surface-variant), var(--colour-surface-variant) 45%, transparent);
    bottom: 0rem;
    inset-inline: 0rem;
}

#comment-text:focus {
    background-color: var(--colour-surface-bright);
    padding: .25rem .5rem;
    outline: 2px solid var(--colour-tertiary);
}

.expanded #comment-text {
    max-height: calc(100vh - 20rem);
    overflow-y: auto;

    line-clamp: unset;
    -webkit-line-clamp: unset;
}

.expanded>#comment-text-expand {
    position: relative;
}

.skinny #title {
    height: 3.6rem;
    max-height: 3.6rem;
    line-clamp: 3;
    -webkit-line-clamp: 3;
}

#selection-border {
    position: absolute;
    border: .3rem var(--colour-primary) solid;
    inset: 0;
    pointer-events: none;
    border-radius: .5rem;
}

#selection-border.special {
    border: .3rem var(--colour-secondary) solid;
}

#selection-border.extra-special {
    border: .3rem var(--colour-tertiary) solid;
}

#playback {
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    padding: 0rem .5rem .5rem .5rem;
}

#timeline-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 50rem;
    background: var(--colour-surface-seethrough);
    padding: .5rem;
    border-radius: 2rem;
    pointer-events: auto;
}

#timeline {
    position: relative;
    width: 100%;
    margin: 0 1rem;
    height: 2rem;
    display: flex;
    align-items: center;
    cursor: pointer;
}

#timeline-track {
    position: absolute;
    width: 100%;
    height: 4px;
    background: var(--colour-surface-tint);
    border-radius: 2px;
    pointer-events: none;
}

.timeline-minute-marker {
    position: absolute;
    width: 1px;
    height: 15px;
    background: var(--colour-outline);
    transform: translate(-50%, -50%);
    top: 50%;
    pointer-events: none;
}

.timeline-hour-label {
    position: absolute;
    font-size: 75%;
    color: var(--colour-text-extra-muted);
    transform: translate(-50%, -50%);
    bottom: calc(100% - 1rem)
}

.timeline-hour-marker {
    position: absolute;
    width: 2px;
    height: 25px;
    background: var(--colour-outline-bright);
    border-radius: 1px;
    transform: translate(-50%, -50%);
    top: 50%;
    pointer-events: none;
}

#timeline-interaction-handle {
    position: absolute;
    top: 50%;
    background: none;
    color: var(--colour-text);
    border-radius: 4px;
    transform: translate(-50%, -50%);
    z-index: 2;
    cursor: grab;
    font-size: 12px;
    font-weight: bold;
    user-select: none;
    pointer-events: auto;
    overflow: visible;
    display: flex;
}

#timeline-interaction-handle.animating {
    transition: left 0.3s ease-out;
}

#timeline-interaction-handle:active {
    cursor: grabbing;
}

#timeline-interaction-handle div {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#timeline-interaction-handle button {
    flex: 1 1 auto;
    border-radius: 0;
    height: 3rem;
    min-width: 3rem;
    font-size: 150%;
}


#timeline-interaction-handle button.active {
    background: var(--colour-text);
}

#timeline-interaction-handle button.active use {
    fill: var(--colour-background);
}

#timeline-interaction-handle button:disabled {
    opacity: 1;
    background: var(--colour-background);
    filter: none;
    cursor: not-allowed;
    pointer-events: auto;
}

#timeline-interaction-handle button:disabled use {
    fill: var(--colour-text-extra-muted)
}

#timeline-live-indicator {
    position: absolute;
    border-radius: 50%;
    top: 50%;
    width: 1rem;
    height: 1rem;
    transform: translate(-50%, -50%);
    background: var(--colour-secondary);
}

#timeline-popup {
    position: absolute;
    top: -3rem;
    background: var(--colour-surface);
    color: var(--colour-text);
    font-weight: bold;
    font-family: var(--font-family-sans);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    font-size: 0.875rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 2;
}

#timeline-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--colour-surface);
}

#timeline:hover #timeline-popup {
    opacity: 1;
}

.timeline-button {
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    color: var(--colour-text);
    border: var(--colour-primary) solid;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 150%;
}

.timeline-button:hover {
    background: var(--colour-surface-variant);
}

.timeline-button:active {
    background: var(--colour-primary);
}

.timeline-button.buffering {
    border-color: var(--colour-text-muted);
    color: var(--colour-text-muted);
}

.loading-container {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    padding-block: 1rem;
    color: var(--colour-text);
}

.spinner {
    border: 3px solid var(--colour-primary-alpha);
    border-radius: 50%;
    border-top: 3px solid var(--colour-primary-variant);
    width: 1rem;
    height: 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

#top-panel {
    padding: .5rem;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
}

#top-panel select {
    background: var(--colour-surface);
    color: var(--colour-text);
    border: none;
    border-radius: .5rem;
    padding: .25rem .5rem;
    font-family: var(--font-family-sans);
    font-size: 1rem;
    cursor: pointer;
    pointer-events: all;
    -webkit-transition: none;
    transition: none;
}

.read-state-toggle.unread {
    border-color: var(--colour-surface-bright);
}

.read-state-toggle.seen {
    border-color: var(--colour-secondary);
}

.read-state-toggle.read {
    background: var(--colour-primary);
}

@media (hover: none) {
    button {
        width: 3rem;
        height: 3rem;
        font-size: 150%;
    }

    svg {
        width: 1.75rem;
        height: 1.75rem;
    }

    #buttons {
        flex-direction: row;
        gap: .75rem;
    }

    #button-container {
        flex: 0 0 3rem;
        padding: .75rem;
        border-radius: 3rem;
    }

    #details-outer {
        flex-direction: column-reverse;
    }

    #details-outer :nth-child(2) {
        align-self: stretch;
    }

    /* Timeline adjustments for touch devices */
    #timeline {
        height: 3rem;
        margin: 0 0.5rem;
    }

    #timeline-handle {
        width: 20px;
        height: 20px;
    }

    #timeline-handle:hover {
        transform: translateX(-50%) scale(1.1);
    }

    #timeline-popup {
        top: -3.5rem;
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }

    #timeline-popup::after {
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-top: 8px solid var(--colour-surface);
    }

    #timeline-container {
        background: var(--colour-surface-variant);
    }

    .timeline-button {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.4rem;
    }
}

@media (hover: none) {
    #details {
        border-radius: 0;
    }

    #details-container {
        inset-inline: 0rem;
        bottom: 0rem;
    }

    #details-outer {
        gap: 0;
    }

    #selection-border {
        border-top: none !important;
        border-inline: none !important;
        border-radius: 0;
    }

    #submission-range {
        border-radius: 0;
    }

    #button-container {
        border-radius: 0;
        width: 100%;
        background: var(--colour-surface-variant);
        display: flex;
        justify-content: space-between;
        padding: .5rem 0;
    }

    #button-container> :nth-child(1) {
        margin-inline-start: .5rem;
        gap: .5rem;
    }

    #button-container> :nth-child(2) {
        margin-inline-end: .5rem;
    }

    #pause-toggle {
        display: unset;
    }

    #timeline-container {
        border-radius: 0rem;
        padding: 0rem;
        background: var(--colour-surface-variant);
    }

    #playback {
        padding: 0rem;
    }
}

/* Timeline scrubbing center display */
#center-timeline-display {
    position: fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-family-sans);
    font-weight: bold;
    font-size: 2.5rem;
    color: var(--colour-text);
    background: var(--colour-surface-seethrough);
    padding: 1rem 2rem;
    border-radius: 2rem;
    pointer-events: none;
    z-index: 2;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    text-shadow: 0 0 4px black, 0 0 16px rgba(0, 0, 0, 0.1);
}

#center-timeline-display.backward {
    text-shadow: 0 0 4px #F40, 0 0 16px rgba(0, 0, 0, 0.1);
}

#center-timeline-display.forward {
    text-shadow: 0 0 4px #08F, 0 0 16px rgba(0, 0, 0, 0.1);
}

#center-timeline-display.buffering {
    color: var(--colour-text-muted);
}

/* Timeline display transitions */
.timeline-display-enter-active,
.timeline-display-leave-active {
    transition: all 0.3s ease;
}

.timeline-display-enter-from,
.timeline-display-leave-to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}

.timeline-display-enter-to,
.timeline-display-leave-from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#help-text-container {
    background: var(--colour-surface);
    color: var(--colour-text);
    padding: .5rem 1rem;
    border: 2px var(--colour-outline) solid;
    border-radius: 1rem;
    pointer-events: auto;
    user-select: none;
    z-index: 4;
    display: flex;
    align-items: center;
    flex-direction: column;
    text-align: center;
    gap: 2rem;
    max-width: 35rem;
    width: 100%;
}

@media (max-width: 38rem) {
    #help-text-container {
        width: 100%;
        max-width: unset;
        border: none;
        border-radius: 0;
        height: 100%;
        justify-content: center;
    }
}

#help-text-container>div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}

#help-text-container>div div {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .5rem;
}

#help-text-buttons {
    display: flex;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
}

.help-blob {
    position: absolute;
    top: -10px;
    left: -10px;
}

#key-help-container {
    display: flex;
    gap: .5rem;
}

.key-help {
    pointer-events: all;
    cursor: pointer;
    flex: 0 0 auto;
    border: 1px var(--colour-text-muted) solid;
    border-radius: .5rem;
    padding: 1rem;
    background: var(--colour-surface-seethrough);
    color: var(--colour-text);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.key-help.only-key {
    font-size: 150%;
    padding: .25rem;
    width: 1.5rem;
}

.key-help.textual {
    font-size: 80%;
    padding: .25rem;
    line-height: .8rem;
    width: 2rem;
    height: 2rem;
    justify-content: center;
}

.key-help.tap {
    border-radius: 100%;
    border-width: 2px;
    border-color: var(--colour-secondary)
}

.key-help.tap.selected {
    border-color: var(--colour-primary);
    border-width: 5px;
}

.key-help>svg {
    width: 1rem;
    height: 1rem;
    fill: var(--colour-text);
    margin-bottom: .25rem;
}

.key-help> :nth-child(3) {
    font-size: 150%;
}

#key-help-container :nth-child(1) {
    border-color: var(--colour-tertiary);
}

#key-help-container :nth-child(2) {
    border-color: var(--colour-secondary);
}

#hide-key-button {
    pointer-events: auto;
    cursor: pointer;
    color: var(--colour-text);
    font-size: 80%;
    text-decoration: underline;
    background: var(--colour-surface);
    padding: .25rem;
}

#search-results {
    color: var(--colour-text-muted);
    font-style: italic;
    user-select: none;
}

#search-container {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

#search-bar {
    pointer-events: auto;
    user-select: none;
    background: var(--colour-surface-bright);
    padding: .5rem;
    border-radius: 1rem;
    color: var(--colour-text);
    display: flex;
    align-items: flex-start;
    gap: .25rem;
}

.minimised #search-bar {
    border-radius: 2rem;
    border: 1px dashed var(--colour-text-muted);
    align-items: stretch;
    cursor: pointer;
}

#search-container.minimised  {
    align-items: center;
}

.closed #search-bar {
    border-radius: 2rem;
    padding: 0rem;
}

#search-controls {
    display: flex;
    align-items: stretch;
    gap: .5rem;
    flex-wrap: wrap;
    margin-inline: .25rem;
}

#search-controls>div {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

#search-bar label {
    font-size: 90%;
    order: 1;
}

#search-buttons {
    display: flex;
    gap: .25rem;
}

.search-text {
    background: var(--colour-surface);
    padding-inline: .5rem;
}

.minimised #search-controls>div {
    flex-direction: row;
    align-items: center;
}

@media (max-width: 38rem) {
    #search-bar {
        flex-direction: column;
        gap: .75rem;
    }
    #search-controls {
        flex-direction: column;
    }
    .minimised #search-bar {
        flex-direction: row;
    }
    .minimised #search-controls {
        flex-direction: row;
    }
    #search-bar label {
        order: 0;
    }

}

#zoom-container {
    align-self: center !important;
    position: relative;
}

#zoom-panel {
    position: absolute;
    display: flex;
    align-items: center;
    gap: .5rem;
    transform: translate(-50%, calc(-50% + 1.5px));
    color: var(--colour-text-muted);
    z-index: 4;
}

#zoom-buttons {
    display: flex;
    align-items: center;
    gap: .5rem;
    border: none;
    padding: 0;
    margin: 0;
    /* background: linear-gradient(to bottom, transparent, transparent 40%, var(--colour-surface-bright) 40%, var(--colour-surface-bright) 60%, transparent 60%, transparent 100%); */
}

#zoom-buttons button {
    border-color: var(--colour-surface-bright);
}

#zoom-buttons button:active {
    background: var(--colour-primary)
}

#zoom-buttons button:active.special {
    background: var(--colour-secondary)
}

#zoom-buttons button.selected {
    border: var(--colour-primary) 3px solid;
}

#zoom-buttons button.special.selected {
    border: var(--colour-secondary) 3px solid;
}


/* Iframe container responsive styles */
.iframe-backdrop {
    pointer-events: all;
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.iframe-container {
    position: relative;
    width: 85%;
    min-width: 800px;
    max-width: 1200px;
    max-height: 100%;
    background: var(--colour-hn-background);
    color: var(--colour-hn-text);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.iframe-buttons {
    position: absolute;
    top: 1.5rem;
    right: 1rem;
    z-index: 11;
    display: flex;
    flex-direction: row-reverse;
    gap: 0.5rem;
}

/* When window is less than 750px wide, use full width and remove padding */
@media (max-width: 750px) {
    .iframe-backdrop {
        padding: 0;
    }

    .iframe-container {
        width: 100%;
        min-width: 100%;
        border-radius: 0;
        height: 100%;
        max-height: 100vh;
    }

    .iframe-buttons {
        top: auto;
        bottom: 2rem;
        right: 2rem;
        flex-direction: row;
    }
}

.iframe-container a {
    color: var(--colour-hn-link) !important;
}

.comments-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.comments-container:focus-within {
    outline: none;
    border-top: 1rem solid var(--colour-primary);
}

.comment-thread {
    margin-inline-start: 1.5rem;
}

@media screen and (max-width: 600px) {
    .comment-thread {
        margin-inline-start: 1rem;
    }
}

@media screen and (max-width: 450px) {
    .comment-thread {
        margin-inline-start: 0rem;
    }
}


.comment-thread.is-root {
    margin-inline-start: 0rem;
}

.comment-item {
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.comment-header {
    display: flex;
    align-items: center;
    font-size: 80%;
    gap: 0.3rem;
    padding-top: .5rem;
    margin-bottom: 0.5rem;
}

.comment-expand-toggle {
    background: none;
    border: none;
    border-radius: 0rem;
    cursor: pointer;
    font-family: monospace;
    font-size: 90%;
    padding: 0;
    color: var(--colour-hn-link);
    width: auto;
    height: auto;
}

.inline-comment-text {
    font-size: 90%;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    max-width: 970px;
}

.inline-comment-text :deep(p) {
    margin: 0.5rem 0;
}

.inline-comment-text code {
    font-size: 120%;
}

.comment-actions {
    font-size: 80%;
}

.comment-actions a {
    color: var(--colour-hn-text) !important;
    text-decoration: underline;
}

.comment-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.spinner {
    width: 16px;
    height: 16px;
    border-top: 2px solid var(--colour-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Speech Bubble Component */
.speech-bubble-container {
    position: relative;
    pointer-events: auto;
    user-select: none;
    outline: none;
}

.speech-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speech-bubble-content {
    background: var(--colour-surface-bright);
    color: var(--colour-text);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 120px;
    max-width: 300px;
    word-wrap: break-word;
}

.speech-bubble-tail {
    fill: var(--colour-surface-bright);
    width: 60px;
    height: 40px;
    transform: translateX(-50%);
}

/* Speech Bubble Hop Animation */
@keyframes speechBubbleHopIn {
    0% {
        transform: translateX(-50%) translateY(20px) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) translateY(-5px) scale(1.05);
        opacity: 1;
    }
    70% {
        transform: translateX(-50%) translateY(2px) scale(0.98);
    }
    85% {
        transform: translateX(-50%) translateY(-1px) scale(1.01);
    }
    100% {
        transform: translateX(-50%) translateY(0px) scale(1);
        opacity: 1;
    }
}

.speech-bubble-hop-in {
    animation: speechBubbleHopIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Timeline Jump Component */
.timeline-jump {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: 0.5rem;
    user-select: none;
    pointer-events: auto;
    align-items: center;
}

.timeline-jump-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: center;
}

.timeline-jump-btn {
    border-color: var(--colour-surface-bright);
    background-color: var(--colour-surface);
}

.timeline-jump-date,
.timeline-jump-time {
    min-width: 8rem;
    text-align: center;
    font-weight: 500;
    color: var(--colour-text);
    font-size: 0.875rem;
}